|
|
|
|
|
by cel1ne
3659 days ago
|
|
Maybe I'll write something longer about it, but i haven't figured everything out myself yet. I have a Controller that takes UIEvents and NetworkEvents from a BlockingQueue (CSP). The state reduces everything. Kotlin's "when" constructs are extremely convenient here, but want to make sure I'm not going to far into the functional direction, if you get what I mean. The state is completely serialisable (in fact gets serialised to and from JSON in onPause/onResume). I'm doing networking declaratively as well, a serialisable request-description is put into the state and it's the "NetworkManager"'s job to figure out which requests to start or stop. Kotlin's delegated property are also awesome, because I can mix and match functions and variables. /* show loading animation */
override val isLoading by stateFn {
it.runningRequests.any { it is LoginReq }
}
|
|