Cleanup
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package exh.ui.base
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -20,9 +19,7 @@ import kotlin.coroutines.EmptyCoroutineContext
|
||||
@Suppress("DEPRECATION", "unused")
|
||||
open class CoroutinePresenter<V>(
|
||||
scope: CoroutineScope = CoroutineScope(Job() + Dispatchers.Main)
|
||||
) : Presenter<V>(),
|
||||
CoroutineScope by scope
|
||||
{
|
||||
) : Presenter<V>(), CoroutineScope by scope {
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated("Use launchInView, Flow.inView, Flow.mapView")
|
||||
override fun getView(): V? {
|
||||
@@ -47,10 +44,10 @@ open class CoroutinePresenter<V>(
|
||||
}
|
||||
}
|
||||
|
||||
fun Flow<*>.launchUnderContext(context: CoroutineContext = EmptyCoroutineContext) =
|
||||
launch(this + context) { this@launchInHere.collect() }
|
||||
fun Flow<*>.launchUnderContext(context: CoroutineContext = EmptyCoroutineContext) =
|
||||
launch(context) { this@launchUnderContext.collect() }
|
||||
|
||||
fun Flow<*>.launch() = launchIn(this)
|
||||
fun Flow<*>.launch() = launchIn(this@CoroutinePresenter)
|
||||
|
||||
@CallSuper
|
||||
override fun destroy() {
|
||||
|
||||
@@ -15,7 +15,6 @@ import exh.ui.base.CoroutinePresenter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.plus
|
||||
import uy.kohesive.injekt.Injekt
|
||||
|
||||
Reference in New Issue
Block a user