|
@@ -34,6 +34,7 @@ import dev.chrisbanes.insetter.applyInsetter
|
|
|
import eu.kanade.tachiyomi.BuildConfig
|
|
|
import eu.kanade.tachiyomi.Migrations
|
|
|
import eu.kanade.tachiyomi.R
|
|
|
+import eu.kanade.tachiyomi.data.cache.ChapterCache
|
|
|
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
|
|
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
|
|
import eu.kanade.tachiyomi.data.updater.AppUpdateChecker
|
|
@@ -72,6 +73,7 @@ import kotlinx.coroutines.flow.launchIn
|
|
|
import kotlinx.coroutines.flow.merge
|
|
|
import kotlinx.coroutines.flow.onEach
|
|
|
import logcat.LogPriority
|
|
|
+import uy.kohesive.injekt.injectLazy
|
|
|
|
|
|
class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|
|
|
|
@@ -94,6 +96,8 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|
|
*/
|
|
|
private val backstackLiftState = mutableMapOf<String, Boolean>()
|
|
|
|
|
|
+ private val chapterCache: ChapterCache by injectLazy()
|
|
|
+
|
|
|
// To be checked by splash screen. If true then splash screen will be removed.
|
|
|
var ready = false
|
|
|
|
|
@@ -464,7 +468,10 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|
|
// Exit confirmation (resets after 2 seconds)
|
|
|
lifecycleScope.launchUI { resetExitConfirmation() }
|
|
|
} else if (backstackSize == 1 || !router.handleBack()) {
|
|
|
- // Regular back
|
|
|
+ // Regular back (i.e. closing the app)
|
|
|
+ if (preferences.autoClearChapterCache()) {
|
|
|
+ chapterCache.clear()
|
|
|
+ }
|
|
|
super.onBackPressed()
|
|
|
}
|
|
|
}
|