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.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@ open class BaseCoroutinePresenter<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onCreate() {
|
open fun onCreate() {
|
||||||
presenterScope = CoroutineScope(Job() + Dispatchers.Default)
|
if (!isScopeInitialized) {
|
||||||
|
presenterScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onDestroy() {
|
open fun onDestroy() {
|
||||||
|
|
|
@ -491,13 +491,13 @@ class RecentsController(bundle: Bundle? = null) :
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
binding.downloadBottomSheet.root.onDestroy()
|
||||||
snack?.dismiss()
|
snack?.dismiss()
|
||||||
snack = null
|
snack = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
super.onDestroyView(view)
|
super.onDestroyView(view)
|
||||||
binding.downloadBottomSheet.root.onDestroy()
|
|
||||||
displaySheet?.dismiss()
|
displaySheet?.dismiss()
|
||||||
displaySheet = null
|
displaySheet = null
|
||||||
}
|
}
|
||||||
|
@ -860,7 +860,6 @@ class RecentsController(bundle: Bundle? = null) :
|
||||||
(activity as? MainActivity)?.showTabBar(true)
|
(activity as? MainActivity)?.showTabBar(true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type == ControllerChangeType.POP_EXIT) presenter.onDestroy()
|
|
||||||
val lastController = router.backstack.lastOrNull()?.controller
|
val lastController = router.backstack.lastOrNull()?.controller
|
||||||
if (lastController !is DialogController) {
|
if (lastController !is DialogController) {
|
||||||
(activity as? MainActivity)?.showTabBar(show = false, animate = lastController !is SmallToolbarInterface)
|
(activity as? MainActivity)?.showTabBar(show = false, animate = lastController !is SmallToolbarInterface)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue