This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* An http client to use until ktor works with multithreaded coroutines. | |
* This goes in a common module that ios and android clients depend on. | |
* We just return a string as shared components can use kotlinx serialization | |
* thereafter to handle response parsing. | |
*/ | |
interface IPlainClient { | |
fun get( | |
baseUrl: String, | |
path: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class BaseViewModel<T : Any, R : Any>( | |
initialState: T | |
) : CoroutineScope { | |
private val job = Job() | |
override val coroutineContext: CoroutineContext = Dispatchers.Main + job | |
protected val _state = ConflatedBroadcastChannel<T>(initialState) | |
val state = _state.asFlow() | |
val cState = state.wrap() |
OlderNewer