Skip to content

Commit

Permalink
remove composite message preview mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Jul 18, 2023
1 parent f477546 commit 772dadc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ sealed interface MessagePreviewContent {
sealed interface WithUser : MessagePreviewContent {
val username: String?

data class Text(override val username: String?, val messageBody: String?) : WithUser
data class Text(override val username: String?, val messageBody: String) : WithUser

data class Asset(override val username: String?, val type: AssetType) : WithUser

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ class MessageMapperImpl(
)
}
return when (message.contentType) {

MessageEntity.ContentType.COMPOSITE,
MessageEntity.ContentType.TEXT -> LocalNotificationMessage.Text(
author = sender,
text = message.text.orEmpty(),
Expand Down Expand Up @@ -263,6 +261,7 @@ class MessageMapperImpl(
MessageEntity.ContentType.CONVERSATION_MESSAGE_TIMER_CHANGED -> null
MessageEntity.ContentType.CONVERSATION_CREATED -> null
MessageEntity.ContentType.MLS_WRONG_EPOCH_WARNING -> null
MessageEntity.ContentType.COMPOSITE -> null
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ data class NotificationMessageEntity(

sealed class MessagePreviewEntityContent {

data class Text(val senderName: String?, val messageBody: String?) : MessagePreviewEntityContent()
data class Text(val senderName: String?, val messageBody: String) : MessagePreviewEntityContent()

data class Asset(val senderName: String?, val type: AssetTypeEntity) : MessagePreviewEntityContent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ object MessageMapper {

MessageEntity.ContentType.REMOVED_FROM_TEAM -> MessagePreviewEntityContent.TeamMemberRemoved(userName = senderName)

MessageEntity.ContentType.COMPOSITE -> MessagePreviewEntityContent.Text(
senderName = senderName,
// composite messages can have no text since they are just a collection of Text and Buttons
// so if the collection have no text we just set it is null therefore no need to require it
messageBody = text
)

MessageEntity.ContentType.NEW_CONVERSATION_RECEIPT_MODE -> MessagePreviewEntityContent.Unknown
MessageEntity.ContentType.CONVERSATION_RECEIPT_MODE_CHANGED -> MessagePreviewEntityContent.Unknown
MessageEntity.ContentType.HISTORY_LOST -> MessagePreviewEntityContent.Unknown
Expand All @@ -193,6 +186,7 @@ object MessageMapper {
MessageEntity.ContentType.MLS_WRONG_EPOCH_WARNING -> MessagePreviewEntityContent.Unknown
MessageEntity.ContentType.UNKNOWN -> MessagePreviewEntityContent.Unknown
MessageEntity.ContentType.FAILED_DECRYPTION -> MessagePreviewEntityContent.Unknown
MessageEntity.ContentType.COMPOSITE -> MessagePreviewEntityContent.Unknown
MessageEntity.ContentType.CRYPTO_SESSION_RESET -> MessagePreviewEntityContent.CryptoSessionReset
}
}
Expand Down

0 comments on commit 772dadc

Please sign in to comment.