merge: W53S —— 退出登录加 Miuix 确认对话框;保活那行补「24 小时累计 6 小时」上限事实 + 权限被拒时的「去系统设置」入口
This commit is contained in:
commit
6505512c0a
3 files changed
+183
-14
No files matched your search
@@ -11,7 +11,13 @@ import org.junit.Test
|
||||
* 这一行的价值全在「说真话」,所以钉的也是真话:
|
||||
* 1. **开的代价自己说出来**(常驻通知 + 多耗电)——不说的代价会变成用户某天「莫名多了条通知」的意外;
|
||||
* 2. **跑不了的时候不许说在跑**(通知权限被拒 / 被撤时,一个字都不提「已开」);
|
||||
* 3. 四个分支互不相同:任何一次改文案都不该把某一档悄悄吞掉。
|
||||
* 3. **能跑多久也要说**——系统给 `dataSync` 型前台服务的额度是 24 小时窗口内累计 6 小时
|
||||
* (`KeepAliveService.onTimeout` 到点自停),所以「全天候保活」做不到;这句必须落在
|
||||
* 用户据以做决定的「关 / 开」两档里,否则他会以为自己买到了永远;
|
||||
* 4. **话与按钮指着同一个地方**——权限那两档写着「到系统设置里允许」,设置页那个
|
||||
* 「去系统设置」按钮就出现在这两档下(`KeepAliveRow` 里算 `settingsShortcut` 的那个条件
|
||||
* 与之一一对应);
|
||||
* 5. 四个分支互不相同:任何一次改文案都不该把某一档悄悄吞掉。
|
||||
*/
|
||||
class KeepAliveSummaryTest {
|
||||
|
||||
@@ -47,6 +53,36 @@ class KeepAliveSummaryTest {
|
||||
assertFalse("被拒时不许写成「已开」:$text", text.contains("已开"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 「关」和「开」两档是用户据以做决定的那两档,系统上限必须出现在这里——
|
||||
* 只在「已开」那一档说,等于默认所有人都已经开过一遍(而默认态恰恰是关的)。
|
||||
*/
|
||||
@Test
|
||||
fun `both the off and the on state admit the system's ceiling`() {
|
||||
val off = keepAliveSummary(enabled = false, notificationsAllowed = true, permissionJustDenied = false)
|
||||
val on = keepAliveSummary(enabled = true, notificationsAllowed = true, permissionJustDenied = false)
|
||||
|
||||
listOf("关" to off, "开" to on).forEach { (state, text) ->
|
||||
assertTrue("「$state」那一档必须写明是 24 小时的窗口:$text", text.contains("24 小时"))
|
||||
assertTrue("「$state」那一档必须写明累计上限是 6 小时:$text", text.contains("6 小时"))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限把功能挡住的那两档都写了「到系统设置里允许」,而设置页那个「去系统设置」按钮
|
||||
* 正好只在 `!allowed && (permissionJustDenied || enabled)` 时出现——正是这两档。
|
||||
* 钉住这一点是为了防止两边分叉:文案让人去 A、按钮把人送去 B,比没有按钮更糟。
|
||||
*/
|
||||
@Test
|
||||
fun `the permission-blocked states point at the system settings`() {
|
||||
val revoked = keepAliveSummary(enabled = true, notificationsAllowed = false, permissionJustDenied = false)
|
||||
val denied = keepAliveSummary(enabled = false, notificationsAllowed = false, permissionJustDenied = true)
|
||||
|
||||
listOf("权限被撤" to revoked, "刚被拒" to denied).forEach { (state, text) ->
|
||||
assertTrue("「$state」那一档得把用户指向系统设置:$text", text.contains("系统设置"))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the four states are told apart`() {
|
||||
val texts = listOf(
|
||||
|
||||
Reference in new issue
Block a user