From d349ef04f6a39b561b23866c3c649917b17f5314 Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Tue, 7 May 2024 15:49:56 +0200 Subject: [PATCH] fix: disable swiping hint for self-deleting and deleted messages --- .../conversations/messages/item/RegularMessageItem.kt | 9 ++------- .../android/ui/home/conversations/model/UIMessage.kt | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/item/RegularMessageItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/item/RegularMessageItem.kt index a6a8f2734f2..c587826c69d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/item/RegularMessageItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/item/RegularMessageItem.kt @@ -258,12 +258,9 @@ fun RegularMessageItem( } ) } - if (swipableMessageConfiguration is SwipableMessageConfiguration.SwipableToReply) { + if (swipableMessageConfiguration is SwipableMessageConfiguration.SwipableToReply && isReplyable) { val onSwipe = remember(message) { { swipableMessageConfiguration.onSwipedToReply(message) } } - SwipableToReplyBox( - isSwipable = isReplyable, - onSwipedToReply = onSwipe - ) { + SwipableToReplyBox(onSwipedToReply = onSwipe) { messageContent() } } else { @@ -280,7 +277,6 @@ sealed interface SwipableMessageConfiguration { @OptIn(ExperimentalMaterial3Api::class) @Composable private fun SwipableToReplyBox( - isSwipable: Boolean, modifier: Modifier = Modifier, onSwipedToReply: () -> Unit = {}, content: @Composable RowScope.() -> Unit @@ -316,7 +312,6 @@ private fun SwipableToReplyBox( SwipeToDismissBox( state = dismissState, modifier = modifier, - enableDismissFromStartToEnd = isSwipable, content = content, enableDismissFromEndToStart = false, backgroundContent = { 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 9c2643824f3..d568387f0f9 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 @@ -99,6 +99,7 @@ sealed interface UIMessage { val isReplyable: Boolean get() = isReplyableContent && isTheMessageAvailableToOtherUsers && + !isDeleted && header.messageStatus.expirationStatus is ExpirationStatus.NotExpirable val isTextContentWithoutQuote = messageContent is UIMessageContent.TextMessage && messageContent.messageBody.quotedMessage == null