Merge pull request #2880 from kiwix/Issue#2730

Fix app crash when user navigates away and then returns to the app in…
This commit is contained in:
Kelson 2022-06-30 19:46:40 +02:00 committed by GitHub
commit a89258b85b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,7 @@ class KiwixMainActivity : CoreMainActivity() {
override val topLevelDestinations =
setOf(R.id.downloadsFragment, R.id.libraryFragment, R.id.readerFragment)
private var isIntroScreenVisible: Boolean = false
override fun injection(coreComponent: CoreComponent) {
cachedComponent.inject(this)
}
@ -98,12 +99,15 @@ class KiwixMainActivity : CoreMainActivity() {
handleDrawerOnNavigation()
}
}
if (sharedPreferenceUtil.showIntro()) {
if (sharedPreferenceUtil.showIntro() && !isIntroScreenNotVisible()) {
navigate(KiwixReaderFragmentDirections.actionReaderFragmentToIntroFragment())
}
sharedPreferenceUtil.setIsPlayStoreBuildType(BuildConfig.IS_PLAYSTORE)
}
private fun isIntroScreenNotVisible(): Boolean =
isIntroScreenVisible.also { isIntroScreenVisible = true }
override fun onSupportActionModeStarted(mode: ActionMode) {
super.onSupportActionModeStarted(mode)
actionMode = mode