Minor cleanup

This commit is contained in:
arkon 2021-05-14 09:10:17 -04:00
parent 9cbe053e79
commit fcde6c2b84
2 changed files with 15 additions and 14 deletions

View file

@ -28,24 +28,25 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
}
fun onResume() {
val lockApp = preferences.useBiometricLock().get()
if (lockApp && BiometricUtil.isSupported(activity)) {
if (isAppLocked()) {
val intent = Intent(activity, BiometricUnlockActivity::class.java)
activity.startActivity(intent)
activity.overridePendingTransition(0, 0)
if (preferences.useBiometricLock().get()) {
if (BiometricUtil.isSupported(activity)) {
if (isAppLocked()) {
activity.startActivity(Intent(activity, BiometricUnlockActivity::class.java))
activity.overridePendingTransition(0, 0)
}
} else {
preferences.useBiometricLock().set(false)
}
} else if (lockApp) {
preferences.useBiometricLock().set(false)
}
}
private fun isAppLocked(): Boolean {
return locked &&
(
preferences.lockAppAfter().get() <= 0 ||
Date().time >= preferences.lastAppUnlock().get() + 60 * 1000 * preferences.lockAppAfter().get()
)
if (!locked) {
return false
}
return preferences.lockAppAfter().get() <= 0 ||
Date().time >= preferences.lastAppUnlock().get() + 60 * 1000 * preferences.lockAppAfter().get()
}
companion object {

View file

@ -295,7 +295,7 @@
<string name="tapping_inverted_both">Both</string>
<string name="pref_reader_actions">Actions</string>
<string name="pref_read_with_long_tap">Show on long tap</string>
<string name="pref_create_folder_per_manga">Saves pages into separate folders</string>
<string name="pref_create_folder_per_manga">Save pages into separate folders</string>
<string name="pref_create_folder_per_manga_summary">Creates folders according to manga title</string>
<string name="pref_reader_theme">Background color</string>
<string name="white_background">White</string>