Adrian Witaszak
07/25/2023, 10:06 AMCasey Brooks
08/17/2023, 9:26 PMRobert Jaros
08/23/2023, 1:48 PMJsConsoleLogger
I see Interceptor attached: [object Object]
in the browser console. This is the only "ugly" log message in my logs since I'm using data objects for my Input and Events. Perhaps there is a toString()
missing?Casey Brooks
09/05/2023, 11:18 PMCasey Brooks
09/06/2023, 3:12 PMCasey Brooks
09/07/2023, 6:15 PMAdrian
09/08/2023, 4:36 AMclass SomeFeatureInputHandler() : InputHandler<SomeFeatureContract.Inputs, SomeFeatureContract.Events, SomeFeatureContract.State> {
override suspend fun InputHandlerScope<SomeFeatureContract.Inputs, SomeFeatureContract.Events, SomeFeatureContract.State>.handleInput(
input: SomeFeatureContract.Inputs
) = when (input) {
....
SomeFeatureContract.Inputs.saveButtonClicked -> {
...
postEvent(SomeFeatureContract.Events.ShowError("Error during Save"))
}
}
Here's the UI code that tries to handle the Event and launch a Toast:
@Composable
fun ButtonsScreen(
navController: NavController,
viewModel: SomeFeatureViewModel = getViewModel(),
onClick: () -> Unit
) {
val eventHandler = SomeFeatureEventHandler(LocalContext.current)
....
LaunchedEffect(viewModel, eventHandler) {
viewModel.attachEventHandler(this, eventHandler)
}
.....
}
=========================================================
class SomeFeatureEventHandler(private val context: Context) :
EventHandler<SomeFeature.Inputs, SomeFeatureContract.Events, SomeFeaturesContract.State> {
override suspend fun EventHandlerScope<SomeFeatureContract.Inputs, SomeFeatureContract.Events, SomeFeatureContract.State>.handleEvent(
event: SomeFeatureContract.Events
) {
when (event) {
is SomeFeatureContract.Events.ShowError -> {
Toast.makeText(context, event.errorMessage, Toast.LENGTH_LONG).show()
}
}
}
}
When I run the above, the SomeFeatureEventHandler
handles the Event but when it tries to launch the Toast I get the following error:
java.lang.NullPointerException: Can't toast on a thread that has not called Looper.prepare()
Error above probably indicates that we are trying to initiate a Toast on an non-UI thread. So what's the proper way in Ballast to handle this?Cherrio LLC
09/16/2023, 1:59 PMCherrio LLC
09/25/2023, 2:29 PMCherrio LLC
10/01/2023, 9:31 AMCasey Brooks
10/05/2023, 10:25 PMCasey Brooks
10/05/2023, 10:33 PMCasey Brooks
10/18/2023, 5:03 PMubuntudroid
10/25/2023, 10:38 AMubuntudroid
11/01/2023, 3:08 PMnetwork_security_config.xml
in the samples. Would be great if that was mentioned in the debugger plugin docs as well. 🙂ubuntudroid
11/01/2023, 3:14 PMubuntudroid
11/01/2023, 3:16 PMubuntudroid
11/01/2023, 8:57 PMRouterContract.Inputs.PopUntilAnnotation(inclusive = true, annotation = Tag(""))
Maybe this could be provided as a predefined Input? E.g. ClearBackstack
or something similar.ubuntudroid
11/02/2023, 12:33 PMRouterContract.Events.BackstackChanged
would also pass the old backstack or inform about what exactly has changed. This would enable us to do things like
saveableStateHolder.removeState(it.originalDestinationUrl)
Because right now it doesn’t look like the router manages saveable state for us, right?
So I did something like this:
routerState.renderCurrentDestination(
route = { screen ->
val saveableStateProviderKey = remember(key1 = screen) {
routerState.currentDestinationOrNotFound!!.originalDestinationUrl // seems to be the only way to get hold of the original destination URL
}
saveableStateHolder.SaveableStateProvider(key = saveableStateProviderKey) {
when(screen) {
Screen.Pastes -> {
...
}
Screen.Login -> {
...
}
}
}
},
notFound = {
...
}
)
ubuntudroid
11/03/2023, 10:01 AMAndroidViewModel
? I’m trying attachEventHandler()
, but still only the previous handler is called.
Background: I’m building with Compose and keep the ViewModel around longer than the screen, and I pass a SnackbarHostState
to the EventHandler to display snackbars. That also means that I need to regularly update the SnackbarHostState to match the currently used one and thus also the EventHandler.rocketraman
11/08/2023, 10:16 PMBallastNotification.ViewModelStarted
to send an initial input to the view model queue. What would the replacement be now that there is no ViewModelStarted
option. I see ViewModelStatusChanged
, and I can do if (it.status == Status.Running)
but I see that Status.Running
is in an internal package. Is there a better approach now?rocketraman
11/10/2023, 1:45 PMClosedSendChannelException
in the browser, after which my VMs stop working. Its not clear from the console log where the exception is coming from. Is it perhaps an incompatibility with Kotlin 1.9.20 -- 4.0.0 appears to be compiled against 1.9.10?Robert Jaros
11/10/2023, 2:14 PMrocketraman
11/10/2023, 4:45 PM/null
if going back past the top of the back stackS.
11/27/2023, 7:42 PMRobert Jaros
02/10/2024, 3:22 PMCasey Brooks
02/15/2024, 8:14 PMsigmadelta
02/18/2024, 8:31 PMbuild.gradle.kt
file are a bit different as opposed to prior KMM projects. And now when I try to add the ballast dependencies to my commonMain.dependencies
definition, the retrieval for the iOS targets fails (in the past, defining an ios()
was enough, now you need to be more specific e.g. iosArm64
, iosX64
, ...). When I move the dependencies to the androidMain
section however, the retrieval succeeds.
Is there something I'm missing in my gradle setup, or does the library need to define new target definitions to support these iOS sub-targets?Cherrio LLC
03/12/2024, 4:39 PMInputs.GoBack()
, data in the previous screen is lost.
Like if we had a query parameter in there before and we navigate back to the screen, there’s a null pointer exception that the parameter doesn’t exist
Is that intended??Cherrio LLC
03/20/2024, 4:00 PM