Nikola Milovic
12/30/2021, 12:57 PMdeps.versions.toml
it doesn't seem to be reflected anywhere
2. How can I run specific projects eg, ./gradlew :sample:master-detail:browserRun
task doesn't exist.
3. Have you had the chance to think about the Browser Routing issue? Any pointers on how to recreate configuration? As the part of getting the data and manipulating the URL is simple enoughNacho Ruiz Martin
12/31/2021, 7:12 PMArkadii Ivanov
01/01/2022, 12:40 AMLaurence Muller
01/05/2022, 2:44 AMLaurence Muller
01/07/2022, 5:26 PMstore
is triggering an alert (once) that the UI is suppose to react up on. Similar to maybe a classic android toast/snackbar message or maybe a 'no internet' message that shows up for a few seconds before fading away.
Currently I have something that looks like:
Shared module
// Store Interface
internal interface ScreenAStore : Store<Intent, State, Label> {
sealed class Intent {
data class xxx(val xxx: String) : Intent()
}
data class State(
val xxx: String = ""
)
sealed class Label {
object ShowAlert : Label()
}
}
// Store Factory
internal class ScreenAStoreFactory(
private val storeFactory: StoreFactory,
private val appRepository: AppRepository
) {
fun provide(): ScreenAStore =
object : ScreenAStore, Store<Intent, State, Label> by storeFactory.create(
name = "ScreenAStore",
initialState = State(),
bootstrapper = SimpleBootstrapper(Unit),
executorFactory = ::ExecutorImpl,
reducer = ReducerImpl
) {}
private inner class ExecutorImpl : CoroutineExecutor<Intent, Unit, State, Msg, Label>() {
...
// In the executor
private fun setAlert() {
publish(Label.ShowAlert)
}
...
}
// Component
class ScreenAComponent(
...
) : ScreenA, ComponentContext by componentContext {
private val scope: CoroutineScope = CoroutineScope(Dispatchers.Main)
override fun onBackPressed(): Boolean {
scope.cancel()
return true
}
private val store =
instanceKeeper.getStore {
ScreenAStoreFactory(
storeFactory = storeFactory,
appRepository = appRepository
).provide()
}
init {
backPressedHandler.register(::onBackPressed)
scope.launch {
store.labels.collect { label ->
when (label) {
is Label.ShowAlert -> {
Napier.d("Show message similar to a Toast in Compose UI")
}
}
}
}
}
override val model: Value<Model> = store.asValue().map(stateToModel)
}
Android app
@Composable
fun ScreenAUi(component: ScreenAComponent) {
Scaffold(
modifier = Modifier
.fillMaxSize(),
topBar = {
ScreenAHeader(component)
}
) {
ScreenABody(component, it)
}
}
@Composable
private fun ScreenABody(component: ScreenAComponent, innerPadding: PaddingValues) {
val model by component.model.subscribeAsState()
Box(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding)
) {
// Display some stuff
}
}
What's the recommended way to consume this one time label
event?Nikola Milovic
01/08/2022, 10:16 AMcounter0
forever
I'll continue tinkering with it but might as well ask you if you notice anything out of the ordinary.rsktash
01/20/2022, 11:36 AMiamsteveholmes
01/25/2022, 5:54 PMrsktash
01/27/2022, 9:29 PMunregister
is not being called when navigated back from inner router
The error occurs when
1. I navigate to inner router component A.
2. Navigate back
3. and again navigate to router component A
Root Router -> Inner Router -> Child -> NavBack -> Navigate forwardynsok
01/28/2022, 12:30 PMrsktash
02/09/2022, 2:09 AMvngantk
03/04/2022, 12:40 AMArtyom Bambalov
03/16/2022, 11:00 AMAkram Bensalem
03/31/2022, 10:19 AMThe following build commands failed: PhaseScriptExecution [CP-User]\ Build\ shared /Users/akrambensalem/AndroidStudioProjects/EzLive/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-4552119A071AC6BAB7327E6434237EC3.sh (in target 'shared' from project 'Pods')
(1 failure)
iamsteveholmes
03/31/2022, 4:36 PMAkram Bensalem
03/31/2022, 9:20 PMAkram Bensalem
04/03/2022, 4:40 PMArkadii Ivanov
04/06/2022, 5:40 PMynsok
04/12/2022, 1:00 PMclass MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
val store = Store(stateKeeper())
Text(text = store.state.number.toString())
}
}
}
@Parcelize
data class State(val number: Int) : Parcelable
class Store(stateKeeper: StateKeeper) {
val state: State = stateKeeper.consume("Register") ?: State(Random.nextInt())
init {
stateKeeper.register("Register") { state }
}
}
Travis Reitter
04/19/2022, 4:22 PMtodoapp
example as a model for rebasing my app on MVIKotlin. I'd like to make my migration a little more gradual and just rewrite the root view at first (which is already a list view in my app) and have item taps launch the existing detail view `Activity`s directly like it currently does. In the todoapp
, tapping on an item ends up in TodoRootUi
with TodoRootContent()
returning the Edit composable and this is all within the compose-ui
module instead of the Android module. What's the best way to instead launch an Activity
on Android and display a specific ViewController
on iOS? I definitely want to migrate the rest of the UI to match the todoapp
model but want to avoid rewriting all of the UI in one step 🙂Arkadii Ivanov
04/30/2022, 10:28 PMdoubov
05/05/2022, 6:57 PMintents
were a Flow<Intent>:
intents.filterIsInstance<Intent.A>.flatMapLatest { intent -> repo.fetchModels(intent.input).map { data -> Msg.SetData(data) } }
Upon receiving Intent.A
we cancel the previously setup repo.fetchModels(...)
stream and restart it with the new input.
As far as I can see, this isn't really doable with the current implementation, unless I've missed something. Thanks in advance! 🙏doubov
05/09/2022, 4:22 PMLawrence
05/14/2022, 2:24 AMValue<State>
? https://github.com/JetBrains/compose-jb/blob/master/examples/todoapp/common/main/s[…]mmonMain/kotlin/example/todo/common/main/integration/Mappers.ktLawrence
05/26/2022, 4:37 PMAndrew Steinmetz
06/04/2022, 2:32 AMTravis Reitter
06/12/2022, 3:07 PMUIView
-based `ViewController`s? I'd like to migrate to MVIKotlin before migrating to SwiftUIZsolt.bertalan
07/13/2022, 4:36 PMoverride fun stop() {
GlobalScope.launch(mainContext) {
delay(DELAY_STOP)
job?.cancel()
job = null
}
}
First of all, is this correct? Is this the best I can do? Maybe, does it make sense to add this to the library?Arkadii Ivanov
07/13/2022, 10:07 PMFrancis Mariano
07/22/2022, 11:05 AMFrancis Mariano
07/22/2022, 11:05 AMArkadii Ivanov
07/22/2022, 11:11 AMFrancis Mariano
07/22/2022, 11:23 AMArkadii Ivanov
07/22/2022, 11:35 AMFrancis Mariano
07/22/2022, 11:38 AMArkadii Ivanov
07/22/2022, 11:43 AMFrancis Mariano
07/22/2022, 11:44 AMArkadii Ivanov
07/22/2022, 11:45 AMFrancis Mariano
07/22/2022, 11:52 AMArkadii Ivanov
07/22/2022, 11:58 AM