Reset Incognito Mode on app relaunch

From tachiyomiorg/tachiyomi@f407e30b6e

Co-Authored-By: arkon <4098258+arkon@users.noreply.github.com>
This commit is contained in:
Jays2Kings 2021-04-27 16:01:35 -04:00
parent f574cfcbf7
commit 0b4f83d83e

View File

@ -34,6 +34,8 @@ import java.security.Security
) )
open class App : Application(), LifecycleObserver { open class App : Application(), LifecycleObserver {
val preferences: PreferencesHelper by injectLazy()
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree()) if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
@ -52,12 +54,15 @@ open class App : Application(), LifecycleObserver {
LocaleHelper.updateConfiguration(this, resources.configuration) LocaleHelper.updateConfiguration(this, resources.configuration)
ProcessLifecycleOwner.get().lifecycle.addObserver(this) ProcessLifecycleOwner.get().lifecycle.addObserver(this)
// Reset Incognito Mode on relaunch
preferences.incognitoMode().set(false)
} }
@OnLifecycleEvent(Lifecycle.Event.ON_STOP) @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
@Suppress("unused")
fun onAppBackgrounded() { fun onAppBackgrounded() {
// App in background // App in background
val preferences: PreferencesHelper by injectLazy()
if (preferences.lockAfter().getOrDefault() >= 0) { if (preferences.lockAfter().getOrDefault() >= 0) {
SecureActivityDelegate.locked = true SecureActivityDelegate.locked = true
} }