From b0b47d98a56d2d04ff4b3222e1f58ffededfa7da Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 6 Sep 2024 15:26:51 +0530 Subject: [PATCH] fix(common): handle pluralization for unread comments note --- .../dev/msfjarvis/claw/common/comments/CommentsPageImpl.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsPageImpl.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsPageImpl.kt index 208a40d8..349b2360 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsPageImpl.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsPageImpl.kt @@ -65,7 +65,11 @@ internal fun CommentsPageInternal( if (details.comments.isNotEmpty() && commentState.commentIds.isNotEmpty()) { val unreadCount = details.comments.size - commentState.commentIds.size if (unreadCount > 0) { - val text = "$unreadCount unread comments" + val text = + when (unreadCount) { + 1 -> "$unreadCount unread comment" + else -> "$unreadCount unread comments" + } Toast.makeText(context, text, Toast.LENGTH_SHORT).show() } }