Bladeren bron

feat: 默认关闭私密验证

HapeLee 1 maand geleden
bovenliggende
commit
45d5f51d19

+ 3 - 3
app/src/main/java/io/legado/app/data/repository/PrivateAccessRepository.kt

@@ -63,7 +63,7 @@ class PrivateAccessRepository(
         .distinctUntilChanged()
 
     private val enabledFlow = settingsRepository
-        .getBoolean(LocalPreferencesKeys.PRIVATE_ENABLED.name, true)
+        .getBoolean(LocalPreferencesKeys.PRIVATE_ENABLED.name, false)
         .distinctUntilChanged()
 
     private val backgroundGraceFlow = settingsRepository
@@ -214,7 +214,7 @@ class PrivateAccessRepository(
         grantedBookUrls = grantedBookUrlsFlow.value,
         grantedGroupIds = grantedGroupIdsFlow.value,
         // 读内存里的当前值而不是 flow:这个函数是同步的(AI 工具等同步路径要用)
-        isEnabled = AppConfigStore.getBoolean(LocalPreferencesKeys.PRIVATE_ENABLED.name) ?: true,
+        isEnabled = AppConfigStore.getBoolean(LocalPreferencesKeys.PRIVATE_ENABLED.name) ?: false,
     ).isTargetGranted(bookUrl, group)
 
     override fun revoke(target: PrivateUnlockTarget) {
@@ -312,7 +312,7 @@ class PrivateAccessRepository(
         unlockScope = AppConfigStore.getString(LocalPreferencesKeys.PRIVATE_UNLOCK_SCOPE.name)
             ?.let { stored -> PrivateUnlockScope.entries.firstOrNull { it.name == stored } }
             ?: PrivateUnlockScope.AppSession,
-        enabled = AppConfigStore.getBoolean(LocalPreferencesKeys.PRIVATE_ENABLED.name) ?: true,
+        enabled = AppConfigStore.getBoolean(LocalPreferencesKeys.PRIVATE_ENABLED.name) ?: false,
         backgroundGraceSeconds =
             AppConfigStore.getInt(LocalPreferencesKeys.PRIVATE_BACKGROUND_GRACE_SECONDS.name) ?: 0
     )

+ 1 - 1
app/src/main/java/io/legado/app/domain/model/PrivateAccess.kt

@@ -65,7 +65,7 @@ data class PrivateAccessState(
      * 私密功能总开关。关掉时 [isTargetGranted] 恒真——不验证、不脱敏、不守卫;
      * 密码与标记都留着,重新打开即刻恢复。判定集中在这里,所以各处不用各判一次。
      */
-    val isEnabled: Boolean = true,
+    val isEnabled: Boolean = false,
 ) {
     /** 是否可以直接弹系统生物验证框(而不是密码输入) */
     val canUseBiometricShortcut: Boolean

+ 1 - 1
app/src/main/java/io/legado/app/domain/model/settings/PrivateAccessSettings.kt

@@ -25,7 +25,7 @@ data class PrivateAccessSettings(
      *
      * 放在末尾是为了不破坏按位置构造的调用方。
      */
-    val enabled: Boolean = true,
+    val enabled: Boolean = false,
     /**
      * 离开前台后多久才要求重新验证(秒)。只在 [PrivateUnlockScope.UntilBackground] 下有意义:
      * 0 表示"离开即失效",>0 表示这段时间内回来不重验。

+ 1 - 0
app/src/test/java/io/legado/app/domain/model/PrivateAccessTest.kt

@@ -60,6 +60,7 @@ class PrivateAccessTest {
         grantedBookUrls: Set<String> = emptySet(),
         grantedGroupIds: Set<Long> = emptySet(),
     ) = PrivateAccessState(
+        isEnabled = true,
         isUnlocked = isUnlocked,
         grantedBookUrls = grantedBookUrls,
         grantedGroupIds = grantedGroupIds,