From 3c186a3c8d3fd74f489a7aa2a27906d29502e0f6 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Mon, 24 May 2021 20:09:35 +0700 Subject: [PATCH] Fix incognito mode disabled after the app kicked out of memory (#5167) The application class onCreate will also be called when user navigates to an activity after the app process is killed by the system. So make sure the incognito is disabled only when the entry point of the app is created from scratch (e.g. after being force closed by the user). --- app/src/main/java/eu/kanade/tachiyomi/App.kt | 3 --- app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 7292b81b8..370e5199b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -74,9 +74,6 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory { ProcessLifecycleOwner.get().lifecycle.addObserver(this) - // Reset Incognito Mode on relaunch - preferences.incognitoMode().set(false) - // Show notification to disable Incognito Mode when it's enabled preferences.incognitoMode().asFlow() .onEach { enabled -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 501bb0113..7529b561e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -224,6 +224,9 @@ class MainActivity : BaseViewBindingActivity() { syncActivityViewWithController(router.backstack.lastOrNull()?.controller()) if (savedInstanceState == null) { + // Reset Incognito Mode on relaunch + preferences.incognitoMode().set(false) + // Show changelog prompt on update if (Migrations.upgrade(preferences) && !BuildConfig.DEBUG) { WhatsNewDialogController().showDialog(router)