Fix weird backstack behaviour after clearing database

Shouldn't affect anything since controllers are recreated when entering different sections.
This commit is contained in:
arkon 2020-07-25 16:45:27 -04:00
parent d749e309f8
commit abd69d4f91
2 changed files with 1 additions and 10 deletions

View File

@ -98,7 +98,7 @@ abstract class DialogController : RestoreViewOnCreateController {
/** /**
* Dismiss the dialog and pop this controller * Dismiss the dialog and pop this controller
*/ */
fun dismissDialog() { private fun dismissDialog() {
if (dismissed) { if (dismissed) {
return return
} }

View File

@ -10,8 +10,6 @@ import android.os.Bundle
import android.provider.Settings import android.provider.Settings
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.ChapterCache import eu.kanade.tachiyomi.data.cache.ChapterCache
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
@ -20,7 +18,6 @@ import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.util.preference.defaultValue import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.preference.onClick import eu.kanade.tachiyomi.util.preference.onClick
import eu.kanade.tachiyomi.util.preference.preference import eu.kanade.tachiyomi.util.preference.preference
@ -173,12 +170,6 @@ class SettingsAdvancedController : SettingsController() {
} }
private fun clearDatabase() { private fun clearDatabase() {
// Avoid weird behavior by going back to the library.
val newBackstack = listOf(RouterTransaction.with(LibraryController())) +
router.backstack.drop(1)
router.setBackstack(newBackstack, FadeChangeHandler())
db.deleteMangasNotInLibrary().executeAsBlocking() db.deleteMangasNotInLibrary().executeAsBlocking()
db.deleteHistoryNoLastRead().executeAsBlocking() db.deleteHistoryNoLastRead().executeAsBlocking()
activity?.toast(R.string.clear_database_completed) activity?.toast(R.string.clear_database_completed)