https://kotlinlang.org logo
Title
b

bartosz.malkowski

09/15/2021, 2:54 PM
Hello! I hope you can help me with understanding MVI architecture. I'm experimenting with MVIKotlin and I'm trying to create chat application. Lets assume that it will look like Slack client, then we all know what I'm talking about. My problem is what exactly "Component" is. Currently my app should have two screens: ConfigurationScreen and ConversationsScreen. ConversationsScreen contains list of channels on the left and messages history with input panel on the right. I assume that
ConfigurationScreen
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?
a

Arkadii Ivanov

09/15/2021, 3:36 PM
Hello! MVIKotlin library itself does not bring such as thing as "Component". You can check the Responsibility section of the Readme. So it is up to developers how to organise projects. However I would recommend to split the
ConversationsScreen
screen by multiple sub-components. E.g.
ConversationList
and
Conversation
components, and encapsulate them in a parent component
Messenger
. The
Conversation
component can be also split by
ConversationMessages
and
ConversationInput
sub-components. Everything of-course depends on complexity of each component.
🙂 1
b

bartosz.malkowski

09/15/2021, 5:41 PM
Thanks. I will read more about it