benkuly
08/09/2021, 1:15 PMLaurence Muller
08/11/2021, 1:24 PMLaurence Muller
08/11/2021, 1:25 PMFrancis Mariano
08/11/2021, 6:31 PMNikola Milovic
08/13/2021, 10:21 AMsubscribeScoped
works (I am used to the Singles having onError/Success) and how to handle errors in my usecase? I am currently making a request to the backend and it returns the status and data, ktor suspend request so I wrap it in singleFromCoroutine
. Am I supposed to wrap the call in try catch? Eg
return singleFromCoroutine {
try {
val response: HttpResponse =
<http://client.post|client.post>("${serverUrl}${apiEndpoint}/account")
return@singleFromCoroutine CreateAccountResponse(response.status.value)
} catch (e: Exception) {
return@singleFromCoroutine CreateAccountResponse(500, e.message ?: "")
}
I feel like I am seriously missing something here, I can't properly handle errors as I have to have a half-assed response network model that has to hold both the data and the potential error. Or is this the way to go?Nikola Milovic
08/13/2021, 12:12 PMprivate inner class ExecutorImpl : ReaktiveExecutor<Intent, Unit, State, Result, Label>() {
override fun executeAction(action: Unit, getState: () -> State) {
dispatch(Result.Loading())
val user = firebaseAuth.currentUser
if (user != null) {
publish(Label.LoggedIn)
}
}
I am binding to the store.label output in the init block of the componentYevhenii Datsenko
08/20/2021, 10:30 AMLaurence Muller
08/24/2021, 12:42 PMFrancis Mariano
09/03/2021, 11:39 AMWhen writing common code targetting Android, it might be required to preserve some data over Android configuration changes or process death.what kind of process death that we must preserve some data??
Nikola Milovic
09/12/2021, 6:58 AMexternal interface RootProps : PropsWithChildren {
var component: Root
}
val RootC = fc<RootProps> { props ->
val (routerState, _) = useState(props.component.routerState.value)
val child: Root.Child = routerState.activeChild.instance
And I'd call this way in my toplevel app component
override fun RBuilder.render() {
RootC {
attrs {
this.component = root
}
}
}
But this doesn't seem to pickup on the state val (routerState, _) = useState(props.component.routerState.value)
and doesn't update the component. No composables, so cannot use the ValueExt from the samplesbartosz.malkowski
09/15/2021, 2:54 PMConfigurationScreen
and ConversationsScreen
should be Component with their own stores, intents and results. For example ConversationsScreen
state will have state containing selectedChannel
.
The question is: does MessageHistoryWithInput
should be Component with their own store (containing: loaded message list), own intents (SendMessage
, LoadedMessageList
) etc?
How to embed this component inside ConversationsScreen
component?
Does anyone has any example?benkuly
09/15/2021, 4:57 PMcomponentContext
? Should it contain a new CoroutineScope or should it expose suspending functions and the component should handle it (e. g. with rememberCoroutineScope
)?trashcoder
09/19/2021, 11:30 AMScaffold
and navigate with the Drawer
(1 item for each screen in the drawer which will then change router state on click).
Since the Scaffold
has multiple parameters related to each screen (title, actions, content), i dont know if it should be part of the root content or part of each screen's content..?
Let's say, i would use it as root content. Is it ok to check routerState/children for each Scaffold
section and then call composable functions depending on the child for each section: Child1Title(), Child1Actions(), Child1Content()?
(Are there any examples for Drawer
navigation with Decompose?)Andrew Steinmetz
09/21/2021, 9:21 PMSuspendExecutor
and was wondering if anybody had a sample project where they could get a runBlockingTest
to work? After some research it seems like the runBlockingTest
in the coroutines test library is just supported on the JVM, but there is a workaround to get it to work per this comment. After adding that to my project, I still seem to run into a few issues when trying to run the test.
import com.arkivanov.mvikotlin.core.store.StoreFactory
import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
import com.plusmobileapps.shared.db.Activity
import com.plusmobileapps.wolfpack.activity.list.ActivityListStoreProvider
import com.plusmobileapps.wolfpack.di.DEFAULT_DISPATCHER_TAG
import com.plusmobileapps.wolfpack.di.MAIN_DISPATCHER_TAG
import com.plusmobileapps.wolfpack.mocks.ActivityRepositoryMock
import com.plusmobileapps.wolfpack.runBlockingTest
import kotlinx.coroutines.Dispatchers
import org.kodein.di.DI
import org.kodein.di.bind
import org.kodein.di.singleton
import kotlin.coroutines.CoroutineContext
import kotlin.test.Test
import kotlin.test.assertEquals
class ActivityListStoreTest {
private val storeFactory = DefaultStoreFactory
private val repository = ActivityRepositoryMock()
private val di = DI {
bind<CoroutineContext>(MAIN_DISPATCHER_TAG) { singleton { testCoroutineContext } }
bind<CoroutineContext>(DEFAULT_DISPATCHER_TAG) { singleton { testCoroutineContext } }
bind<ActivityRepository> { singleton { repository } }
bind<StoreFactory> { singleton { storeFactory } }
}
@Test
fun foo() = runBlockingTest {
val activity = Activity(1L, "", true)
repository.addActivity(activity)
val store = ActivityListStoreProvider(di).provide()
assertEquals(listOf(activity), store.state.activities)
}
}
• For ios, keep getting an InvalidMutabilityException
which I think is because the DI gets frozen inside the test because once something is retrieved from DI it throws the exception?
• Then for android, keep getting java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked.
which am I supposed to import the coroutine test library on jvm tests to get them to work?
I'm a little lost in the weeds trying to figure this out and might even consider switching to Reaktive as it seems to have a pretty good testing support from looking at the todo sample tests. Any help is greatly appreciated!Nikola Milovic
09/28/2021, 12:10 PMArkadii Ivanov
09/30/2021, 11:33 AMmap = map + (key to value)
bartosz.malkowski
09/30/2021, 4:31 PMSetPassword
SetUsername
SetDomain
etc.
Should I for each Intent create corresponding Result (SetPassword
- PasswordChanged
, SetUsername
- UsernameChanged
), or there is simplest solution (but compliant with the best practices)?kenkyee
10/15/2021, 3:09 PMkenkyee
10/15/2021, 3:11 PMArkadii Ivanov
10/15/2021, 4:19 PMscope
properly available which you can use to launch coroutines when needed. You can check samples: https://github.com/arkivanov/MVIKotlin/blob/master/sample/todo-coroutines/src/commonMain/kotlin/com/arkivanov/mvikotlin/sample/todo/coroutines/store/TodoListStoreFactory.kt
The reason for this change is because now you are able to process intents and actions synchronously in the same call stack as they were dispatched.kenkyee
10/15/2021, 7:29 PMbartosz.malkowski
10/18/2021, 11:47 AMwhen (menuItem) {
is SideMenu.MenuItem.DirectChatMenuItem -> router.replaceCurrent(Configuration.Conversation(menuItem.chat.openChatId))
else -> router.replaceCurrent(Configuration.Nothing)
}
Here is child factory:
private fun createChild(
configuration: Configuration, componentContext: ComponentContext,
): Child = when (configuration) {
is Configuration.Conversation -> Child.Chat(
ConversationMainComponent(componentContext, configuration.chatId, storeFactory)
)
is Configuration.Nothing -> Child.WelcomeScreen
}
ConversationMainComponent
contains TextField
.
When I show ConversationMainComponent
first time and I make text field focused, then everything works fine. When I switch to different DirectChatMenuItem
what creates different ConversationMainComponent
and then I try to focus text field, I see exception:
Exception in thread "AWT-EventQueue-0" kotlin.UninitializedPropertyAccessException: lateinit property relocationRequesterNode has not been initialized
at androidx.compose.ui.layout.RelocationRequesterModifier.getRelocationRequesterNode(RelocationRequesterModifier.kt:32)
at androidx.compose.ui.layout.RelocationRequester.bringIntoView(RelocationRequester.kt:61)
at androidx.compose.ui.layout.RelocationRequester.bringIntoView$default(RelocationRequester.kt:59)
at androidx.compose.foundation.FocusableKt$focusable$2$4$1.invokeSuspend(Focusable.kt:108)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2.invokeSuspend(CoroutineDispatchers.desktop.kt:55)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Funny is, that when I select one direct chat, make field focused, then I select something else (Child.WelcomeScreen
) and I select direct chat again, then everything works fine.
Any advice? :-)Mike
10/27/2021, 3:16 AM[MVIKotlin]: ListStore (STATE, State):
Michael Thiele
10/27/2021, 6:37 AMComponentContext
now only exposes a BackPressedHandler
which can be used to register handlers for the back-button. I have several unit tests that verify the correct behaviour of the back button action which I have initiated with onBackPressed()
which is now missing. How can I simulate a back-button pressed in a unit test? Thanks.Arkadii Ivanov
10/29/2021, 8:33 PMrsktash
10/31/2021, 9:06 AMBenoye
11/15/2021, 1:25 PMValue
class in ObservableValue
that is not found by XCode (I cloned the sample and I am not able to find with the sample either)
Would you guys be able to tell me what I am missing here ? Thanks !Nikola Milovic
11/30/2021, 10:03 AMurl/user/
and url/user/profile/
I am having issues with going back and navigating to screen A again. If I am on screen B, I cannot press back on my mouse and the browser doesn't give me the back option.
Also when navigating from some other screen back to screen A, it still contains Configuration B, because I cannot push a new configuration (getting the unique Config error), so I am using the pushToFront
.
What would be the approach, besides adding a back button on desktop to go about this? (I think that mobile handles the back button normally, would have to test it).
Also, I am not really proficient in web dev, would it be possible to have URLs and have them go back option with Decompose and Web?Nikola Milovic
12/07/2021, 3:43 PMArtyom Bambalov
12/29/2021, 2:51 PMArtyom Bambalov
12/29/2021, 2:51 PMArkadii Ivanov
12/29/2021, 2:52 PMArtyom Bambalov
12/29/2021, 2:54 PMArkadii Ivanov
12/29/2021, 2:57 PMArtyom Bambalov
12/29/2021, 2:57 PMArkadii Ivanov
12/29/2021, 3:02 PMArtyom Bambalov
12/29/2021, 3:10 PMArkadii Ivanov
12/29/2021, 3:12 PMArtyom Bambalov
12/29/2021, 3:13 PMArkadii Ivanov
12/29/2021, 3:14 PMArtyom Bambalov
12/29/2021, 3:17 PMArkadii Ivanov
12/29/2021, 3:17 PMArtyom Bambalov
12/29/2021, 3:18 PM