From 467ceacb17770399fd1f276aebe887bafb516f49 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Sat, 24 Sep 2022 21:46:35 +0700 Subject: [PATCH] SecureActivityDelegate: Fix cold-start only lock behavior (#8066) --- .../ui/base/delegate/SecureActivityDelegate.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt index fb4f1b7cb..3d36d2f97 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt @@ -25,8 +25,8 @@ interface SecureActivityDelegate { companion object { fun onApplicationCreated() { val lockDelay = Injekt.get().lockAppAfter().get() - if (lockDelay == 0) { - // Restore always active app lock + if (lockDelay <= 0) { + // Restore always active/on start app lock // Delayed lock will be restored later on activity resume lockState = LockState.ACTIVE } @@ -39,8 +39,12 @@ interface SecureActivityDelegate { preferences.lastAppClosed().set(Date().time) } if (!AuthenticatorUtil.isAuthenticating) { - lockState = if (preferences.lockAppAfter().get() >= 0) { + val lockAfter = preferences.lockAppAfter().get() + lockState = if (lockAfter > 0) { LockState.PENDING + } else if (lockAfter == -1) { + // Never lock on idle + LockState.INACTIVE } else { LockState.ACTIVE }