From 190c0e912b1e10c3c3b32380eba794482a285fd2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:20:53 +0200 Subject: [PATCH 1/9] chore(deps): bump gradle/wrapper-validation-action from 1.0.6 to 1.1.0 (#2001) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codestyle.yml | 2 +- .github/workflows/gradle-run-ui-tests.yml | 2 +- .github/workflows/gradle-run-unit-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 4e6dc986087..62dfff08d3e 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -21,7 +21,7 @@ jobs: distribution: 'temurin' cache: gradle - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b + uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 - name: Run Detekt run: | ./gradlew detektAll diff --git a/.github/workflows/gradle-run-ui-tests.yml b/.github/workflows/gradle-run-ui-tests.yml index d0e30568021..e1565f5cf48 100644 --- a/.github/workflows/gradle-run-ui-tests.yml +++ b/.github/workflows/gradle-run-ui-tests.yml @@ -32,7 +32,7 @@ jobs: cache: gradle - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b + uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 - name: Gradle cache uses: gradle/gradle-build-action@v2 diff --git a/.github/workflows/gradle-run-unit-tests.yml b/.github/workflows/gradle-run-unit-tests.yml index c036056aa34..780d53a7c9d 100644 --- a/.github/workflows/gradle-run-unit-tests.yml +++ b/.github/workflows/gradle-run-unit-tests.yml @@ -32,7 +32,7 @@ jobs: cache: gradle - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b + uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 - name: Gradle cache uses: gradle/gradle-build-action@v2 From bb8015db132e5af53e30f75c7bf5d4743d567393 Mon Sep 17 00:00:00 2001 From: Mohamad Jaara Date: Tue, 25 Jul 2023 10:21:09 +0200 Subject: [PATCH 2/9] feat: composable scoped view model and handle Message button sheet menu --- .../CompositeMessagesViewModel.kt | 28 +++++++----- .../home/conversations/ConversationScreen.kt | 16 +------ .../ui/home/conversations/MessageItem.kt | 10 ----- .../edit/EditMessageMenuItems.kt | 27 ++++++----- .../edit/TextMessageMenuItems.kt | 9 ++-- .../home/conversations/model/MessageTypes.kt | 28 ++++++------ .../model/MessageTypesPreview.kt | 45 +++++++------------ .../ui/home/conversations/model/UIMessage.kt | 10 ++++- .../kotlin/com/wire/android/util/Copyable.kt | 25 +++++++++++ 9 files changed, 102 insertions(+), 96 deletions(-) create mode 100644 app/src/main/kotlin/com/wire/android/util/Copyable.kt diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt index 66d25b8b82f..1f690c681cb 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt @@ -18,13 +18,15 @@ package com.wire.android.ui.home.conversations import androidx.annotation.VisibleForTesting -import androidx.compose.runtime.mutableStateMapOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue import androidx.lifecycle.SavedStateHandle +import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.wire.android.navigation.EXTRA_CONVERSATION_ID -import com.wire.android.navigation.SavedStateViewModel +import com.wire.android.navigation.EXTRA_MESSAGE_ID import com.wire.kalium.logic.data.id.MessageButtonId -import com.wire.kalium.logic.data.id.MessageId import com.wire.kalium.logic.data.id.QualifiedID import com.wire.kalium.logic.data.id.QualifiedIdMapper import com.wire.kalium.logic.feature.message.composite.SendButtonActionMessageUseCase @@ -33,28 +35,34 @@ import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel -class CompositeMessagesViewModel @Inject constructor( +class CompositeMessageViewModel @Inject constructor( private val sendButtonActionMessageUseCase: SendButtonActionMessageUseCase, qualifiedIdMapper: QualifiedIdMapper, savedStateHandle: SavedStateHandle, -) : SavedStateViewModel(savedStateHandle) { +) : ViewModel() { val conversationId: QualifiedID = qualifiedIdMapper.fromStringToQualifiedID( savedStateHandle.get(EXTRA_CONVERSATION_ID)!! ) - var pendingButtons = mutableStateMapOf() + private val messageId: String = savedStateHandle.get(EXTRA_MESSAGE_ID)!! + + var pendingButtons: MessageButtonId? by mutableStateOf(null) @VisibleForTesting set - fun onButtonClicked(messageId: String, buttonId: String) { - if (pendingButtons.containsKey(messageId)) return + fun onButtonClicked(buttonId: String) { + if (pendingButtons != null) return - pendingButtons[messageId] = buttonId + pendingButtons = buttonId viewModelScope.launch { sendButtonActionMessageUseCase(conversationId, messageId, buttonId) }.invokeOnCompletion { - pendingButtons.remove(messageId) + pendingButtons = null } } + + companion object { + const val ARGS_KEY = "CompositeMessageViewModelKey" + } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationScreen.kt index b7f7c3f6ea5..90b6874b0df 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationScreen.kt @@ -119,7 +119,6 @@ fun ConversationScreen( conversationCallViewModel: ConversationCallViewModel = hiltSavedStateViewModel(backNavArgs = backNavArgs), conversationMessagesViewModel: ConversationMessagesViewModel = hiltSavedStateViewModel(backNavArgs = backNavArgs), messageComposerViewModel: MessageComposerViewModel = hiltSavedStateViewModel(backNavArgs = backNavArgs), - compositeMessagesViewModel: CompositeMessagesViewModel = hiltSavedStateViewModel(backNavArgs = backNavArgs) ) { val coroutineScope = rememberCoroutineScope() val showDialog = remember { mutableStateOf(ConversationScreenDialogType.NONE) } @@ -220,7 +219,6 @@ fun ConversationScreen( onFailedMessageRetryClicked = messageComposerViewModel::retrySendingMessage, requestMentions = messageComposerViewModel::searchMembersToMention, onClearMentionSearchResult = messageComposerViewModel::clearMentionSearchResult, - compositeMessagesViewModel = compositeMessagesViewModel ) DeleteMessageDialog( state = messageComposerViewModel.deleteMessageDialogsState, @@ -307,7 +305,6 @@ private fun ConversationScreen( composerMessages: SharedFlow, conversationMessages: SharedFlow, conversationMessagesViewModel: ConversationMessagesViewModel, - compositeMessagesViewModel: CompositeMessagesViewModel, onSelfDeletingMessageRead: (UIMessage) -> Unit, onNewSelfDeletingMessagesStatus: (SelfDeletionTimer) -> Unit, tempWritableImageUri: Uri?, @@ -425,8 +422,6 @@ private fun ConversationScreen( tempWritableImageUri = tempWritableImageUri, tempWritableVideoUri = tempWritableVideoUri, snackBarHostState = conversationScreenState.snackBarHostState, - onMessageButtonClicked = compositeMessagesViewModel::onButtonClicked, - pendingButtonsMap = compositeMessagesViewModel.pendingButtons, ) } MenuModalSheetLayout( @@ -465,8 +460,6 @@ private fun ConversationScreenContent( onChangeSelfDeletionClicked: () -> Unit, onSearchMentionQueryChanged: (String) -> Unit, onClearMentionSearchResult: () -> Unit, - onMessageButtonClicked: (messageId: String, buttonId: String) -> Unit, - pendingButtonsMap: Map, tempWritableImageUri: Uri?, tempWritableVideoUri: Uri?, snackBarHostState: SnackbarHostState @@ -499,8 +492,6 @@ private fun ConversationScreenContent( conversationDetailsData = conversationDetailsData, onFailedMessageCancelClicked = onFailedMessageCancelClicked, onFailedMessageRetryClicked = onFailedMessageRetryClicked, - onMessageButtonClicked = onMessageButtonClicked, - pendingButtonsMap = pendingButtonsMap ) }, onChangeSelfDeletionClicked = onChangeSelfDeletionClicked, @@ -581,8 +572,6 @@ fun MessageList( conversationDetailsData: ConversationDetailsData, onFailedMessageRetryClicked: (String) -> Unit, onFailedMessageCancelClicked: (String) -> Unit, - onMessageButtonClicked: (messageId: String, buttonId: String) -> Unit, - pendingButtonsMap: Map ) { val mostRecentMessage = lazyPagingMessages.itemCount.takeIf { it > 0 }?.let { lazyPagingMessages[0] } @@ -639,8 +628,6 @@ fun MessageList( onSelfDeletingMessageRead = onSelfDeletingMessageRead, onFailedMessageCancelClicked = onFailedMessageCancelClicked, onFailedMessageRetryClicked = onFailedMessageRetryClicked, - onMessageButtonClicked = onMessageButtonClicked, - pendingButtonsMap = pendingButtonsMap ) } @@ -713,7 +700,6 @@ fun PreviewConversationScreen() { tempWritableVideoUri = null, onFailedMessageRetryClicked = {}, requestMentions = {}, - onClearMentionSearchResult = {}, - compositeMessagesViewModel = hiltViewModel() + onClearMentionSearchResult = {} ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItem.kt index e0c80ef57f3..3ad6e8c3d1e 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItem.kt @@ -104,8 +104,6 @@ fun MessageItem( onSelfDeletingMessageRead: (UIMessage) -> Unit, onFailedMessageRetryClicked: (String) -> Unit = {}, onFailedMessageCancelClicked: (String) -> Unit = {}, - onMessageButtonClicked: (messageId: String, buttonId: String) -> Unit, - pendingButtonsMap: Map = emptyMap() ) { with(message) { val selfDeletionTimerState = rememberSelfDeletionTimer(header.messageStatus.expirationStatus) @@ -232,8 +230,6 @@ fun MessageItem( onImageClick = currentOnImageClick, onLongClick = onLongClick, onOpenProfile = onOpenProfile, - onMessageButtonClicked = onMessageButtonClicked, - pendingButtonsMap = pendingButtonsMap, ) } if (isMyMessage) { @@ -448,8 +444,6 @@ private fun MessageContent( audioMessagesState: Map, onAssetClick: Clickable, onImageClick: Clickable, - onMessageButtonClicked: (messageId: String, buttonId: String) -> Unit, - pendingButtonsMap: Map, onAudioClick: (String) -> Unit, onChangeAudioPosition: (String, Int) -> Unit, onLongClick: (() -> Unit)? = null, @@ -483,8 +477,6 @@ private fun MessageContent( onLongClick = onLongClick, onOpenProfile = onOpenProfile, buttonList = null, - onButtonClick = null, - pendingButton = null, messageId = message.header.messageId ) PartialDeliveryInformation(messageContent.deliveryStatus) @@ -507,9 +499,7 @@ private fun MessageContent( onLongClick = onLongClick, onOpenProfile = onOpenProfile, buttonList = messageContent.buttonList, - onButtonClick = onMessageButtonClicked, messageId = message.header.messageId, - pendingButton = pendingButtonsMap[message.header.messageId] ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/EditMessageMenuItems.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/EditMessageMenuItems.kt index a0a3182946f..985691b4947 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/EditMessageMenuItems.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/EditMessageMenuItems.kt @@ -30,6 +30,7 @@ import com.wire.android.ui.common.bottomsheet.MenuItemIcon import com.wire.android.ui.home.conversations.model.ExpirationStatus import com.wire.android.ui.home.conversations.model.UIMessage import com.wire.android.ui.home.conversations.model.UIMessageContent +import com.wire.android.util.Copyable import com.wire.android.util.ui.UIText import com.wire.kalium.logic.data.message.mention.MessageMention @@ -49,39 +50,40 @@ fun EditMessageMenuItems( ): List<@Composable () -> Unit> { val localContext = LocalContext.current - val onCopyItemClick = remember(message) { - { - hideEditMessageMenu { - onCopyClick( - (message.messageContent as UIMessageContent.TextMessage).messageBody.message.asString( - localContext.resources - ) - ) + val isComposite = remember(message.header.messageId) { + message.messageContent is UIMessageContent.Composite + } + + val onCopyItemClick: (() -> Unit)? = remember(message.header.messageId) { + (message.messageContent as? Copyable)?.textToCopy(localContext.resources)?.let { + { + hideEditMessageMenu { onCopyClick(it) } } } } - val onDeleteItemClick = remember(message) { + + val onDeleteItemClick = remember(message.header.messageId) { { hideEditMessageMenu { onDeleteClick(message.header.messageId, message.isMyMessage) } } } - val onReactionItemClick = remember(message) { + val onReactionItemClick = remember(message.header.messageId) { { emoji: String -> hideEditMessageMenu { onReactionClick(message.header.messageId, emoji) } } } - val onReplyItemClick = remember(message) { + val onReplyItemClick = remember(message.header.messageId) { { hideEditMessageMenu { onReplyClick(message) } } } - val onDetailsItemClick = remember(message) { + val onDetailsItemClick = remember(message.header.messageId) { { hideEditMessageMenu { onDetailsClick(message.header.messageId, message.isMyMessage) @@ -132,6 +134,7 @@ fun EditMessageMenuItems( TextMessageEditMenuItems( isEphemeral = message.header.messageStatus.expirationStatus is ExpirationStatus.Expirable, isUploading = message.isPending, + isComposite = isComposite, onDeleteClick = onDeleteItemClick, onDetailsClick = onDetailsItemClick, onReactionClick = onReactionItemClick, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt index 923d2f44402..f181de20481 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt @@ -27,19 +27,20 @@ import com.wire.android.ui.edit.ReplyMessageOption fun TextMessageEditMenuItems( isEphemeral: Boolean, isUploading: Boolean, + isComposite: Boolean, onDeleteClick: () -> Unit, onDetailsClick: () -> Unit, onReplyClick: () -> Unit, - onCopyClick: () -> Unit, + onCopyClick: (() -> Unit)?, onReactionClick: (String) -> Unit, onEditClick: (() -> Unit)? = null ): List<@Composable () -> Unit> { return buildList { if (!isUploading) { - if (!isEphemeral) add { ReactionOption(onReactionClick) } + if (!isEphemeral && !isComposite) add { ReactionOption(onReactionClick) } add { MessageDetailsMenuOption(onDetailsClick) } - if (!isEphemeral) add { CopyItemMenuOption(onCopyClick) } - if (!isEphemeral) add { ReplyMessageOption(onReplyClick) } + onCopyClick?.also { add { CopyItemMenuOption(it) } } + if (!isEphemeral && !isComposite) add { ReplyMessageOption(onReplyClick) } if (!isEphemeral && onEditClick != null) add { EditMessageMenuOption(onEditClick) } } add { DeleteItemMenuOption(onDeleteClick) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt index 56190473ff4..875bde367d6 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt @@ -40,11 +40,15 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp +import androidx.core.os.bundleOf +import com.sebaslogen.resaca.hilt.hiltViewModelScoped import com.wire.android.model.Clickable import com.wire.android.model.ImageAsset +import com.wire.android.navigation.EXTRA_MESSAGE_ID import com.wire.android.ui.common.button.WireButtonState import com.wire.android.ui.common.button.WireSecondaryButton import com.wire.android.ui.common.dimensions +import com.wire.android.ui.home.conversations.CompositeMessageViewModel import com.wire.android.ui.home.conversations.model.messagetypes.asset.MessageAsset import com.wire.android.ui.home.conversations.model.messagetypes.image.DisplayableImageMessage import com.wire.android.ui.home.conversations.model.messagetypes.image.ImageMessageFailed @@ -80,9 +84,7 @@ internal fun MessageBody( isAvailable: Boolean, onLongClick: (() -> Unit)? = null, onOpenProfile: (String) -> Unit, - buttonList: List?, - pendingButton: String?, - onButtonClick: ((messageId: String, buttonId: String) -> Unit)? + buttonList: List? ) { val (displayMentions, text) = messageBody?.message?.let { mapToDisplayMentions(it, LocalContext.current.resources) @@ -110,8 +112,6 @@ internal fun MessageBody( MessageButtonsContent( messageId = messageId, buttonList = it, - onClick = onButtonClick, - pendingButton = pendingButton ) } } @@ -119,10 +119,14 @@ internal fun MessageBody( @Composable fun MessageButtonsContent( messageId: String, - pendingButton: String?, buttonList: List, - onClick: ((messageId: String, buttonId: String) -> Unit)? ) { + val viewModel = hiltViewModelScoped( + key = "${CompositeMessageViewModel.ARGS_KEY}$messageId", + defaultArguments = bundleOf( + EXTRA_MESSAGE_ID to messageId, + ) + ) Column( modifier = Modifier .wrapContentSize() @@ -131,10 +135,9 @@ fun MessageButtonsContent( for (index in buttonList.indices) { val button = buttonList[index] MessageButtonItem( - messageId = messageId, - pendingButtonId = pendingButton, + pendingButtonId = viewModel.pendingButtons, button = button, - onClick = onClick + onClick = viewModel::onButtonClicked ) if (index != buttonList.lastIndex) { Spacer(modifier = Modifier.padding(top = dimensions().spacing8x)) @@ -146,15 +149,14 @@ fun MessageButtonsContent( @SuppressLint("RememberReturnType") @Composable fun MessageButtonItem( - messageId: String, button: MessageButton, pendingButtonId: MessageButtonId?, - onClick: ((messageId: String, buttonId: String) -> Unit)? + onClick: ((buttonId: String) -> Unit)? ) { val onCLick = remember(button.isSelected) { onClick?.let { if (!button.isSelected) { - { onClick(messageId, button.id) } + { onClick(button.id) } } else { { } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypesPreview.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypesPreview.kt index 7b29bdfa112..1adc4cc8f4c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypesPreview.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypesPreview.kt @@ -66,8 +66,7 @@ fun PreviewMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -96,8 +95,7 @@ fun PreviewMessageWithReactions() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -137,8 +135,7 @@ fun PreviewMessageWithReply() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -168,8 +165,7 @@ fun PreviewDeletedMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -200,8 +196,7 @@ fun PreviewFailedSendMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -232,8 +227,7 @@ fun PreviewFailedDecryptionMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -254,8 +248,7 @@ fun PreviewAssetMessageWithReactions() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -344,8 +337,7 @@ fun PreviewImageMessageUploaded() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -366,8 +358,7 @@ fun PreviewImageMessageUploading() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -394,8 +385,7 @@ fun PreviewImageMessageFailedUpload() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -417,8 +407,7 @@ fun PreviewMessageWithSystemMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = { }, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) SystemMessageItem( mockMessageWithKnock.copy( @@ -462,8 +451,7 @@ fun PreviewMessagesWithUnavailableQuotedMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } @@ -485,8 +473,7 @@ fun PreviewAggregatedMessagesWithErrorMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) MessageItem( message = mockMessageWithText.copy( @@ -508,8 +495,7 @@ fun PreviewAggregatedMessagesWithErrorMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) MessageItem( message = mockMessageWithText.copy( @@ -531,8 +517,7 @@ fun PreviewAggregatedMessagesWithErrorMessage() { onReactionClicked = { _, _ -> }, onResetSessionClicked = { _, _ -> }, onSelfDeletingMessageRead = {}, - conversationDetailsData = ConversationDetailsData.None, - onMessageButtonClicked = { _, _ -> } + conversationDetailsData = ConversationDetailsData.None ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/UIMessage.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/UIMessage.kt index ae55791da76..cd722eb4eae 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/UIMessage.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/UIMessage.kt @@ -20,6 +20,7 @@ package com.wire.android.ui.home.conversations.model +import android.content.res.Resources import androidx.annotation.DrawableRes import androidx.annotation.StringRes import androidx.compose.runtime.Stable @@ -28,6 +29,7 @@ import com.wire.android.model.ImageAsset import com.wire.android.model.UserAvatarData import com.wire.android.ui.home.conversationslist.model.Membership import com.wire.android.ui.home.messagecomposer.SelfDeletionDuration +import com.wire.android.util.Copyable import com.wire.android.util.ui.UIText import com.wire.android.util.uiMessageDateTime import com.wire.kalium.logic.data.conversation.ClientId @@ -211,12 +213,16 @@ sealed class UIMessageContent { data class TextMessage( val messageBody: MessageBody, override val deliveryStatus: DeliveryStatusContent = DeliveryStatusContent.CompleteDelivery - ) : Regular(), PartialDeliverable + ) : Regular(), PartialDeliverable, Copyable { + override fun textToCopy(resources: Resources): String = messageBody.message.asString(resources) + } data class Composite( val messageBody: MessageBody?, val buttonList: List - ) : Regular() + ) : Regular(), Copyable { + override fun textToCopy(resources: Resources): String? = messageBody?.message?.asString(resources) + } object Deleted : Regular() diff --git a/app/src/main/kotlin/com/wire/android/util/Copyable.kt b/app/src/main/kotlin/com/wire/android/util/Copyable.kt new file mode 100644 index 00000000000..20d6b781a3f --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/util/Copyable.kt @@ -0,0 +1,25 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.util + +import android.content.res.Resources + + +interface Copyable { + fun textToCopy(resources: Resources): String? +} From d40b4ad99743944fde9dabacb7f76e5c1f904f3c Mon Sep 17 00:00:00 2001 From: Mohamad Jaara Date: Tue, 25 Jul 2023 10:48:20 +0200 Subject: [PATCH 3/9] unit test --- .../CompositeMessagesViewModel.kt | 8 ++++---- .../home/conversations/model/MessageTypes.kt | 2 +- ...st.kt => CompositeMessageViewModelTest.kt} | 20 +++++++++++-------- kalium | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) rename app/src/test/kotlin/com/wire/android/ui/home/conversations/{CompositeMessagesViewModelTest.kt => CompositeMessageViewModelTest.kt} (85%) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt index 1f690c681cb..771a674712b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt @@ -47,18 +47,18 @@ class CompositeMessageViewModel @Inject constructor( private val messageId: String = savedStateHandle.get(EXTRA_MESSAGE_ID)!! - var pendingButtons: MessageButtonId? by mutableStateOf(null) + var pendingButtonId: MessageButtonId? by mutableStateOf(null) @VisibleForTesting set fun onButtonClicked(buttonId: String) { - if (pendingButtons != null) return + if (pendingButtonId != null) return - pendingButtons = buttonId + pendingButtonId = buttonId viewModelScope.launch { sendButtonActionMessageUseCase(conversationId, messageId, buttonId) }.invokeOnCompletion { - pendingButtons = null + pendingButtonId = null } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt index 875bde367d6..2e1e8ef3422 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt @@ -135,7 +135,7 @@ fun MessageButtonsContent( for (index in buttonList.indices) { val button = buttonList[index] MessageButtonItem( - pendingButtonId = viewModel.pendingButtons, + pendingButtonId = viewModel.pendingButtonId, button = button, onClick = viewModel::onButtonClicked ) diff --git a/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModelTest.kt b/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt similarity index 85% rename from app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModelTest.kt rename to app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt index e8c26aec8a1..0945ecf10e8 100644 --- a/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModelTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt @@ -29,23 +29,24 @@ import io.mockk.every import io.mockk.impl.annotations.MockK import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest +import org.amshove.kluent.internal.assertEquals import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(CoroutineTestExtension::class) -class CompositeMessagesViewModelTest { +class CompositeMessageViewModelTest { @Test fun `given pending button, when button is clicked, then do Nothing`() = runTest { // Arrange val (arrangement, viewModel) = Arrangement().arrange() - val messageId = "messageId" val buttonId = "buttonId" - viewModel.pendingButtons[messageId] = buttonId + viewModel.pendingButtonId = buttonId // Act - viewModel.onButtonClicked(messageId, buttonId) + viewModel.onButtonClicked(buttonId) advanceUntilIdle() // Assert @@ -60,13 +61,13 @@ class CompositeMessagesViewModelTest { val (arrangement, viewModel) = Arrangement() .withButtonActionMessage(SendButtonActionMessageUseCase.Result.Success) .arrange() - val messageId = "messageId" + val buttonId = "buttonId" // Act - viewModel.onButtonClicked(messageId, buttonId) + viewModel.onButtonClicked(buttonId) advanceUntilIdle() - assertFalse(viewModel.pendingButtons.containsKey(messageId)) + assertNull(viewModel.pendingButtonId) // Assert coVerify(exactly = 1) { @@ -76,6 +77,8 @@ class CompositeMessagesViewModelTest { private companion object { const val CONVERSION_ID_STRING = "some-dummy-value@some.dummy.domain" + const val MESSAGE_ID = "message-id" + } private class Arrangement { @@ -90,9 +93,10 @@ class CompositeMessagesViewModelTest { init { MockKAnnotations.init(this) every { savedStateHandle.get(any()) } returns CONVERSION_ID_STRING + every { savedStateHandle.get(any()) } returns MESSAGE_ID } - private val viewModel = CompositeMessagesViewModel(sendButtonActionMessage, qualifiedIdMapper, savedStateHandle) + private val viewModel = CompositeMessageViewModel(sendButtonActionMessage, qualifiedIdMapper, savedStateHandle) fun withButtonActionMessage( result: SendButtonActionMessageUseCase.Result diff --git a/kalium b/kalium index edb6f31270f..73078495783 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit edb6f31270f83cc707ec0bf484e9fd5eac41248b +Subproject commit 7307849578351dd40f52af259640fb75dc0ba152 From de928859b4ba836202d8de980c7af01bc0ffb312 Mon Sep 17 00:00:00 2001 From: Mohamad Jaara Date: Tue, 25 Jul 2023 10:56:46 +0200 Subject: [PATCH 4/9] trigger CI From 9cca67cb1ef7c668f3dab34b20cc1e459cc57821 Mon Sep 17 00:00:00 2001 From: Mohamad Jaara Date: Tue, 25 Jul 2023 11:06:21 +0200 Subject: [PATCH 5/9] detekt --- ...iteMessagesViewModel.kt => CompositeMessageViewModel.kt} | 0 .../ui/home/conversations/edit/TextMessageMenuItems.kt | 2 +- app/src/main/kotlin/com/wire/android/util/Copyable.kt | 6 +++++- .../ui/home/conversations/CompositeMessageViewModelTest.kt | 5 +---- 4 files changed, 7 insertions(+), 6 deletions(-) rename app/src/main/kotlin/com/wire/android/ui/home/conversations/{CompositeMessagesViewModel.kt => CompositeMessageViewModel.kt} (100%) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModel.kt similarity index 100% rename from app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessagesViewModel.kt rename to app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModel.kt diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt index f181de20481..03c4d7f26d7 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/edit/TextMessageMenuItems.kt @@ -39,7 +39,7 @@ fun TextMessageEditMenuItems( if (!isUploading) { if (!isEphemeral && !isComposite) add { ReactionOption(onReactionClick) } add { MessageDetailsMenuOption(onDetailsClick) } - onCopyClick?.also { add { CopyItemMenuOption(it) } } + onCopyClick?.also { add { CopyItemMenuOption(it) } } if (!isEphemeral && !isComposite) add { ReplyMessageOption(onReplyClick) } if (!isEphemeral && onEditClick != null) add { EditMessageMenuOption(onEditClick) } } diff --git a/app/src/main/kotlin/com/wire/android/util/Copyable.kt b/app/src/main/kotlin/com/wire/android/util/Copyable.kt index 20d6b781a3f..86c6ad03b4d 100644 --- a/app/src/main/kotlin/com/wire/android/util/Copyable.kt +++ b/app/src/main/kotlin/com/wire/android/util/Copyable.kt @@ -19,7 +19,11 @@ package com.wire.android.util import android.content.res.Resources - +/** + * Interface for classes that can be copied to the clipboard. + * @see [TextMessageEditMenuItems] + * if a UIMessage implement this interface the copy option will be displayed in the edit menu. + */ interface Copyable { fun textToCopy(resources: Resources): String? } diff --git a/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt b/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt index 0945ecf10e8..1b923a22398 100644 --- a/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt @@ -29,8 +29,6 @@ import io.mockk.every import io.mockk.impl.annotations.MockK import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest -import org.amshove.kluent.internal.assertEquals -import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -43,7 +41,7 @@ class CompositeMessageViewModelTest { // Arrange val (arrangement, viewModel) = Arrangement().arrange() val buttonId = "buttonId" - viewModel.pendingButtonId = buttonId + viewModel.pendingButtonId = buttonId // Act viewModel.onButtonClicked(buttonId) @@ -78,7 +76,6 @@ class CompositeMessageViewModelTest { private companion object { const val CONVERSION_ID_STRING = "some-dummy-value@some.dummy.domain" const val MESSAGE_ID = "message-id" - } private class Arrangement { From 4168cab376a13c52791c6bbfb158c41726e26aaf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:06:24 +0000 Subject: [PATCH 6/9] chore(deps): bump androidx.browser:browser from 1.3.0 to 1.5.0 (#2000) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mohamad Jaara --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e085f6119b3..4328c9a636c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -31,7 +31,7 @@ androidx-paging3 = "3.1.1" androidx-paging3Compose = "1.0.0-alpha18" androidx-splashscreen = "1.0.1" androidx-workManager = "2.8.1" -androidx-browser = "1.3.0" +androidx-browser = "1.5.0" # Compose compose = "1.5.0-beta03" From 2337a42e7b53d7e1c8a0ebe9671561a7c2498cb3 Mon Sep 17 00:00:00 2001 From: Tommaso Piazza <196761+tmspzz@users.noreply.github.com> Date: Tue, 25 Jul 2023 13:21:37 +0200 Subject: [PATCH 7/9] chore: delete unused git file --- git | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 git diff --git a/git b/git deleted file mode 100644 index e69de29bb2d..00000000000 From ff2a955bc5694cf0a47ce904e8242ab85203fd4c Mon Sep 17 00:00:00 2001 From: Mohamad Jaara Date: Tue, 25 Jul 2023 14:39:52 +0200 Subject: [PATCH 8/9] PR comments --- .../ui/home/conversations/CompositeMessageViewModel.kt | 2 +- .../ui/home/conversations/model/MessageTypes.kt | 10 +++++----- .../conversations/CompositeMessageViewModelTest.kt | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModel.kt index 771a674712b..57055aedce3 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModel.kt @@ -51,7 +51,7 @@ class CompositeMessageViewModel @Inject constructor( @VisibleForTesting set - fun onButtonClicked(buttonId: String) { + fun sendButtonActionMessage(buttonId: String) { if (pendingButtonId != null) return pendingButtonId = buttonId diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt index 2e1e8ef3422..fb168c30e94 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt @@ -137,7 +137,7 @@ fun MessageButtonsContent( MessageButtonItem( pendingButtonId = viewModel.pendingButtonId, button = button, - onClick = viewModel::onButtonClicked + doButtonAction = viewModel::sendButtonActionMessage ) if (index != buttonList.lastIndex) { Spacer(modifier = Modifier.padding(top = dimensions().spacing8x)) @@ -151,16 +151,16 @@ fun MessageButtonsContent( fun MessageButtonItem( button: MessageButton, pendingButtonId: MessageButtonId?, - onClick: ((buttonId: String) -> Unit)? + doButtonAction: ((buttonId: String) -> Unit) ) { val onCLick = remember(button.isSelected) { - onClick?.let { + doButtonAction.let { if (!button.isSelected) { - { onClick(button.id) } + { doButtonAction(button.id) } } else { { } } - } ?: { } + } } val isPending = remember(pendingButtonId) { diff --git a/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt b/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt index 1b923a22398..4eb26fa1a20 100644 --- a/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/home/conversations/CompositeMessageViewModelTest.kt @@ -44,7 +44,7 @@ class CompositeMessageViewModelTest { viewModel.pendingButtonId = buttonId // Act - viewModel.onButtonClicked(buttonId) + viewModel.sendButtonActionMessage(buttonId) advanceUntilIdle() // Assert @@ -63,7 +63,7 @@ class CompositeMessageViewModelTest { val buttonId = "buttonId" // Act - viewModel.onButtonClicked(buttonId) + viewModel.sendButtonActionMessage(buttonId) advanceUntilIdle() assertNull(viewModel.pendingButtonId) From b609544b382a3b67b55aa785dd41d357b1dbd84d Mon Sep 17 00:00:00 2001 From: Mohamad Jaara Date: Wed, 26 Jul 2023 12:22:07 +0200 Subject: [PATCH 9/9] PR comments --- .../home/conversations/model/MessageTypes.kt | 58 ++++++------------- .../NewConversationViewModel.kt | 4 ++ kalium | 2 +- 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt index fb168c30e94..66fe9621eba 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt @@ -20,7 +20,6 @@ package com.wire.android.ui.home.conversations.model -import android.annotation.SuppressLint import android.content.res.Resources import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background @@ -131,13 +130,27 @@ fun MessageButtonsContent( modifier = Modifier .wrapContentSize() ) { - for (index in buttonList.indices) { val button = buttonList[index] - MessageButtonItem( - pendingButtonId = viewModel.pendingButtonId, - button = button, - doButtonAction = viewModel::sendButtonActionMessage + val onCLick = remember(button.isSelected) { + if (!button.isSelected) { + { viewModel.sendButtonActionMessage(button.id) } + } else { + { } + } + } + + val isPending = viewModel.pendingButtonId == button.id + + val state = if (button.isSelected) WireButtonState.Selected + else if (viewModel.pendingButtonId != null) WireButtonState.Disabled + else WireButtonState.Default + + WireSecondaryButton( + loading = isPending, + text = button.text, + onClick = onCLick, + state = state ) if (index != buttonList.lastIndex) { Spacer(modifier = Modifier.padding(top = dimensions().spacing8x)) @@ -146,39 +159,6 @@ fun MessageButtonsContent( } } -@SuppressLint("RememberReturnType") -@Composable -fun MessageButtonItem( - button: MessageButton, - pendingButtonId: MessageButtonId?, - doButtonAction: ((buttonId: String) -> Unit) -) { - val onCLick = remember(button.isSelected) { - doButtonAction.let { - if (!button.isSelected) { - { doButtonAction(button.id) } - } else { - { } - } - } - } - - val isPending = remember(pendingButtonId) { - pendingButtonId == button.id - } - - val state = if (button.isSelected) WireButtonState.Selected - else if (pendingButtonId != null) WireButtonState.Disabled - else WireButtonState.Default - - WireSecondaryButton( - loading = isPending, - text = button.text, - onClick = onCLick, - state = state - ) -} - @OptIn(ExperimentalFoundationApi::class) @Composable fun MessageImage( diff --git a/app/src/main/kotlin/com/wire/android/ui/home/newconversation/NewConversationViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/newconversation/NewConversationViewModel.kt index dd967acc227..b7f9769f3b0 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/newconversation/NewConversationViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/newconversation/NewConversationViewModel.kt @@ -226,6 +226,10 @@ class NewConversationViewModel @Inject constructor( appLogger.w("Error while creating a group ${result.cause}") groupOptionsState = groupOptionsState.copy(isLoading = false, error = GroupOptionState.Error.Unknown) } + + is CreateGroupConversationUseCase.Result.BackendConflictFailure -> { + // TODO: handle this case + } } } diff --git a/kalium b/kalium index 73078495783..8532357e2f8 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 7307849578351dd40f52af259640fb75dc0ba152 +Subproject commit 8532357e2f898867e0292e2335be66d32aa9f83c