diff --git a/app/src/main/java/dev/sasikanth/pinnit/mobius/CoroutineConnectable.kt b/app/src/main/java/dev/sasikanth/pinnit/mobius/CoroutineConnectable.kt deleted file mode 100644 index e3b7a64a..00000000 --- a/app/src/main/java/dev/sasikanth/pinnit/mobius/CoroutineConnectable.kt +++ /dev/null @@ -1,34 +0,0 @@ -package dev.sasikanth.pinnit.mobius - -import com.spotify.mobius.Connectable -import com.spotify.mobius.Connection -import com.spotify.mobius.functions.Consumer -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.launch -import kotlin.coroutines.CoroutineContext - -abstract class CoroutineConnectable( - private val dispatcher: CoroutineDispatcher -) : Connectable, CoroutineScope { - - private val supervisorJob = SupervisorJob() - override val coroutineContext: CoroutineContext - get() = supervisorJob + dispatcher - - abstract suspend fun handler(effect: I, dispatchEvent: (O) -> Unit) - - override fun connect(output: Consumer): Connection { - - return object : Connection { - override fun accept(input: I) { - launch { handler(input, output::accept) } - } - - override fun dispose() { - supervisorJob.cancel() - } - } - } -}