diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt index 74c289bbc11..9be462be2a8 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt @@ -158,10 +158,8 @@ internal fun DefaultMessageUnreadSeparatorContent(unreadSeparatorItemState: Unre ) { Text( modifier = Modifier.padding(vertical = 2.dp, horizontal = 16.dp), - text = LocalContext.current.resources.getQuantityString( - R.plurals.stream_compose_message_list_unread_separator, - unreadSeparatorItemState.unreadCount, - unreadSeparatorItemState.unreadCount, + text = LocalContext.current.resources.getString( + R.string.stream_compose_message_list_unread_separator, ), style = ChatTheme.messageUnreadSeparatorTheme.textStyle, ) diff --git a/stream-chat-android-compose/src/main/res/values/strings.xml b/stream-chat-android-compose/src/main/res/values/strings.xml index 1553cd6b31e..4c47f9610bf 100644 --- a/stream-chat-android-compose/src/main/res/values/strings.xml +++ b/stream-chat-android-compose/src/main/res/values/strings.xml @@ -72,10 +72,7 @@ %d Reply %d Replies - - %d Unread Message - %d Unread Messages - + Unread Messages No messages There is no app to view this url:\n%s Unsupported attachment diff --git a/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt b/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt index dbf2c81b1e2..5df68d2e20a 100644 --- a/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt +++ b/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt @@ -512,18 +512,17 @@ public class MessageListController( channelState.filterNotNull().flatMapLatest { it.loadingNewerMessages }.onEach { updateIsLoadingNewerMessages(it) }.launchIn(scope) - refreshUnreadLabel(null) + refreshUnreadLabel() } - private fun refreshUnreadLabel(expectedMessageId: String?) { + private fun refreshUnreadLabel() { val previousUnreadMessageId = unreadLabelState.value?.lastReadMessageId channelState.filterNotNull() .flatMapLatest { it.read .filterNotNull() .filter { - it.unreadMessages > 0 && - it.lastReadMessageId != null && + it.lastReadMessageId != null && previousUnreadMessageId?.equals(it.lastReadMessageId)?.not() ?: true } } @@ -834,6 +833,7 @@ public class MessageListController( unreadLabel ?.takeIf { it.lastReadMessageId == message.id } + ?.takeIf { nextMessage != null } ?.let { groupedMessages.add(UnreadSeparatorItemState(it.unreadCount)) } if (index == 0 && shouldAddThreadSeparator) { @@ -1510,7 +1510,7 @@ public class MessageListController( ErrorEvent.MarkUnreadError(it) } } else { - refreshUnreadLabel(message.id) + refreshUnreadLabel() } } } diff --git a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/viewholder/internal/UnreadSeparatorViewHolder.kt b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/viewholder/internal/UnreadSeparatorViewHolder.kt index f4e184506f6..e93f22ee598 100644 --- a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/viewholder/internal/UnreadSeparatorViewHolder.kt +++ b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/viewholder/internal/UnreadSeparatorViewHolder.kt @@ -43,10 +43,7 @@ internal class UnreadSeparatorViewHolder( binding.root.setBackgroundColor(style.unreadSeparatorBackgroundColor) binding.unreadSeparatorLabel.setTextStyle(style.unreadSeparatorTextStyle) - binding.unreadSeparatorLabel.text = context.resources.getQuantityString( - R.plurals.stream_ui_message_list_unread_separator, - data.unreadCount, - data.unreadCount, - ) + binding.unreadSeparatorLabel.text = + context.resources.getString(R.string.stream_ui_message_list_unread_separator) } } diff --git a/stream-chat-android-ui-components/src/main/res/values/strings_message_list.xml b/stream-chat-android-ui-components/src/main/res/values/strings_message_list.xml index 06c5c42f5e4..9bf44ef20a4 100644 --- a/stream-chat-android-ui-components/src/main/res/values/strings_message_list.xml +++ b/stream-chat-android-ui-components/src/main/res/values/strings_message_list.xml @@ -40,10 +40,7 @@ %d Reply %d Replies - - %d Unread Message - %d Unread Messages - + Unread Messages Translated to %s