mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Updates to coroutine MVP logic
This commit is contained in:
parent
760615fbc6
commit
4229840dc6
2 changed files with 5 additions and 4 deletions
|
@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.ui.base.presenter
|
|||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
|
@ -23,7 +23,9 @@ open class BaseCoroutinePresenter<T> {
|
|||
}
|
||||
|
||||
open fun onCreate() {
|
||||
presenterScope = CoroutineScope(Job() + Dispatchers.Default)
|
||||
if (!isScopeInitialized) {
|
||||
presenterScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
}
|
||||
}
|
||||
|
||||
open fun onDestroy() {
|
||||
|
|
|
@ -491,13 +491,13 @@ class RecentsController(bundle: Bundle? = null) :
|
|||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
binding.downloadBottomSheet.root.onDestroy()
|
||||
snack?.dismiss()
|
||||
snack = null
|
||||
}
|
||||
|
||||
override fun onDestroyView(view: View) {
|
||||
super.onDestroyView(view)
|
||||
binding.downloadBottomSheet.root.onDestroy()
|
||||
displaySheet?.dismiss()
|
||||
displaySheet = null
|
||||
}
|
||||
|
@ -860,7 +860,6 @@ class RecentsController(bundle: Bundle? = null) :
|
|||
(activity as? MainActivity)?.showTabBar(true)
|
||||
}
|
||||
} else {
|
||||
if (type == ControllerChangeType.POP_EXIT) presenter.onDestroy()
|
||||
val lastController = router.backstack.lastOrNull()?.controller
|
||||
if (lastController !is DialogController) {
|
||||
(activity as? MainActivity)?.showTabBar(show = false, animate = lastController !is SmallToolbarInterface)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue