ursus
05/18/2021, 10:04 PMclass SomeSyncer {
private val scope = CoroutineScope ..
private val _state = MutableFlow...
val state: Flow<State> get() = _state
fun sync() {
scope.launch {
_state.value = RUNNING
doSync()
_state.value = IDLE
}
}
}
class FcmService : FirebaseMessageingService {
override onMessageReceived() {
someSyncer.sync() ?
or
runBlocking {
someSyncer.sync() ..somehow make it wait? maybe the lowercase coroutineScope?
}
}
}
I could also expose the suspend doSync
as some public api, but I'm gonna lose the state tracking, and also, it's never necessary within the app normally, just this "edge" framework case