From 763a5dabc59e91333b527a5dc73dff238d09052d Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Fri, 15 Dec 2023 15:51:04 +0100 Subject: [PATCH] chore: quoted messages for location --- .../com/wire/kalium/logic/data/message/MessageContent.kt | 2 ++ .../com/wire/kalium/logic/data/message/MessageMapper.kt | 6 ++++++ .../wire/kalium/persistence/dao/message/MessageEntity.kt | 1 + .../wire/kalium/persistence/dao/message/MessageMapper.kt | 2 ++ 4 files changed, 11 insertions(+) diff --git a/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt b/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt index c64411b3e0f..54976cac7dd 100644 --- a/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt +++ b/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt @@ -136,6 +136,8 @@ sealed class MessageContent { val assetMimeType: String ) : Content + data class Location(val locationName: String?) : Content + data object Deleted : Content data object Invalid : Content diff --git a/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt b/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt index 3a8c51fbc68..caf06618124 100644 --- a/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt +++ b/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt @@ -597,6 +597,12 @@ private fun quotedContentFromEntity(it: MessageEntityContent.Text.QuotedMessage) ) } + it.contentType == MessageEntity.ContentType.LOCATION -> { + MessageContent.QuotedMessageDetails.Location( + locationName = it.locationName, + ) + } + // If a new content type can be replied to (Pings, for example), fallback to Invalid else -> MessageContent.QuotedMessageDetails.Invalid } diff --git a/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageEntity.kt b/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageEntity.kt index 2b1c13c191e..ba988a1466a 100644 --- a/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageEntity.kt +++ b/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageEntity.kt @@ -270,6 +270,7 @@ sealed class MessageEntityContent { val textBody: String?, val assetMimeType: String?, val assetName: String?, + val locationName: String?, ) } diff --git a/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt b/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt index d65a51f9856..b0d0c20e2b8 100644 --- a/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt +++ b/persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt @@ -508,6 +508,7 @@ object MessageMapper { textBody = quotedTextBody, assetMimeType = quotedAssetMimeType, assetName = quotedAssetName, + locationName = locationName ) }, ) @@ -576,6 +577,7 @@ object MessageMapper { textBody = quotedTextBody, assetMimeType = quotedAssetMimeType, assetName = quotedAssetName, + locationName = locationName ) }, )