Kotlin-Rust Architecture #4
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Most of the information here can be found on the App architecture guide.
We should probably aim for Unidirectional Data Flow:
To achieve this, we'll need to figure out how to create some sort
Observable
which can be "resolved" from the Rust side, so that it integrates nicely with Compose and Kotlin.The
Observable
acts sort-of like aPromise
orFuture
which is eventually resolved, but it's important to use concepts compatible with Compose.More precisely, this likely discards other ideas such as "async JNI calls", because they break the UDF model.
In the Get data from the internet course, it works through the following
ViewModel
:In essence, there's a
mutableStateOf
(the "observable") which is updated after asuspend fun
(getPhotos
) returns. We don't have this luxury with JNI.But it may mean Kotlin should be the one responsible for "resolving" the observable.
produceState
: convert non-Compose state into Compose state may be what we need to create these "observables".Thinking in Compose is mental model, and warns about some dangerous side-effects [such as]:
ViewModel
The environment itself is also rather harsh. As described in Guide to app architecture: