Split security preferences from PrefrencesHelper (#8030)
(cherry picked from commit b668364afb)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt
# app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSecurityController.kt
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package eu.kanade.tachiyomi.core.security
|
||||
|
||||
import eu.kanade.tachiyomi.core.R
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.preference.getEnum
|
||||
|
||||
class SecurityPreferences(
|
||||
private val preferenceStore: PreferenceStore
|
||||
) {
|
||||
|
||||
fun useAuthenticator() = this.preferenceStore.getBoolean("use_biometric_lock", false)
|
||||
|
||||
fun lockAppAfter() = this.preferenceStore.getInt("lock_app_after", 0)
|
||||
|
||||
fun secureScreen() = this.preferenceStore.getEnum("secure_screen_v2", SecureScreenMode.INCOGNITO)
|
||||
|
||||
fun hideNotificationContent() = this.preferenceStore.getBoolean("hide_notification_content", false)
|
||||
|
||||
// SY -->
|
||||
fun authenticatorTimeRanges() = this.preferenceStore.getStringSet("biometric_time_ranges", mutableSetOf())
|
||||
|
||||
fun authenticatorDays() = this.preferenceStore.getInt("biometric_days", 0x7F)
|
||||
// SY <--
|
||||
|
||||
/**
|
||||
* For app lock. Will be set when there is a pending timed lock.
|
||||
* Otherwise this pref should be deleted.
|
||||
*/
|
||||
fun lastAppClosed() = this.preferenceStore.getLong("last_app_closed", 0)
|
||||
|
||||
enum class SecureScreenMode(val titleResId: Int) {
|
||||
ALWAYS(R.string.lock_always),
|
||||
INCOGNITO(R.string.pref_incognito_mode),
|
||||
NEVER(R.string.lock_never),
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user