diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index e31e3f99d..37a88933c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -172,6 +172,10 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory { }.build() } + override fun onCreate(owner: LifecycleOwner) { + SecureActivityDelegate.onApplicationCreated() + } + override fun onStop(owner: LifecycleOwner) { SecureActivityDelegate.onApplicationStopped() } 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 537dcae23..03822c761 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 @@ -23,6 +23,15 @@ interface SecureActivityDelegate { fun registerSecureActivity(activity: AppCompatActivity) companion object { + fun onApplicationCreated() { + val lockDelay = Injekt.get().lockAppAfter().get() + if (lockDelay == 0) { + // Restore always active app lock + // Delayed lock will be restored later on activity resume + lockState = LockState.ACTIVE + } + } + fun onApplicationStopped() { val preferences = Injekt.get() if (!preferences.useAuthenticator().get()) return