feat: Start/Open one to one conversation with apps (WPB-25307)#4838
feat: Start/Open one to one conversation with apps (WPB-25307)#4838alexandreferris wants to merge 4 commits into
Conversation
- Route Apps and old Bots from conversation messages and one2one conversations to ServiceDetailsScreen - Carry typed sender identity through message mapping and markdown mentions to distinguish users, new Apps and old bots - Open service details from new-conversation search results, switching between app and bot IDs based on apps availability - Show Start/Open Conversation actions for app service details when apps are enabled and no group context is present - Add service-details logic to detect existing one-to-one app conversations and reuse or create them on demand Signed-off-by: alexandreferris <ferris.alexandre@gmail.com>
- Add tests for ServiceDetailsViewModel - Adjust existing tests to add senderId(MessageSenderId) Signed-off-by: alexandreferris <ferris.alexandre@gmail.com>
- Adjust base mocks for OneToOneConversations in withMockConversationDetailsOneOnOne Signed-off-by: alexandreferris <ferris.alexandre@gmail.com>
- Remove TODO and update `BackStackMode` to `.UPDATE_EXISTED` Signed-off-by: alexandreferris <ferris.alexandre@gmail.com>
|
| val infoMessage = _infoMessage.asSharedFlow() | ||
|
|
||
| private val _openConversationEvent = MutableSharedFlow<ConversationId?>() |
There was a problem hiding this comment.
You can make use of ActionsViewModel here, we usually refactor ViewModels into this approach when there's opportunity, so that we could have both of these events grouped (_openConversationEvent and _infoMessage) - take a look for instance at ConversationOptionsMenuViewModel.
- extend
ActionsViewModel() - create actions sealed class, like so:
sealed interface ServiceDetailsViewActions {
data class Message(val message: SnackBarMessage) : ServiceDetailsViewActions
data class OpenConversation(val conversationId: ConversationId) : ServiceDetailsViewActions
}
- use it in ViewModel by simply
sendAction(ServiceDetailsViewActions.OpenConversation(id)) - handle it in composable by using our
HandleActionscomposable:
HandleActions(viewModel.actions) { action ->
when (action) {
ServiceDetailsViewActions.Message -> snackbarHostState.showSnackbar(action.message.uiText.asString(context.resources))
ServiceDetailsViewActions.OpenConversation -> navigator.navigate(NavigationCommand(ConversationScreenDestination(navArgs = ConversationNavArgs(conversationId = conversationId)),BackStackMode.UPDATE_EXISTED ))
}
}
| val isProfileRedirectEnabled = | ||
| header.userId != null && !(header.isSenderDeleted || header.isSenderUnavailable) |
There was a problem hiding this comment.
We probably should not check if header.userId != null because it will disable opening profile for old bots, right? Maybe use header.senderId instead.
You could make header.senderId nullable so that it could be easier here (if not null then enabled) and it would make MessageSenderId.User to have non-nullable field which is also better in my opinion, as we won't default to User(null) when some data is missing.


https://wearezeta.atlassian.net/browse/WPB-25307
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764The PR Description
What's new in this PR?
Issues
Causes (Optional)
Not implemented and left over from previous implementations (left out due to v4.25 release focus)
Solutions
Now everywhere an App (or old bot) is visible to be clicked, it will open Service Details screen (and decide if shows the open/start 1:1 conversation buttons)
Previous existing flows to open Service Details screen remains the same and shows the Add/Remove from group conversation buttons.
For the new flows (as it doesn't have a specific group conversation), it will decide to show or not the open/create 1:1 conversation based on:
Testing
Test Coverage (Optional)
How to Test
Proteus Team + old bots
MLS Team + Apps feature flag enabled
For when Apps feature flag is DISABLED, buttons will be hidden but details of the App will still be visible
Attachments (Optional)
Old bot from Group conversation
Old bot from new conversation flow / message in group
App from group conversation
App with feature flag enabled
App with feature flag disabled