Skip to content

Commit

Permalink
fix: disable swiping hint for self-deleting and deleted messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugods committed May 7, 2024
1 parent 9477034 commit d349ef0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -316,7 +312,6 @@ private fun SwipableToReplyBox(
SwipeToDismissBox(
state = dismissState,
modifier = modifier,
enableDismissFromStartToEnd = isSwipable,
content = content,
enableDismissFromEndToStart = false,
backgroundContent = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d349ef0

Please sign in to comment.