mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fix crash in base presenter
This commit is contained in:
parent
ebe8edb110
commit
35dd94c179
2 changed files with 2 additions and 6 deletions
|
@ -7,8 +7,7 @@ import kotlinx.coroutines.cancel
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
open class BaseCoroutinePresenter<T> {
|
open class BaseCoroutinePresenter<T> {
|
||||||
lateinit var presenterScope: CoroutineScope
|
var presenterScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||||
val isScopeInitialized get() = this::presenterScope.isInitialized
|
|
||||||
private var weakView: WeakReference<T>? = null
|
private var weakView: WeakReference<T>? = null
|
||||||
protected val view: T?
|
protected val view: T?
|
||||||
get() = weakView?.get()
|
get() = weakView?.get()
|
||||||
|
@ -23,9 +22,6 @@ open class BaseCoroutinePresenter<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onCreate() {
|
open fun onCreate() {
|
||||||
if (!isScopeInitialized) {
|
|
||||||
presenterScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onDestroy() {
|
open fun onDestroy() {
|
||||||
|
|
|
@ -615,7 +615,7 @@ class MangaDetailsController :
|
||||||
//region Lifecycle methods
|
//region Lifecycle methods
|
||||||
override fun onActivityResumed(activity: Activity) {
|
override fun onActivityResumed(activity: Activity) {
|
||||||
super.onActivityResumed(activity)
|
super.onActivityResumed(activity)
|
||||||
if (presenter.isScopeInitialized) {
|
if (adapter != null) {
|
||||||
presenter.isLockedFromSearch =
|
presenter.isLockedFromSearch =
|
||||||
shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
||||||
presenter.headerItem.isLocked = presenter.isLockedFromSearch
|
presenter.headerItem.isLocked = presenter.isLockedFromSearch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue