diff --git a/app/src/main/kotlin/com/wire/android/mapper/MessagePreviewContentMapper.kt b/app/src/main/kotlin/com/wire/android/mapper/MessagePreviewContentMapper.kt
index 89a319e968..7a3858e4d3 100644
--- a/app/src/main/kotlin/com/wire/android/mapper/MessagePreviewContentMapper.kt
+++ b/app/src/main/kotlin/com/wire/android/mapper/MessagePreviewContentMapper.kt
@@ -105,6 +105,44 @@ private fun String?.userUiText(isSelfMessage: Boolean): UIText = when {
else -> UIText.StringResource(R.string.username_unavailable_label)
}
+private fun assetMessageResId(
+ assetType: AssetType,
+ isSelfMessage: Boolean,
+ count: Int
+): UIText {
+ return if (count > 1) {
+ val resId = when (assetType) {
+ AssetType.AUDIO -> if (isSelfMessage) R.string.last_message_self_user_shared_multiple_audio
+ else R.string.last_message_other_user_shared_multiple_audio
+
+ AssetType.IMAGE -> if (isSelfMessage) R.string.last_message_self_user_shared_multiple_image
+ else R.string.last_message_other_user_shared_multiple_image
+
+ AssetType.VIDEO -> if (isSelfMessage) R.string.last_message_self_user_shared_multiple_video
+ else R.string.last_message_other_user_shared_multiple_video
+
+ AssetType.GENERIC_ASSET -> if (isSelfMessage) R.string.last_message_self_user_shared_multiple_asset
+ else R.string.last_message_other_user_shared_multiple_asset
+ }
+ UIText.StringResource(resId, count)
+ } else {
+ val resId = when (assetType) {
+ AssetType.AUDIO -> if (isSelfMessage) R.string.last_message_self_user_shared_audio
+ else R.string.last_message_other_user_shared_audio
+
+ AssetType.IMAGE -> if (isSelfMessage) R.string.last_message_self_user_shared_image
+ else R.string.last_message_other_user_shared_image
+
+ AssetType.VIDEO -> if (isSelfMessage) R.string.last_message_self_user_shared_video
+ else R.string.last_message_other_user_shared_video
+
+ AssetType.GENERIC_ASSET -> if (isSelfMessage) R.string.last_message_self_user_shared_asset
+ else R.string.last_message_other_user_shared_asset
+ }
+ UIText.StringResource(resId)
+ }
+}
+
@Suppress("LongMethod", "ComplexMethod", "NestedBlockDepth")
fun MessagePreview.uiLastMessageContent(): UILastMessageContent {
return when (content) {
@@ -112,49 +150,10 @@ fun MessagePreview.uiLastMessageContent(): UILastMessageContent {
val userContent = (content as WithUser)
val userUIText = userContent.username.userUiText(isSelfMessage)
when ((userContent)) {
- is WithUser.Asset -> when ((content as WithUser.Asset).type) {
- AssetType.AUDIO ->
- UILastMessageContent.SenderWithMessage(
- userUIText,
- UIText.StringResource(R.string.last_message_self_user_shared_audio)
- )
-
- AssetType.IMAGE ->
- UILastMessageContent.SenderWithMessage(
- userUIText,
- UIText.StringResource(
- if (isSelfMessage) {
- R.string.last_message_self_user_shared_image
- } else {
- R.string.last_message_other_user_shared_image
- }
- )
- )
-
- AssetType.VIDEO ->
- UILastMessageContent.SenderWithMessage(
- userUIText,
- UIText.StringResource(
- if (isSelfMessage) {
- R.string.last_message_self_user_shared_video
- } else {
- R.string.last_message_other_user_shared_video
- }
- )
- )
-
- AssetType.GENERIC_ASSET ->
- UILastMessageContent.SenderWithMessage(
- userUIText,
- UIText.StringResource(
- if (isSelfMessage) {
- R.string.last_message_self_user_shared_asset
- } else {
- R.string.last_message_other_user_shared_asset
- }
- )
- )
- }
+ is WithUser.Asset -> UILastMessageContent.SenderWithMessage(
+ sender = userUIText,
+ message = assetMessageResId((content as WithUser.Asset).type, isSelfMessage, (content as WithUser.Asset).count)
+ )
is WithUser.ConversationNameChange -> UILastMessageContent.SenderWithMessage(
userUIText,
@@ -368,12 +367,33 @@ fun MessagePreview.uiLastMessageContent(): UILastMessageContent {
MessagePreviewContent.VerificationChanged.DegradedProteus ->
UILastMessageContent.VerificationChanged(R.string.last_message_conversations_verification_degraded_proteus)
- is MessagePreviewContent.Draft -> UILastMessageContent.SenderWithMessage(
- UIText.StringResource(R.string.label_draft),
- (content as MessagePreviewContent.Draft).message.toUIText(),
- separator = ":${MarkdownConstants.NON_BREAKING_SPACE}"
- )
+ is MessagePreviewContent.Draft -> {
+ with(content as MessagePreviewContent.Draft) {
+ val messageUiText = if (attachmentsCount > 0) {
+ val pluralId = attachmentPlural(attachmentType)
+ UIText.PluralResource(pluralId, attachmentsCount, attachmentsCount)
+ } else {
+ message?.toUIText() ?: "".toUIText()
+ }
+
+ UILastMessageContent.SenderWithMessage(
+ sender = UIText.StringResource(R.string.label_draft),
+ message = messageUiText,
+ separator = ":${MarkdownConstants.NON_BREAKING_SPACE}"
+ )
+ }
+ }
Unknown -> UILastMessageContent.None
}
}
+
+private fun attachmentPlural(type: String?): Int =
+ when {
+ type == null -> R.plurals.draft_files_count
+ "image/" in type -> R.plurals.draft_image_count
+ "video/" in type -> R.plurals.draft_video_count
+ "audio/" in type -> R.plurals.draft_audio_count
+ else -> R.plurals.draft_files_count
+ }
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 00c8b8b2e6..1e60b0d481 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -89,6 +89,23 @@
and
Retry
*Draft*
+
+ - 1 file
+ - %1$d files
+
+
+ - 1 image
+ - %1$d images
+
+
+ - 1 video
+ - %1$d videos
+
+
+ - 1 audio
+ - %1$d audios
+
+
Show password
Hide password
@@ -914,28 +931,37 @@
- 1 person was removed from the conversation
- %1$d people were removed from the conversation
- shared a file.
- shared a file.
- shared an image.
- shared an image.
- shared a video.
- shared a video.
- shared an audio message.
- shared an audio message.
- shared a location.
- shared a location.
- pinged.
- pinged.
- called.
+
+ shared a file
+ shared a file
+ shared %1$s files
+ shared %1$s files
+ shared an image
+ shared an image
+ shared %1$s images
+ shared %1$s images
+ shared a video
+ shared a video
+ shared %1$s videos
+ shared %1$s videos
+ shared an audio message
+ shared an audio message
+ shared %1$s audio messages
+ shared %1$s audio messages
+ shared a location
+ shared a location
+ pinged
+ pinged
+ called
mentioned you
replied to you
changed conversation name
changed conversation name
%1$s calling...
- joined the conversation.
- left the conversation.
- joined the conversation.
- left the conversation.
+ joined the conversation
+ left the conversation
+ joined the conversation
+ left the conversation
All device fingerprints are verified (Proteus)
All devices are verified (End-to-end Identity)
Conversation is no longer verified
diff --git a/kalium b/kalium
index 482d56255a..44ec585baf 160000
--- a/kalium
+++ b/kalium
@@ -1 +1 @@
-Subproject commit 482d56255a0947efd95060a6688e035f77103d3e
+Subproject commit 44ec585bafb3302d981cc55f0433665560c87442