From 74df3333ef7fcf064f1892400613612eea37ab29 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 27 Jan 2023 13:41:54 -0300 Subject: [PATCH] Fixes replying information --- .../amethyst/ui/note/ReplyInformation.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt index ad405025e..aaa78692a 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReplyInformation.kt @@ -41,7 +41,9 @@ fun ReplyInformation(replyTo: MutableList?, mentions: List?, prefix: color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) ) - mentions.toSet().forEachIndexed { idx, user -> + val mentionSet = mentions.toSet() + + mentionSet.toSet().forEachIndexed { idx, user -> val innerUserState by user.live.observeAsState() val innerUser = innerUserState?.user @@ -52,13 +54,13 @@ fun ReplyInformation(replyTo: MutableList?, mentions: List?, prefix: onClick = { onUserTagClick(myUser) } ) - if (idx < mentions.size - 2) { + if (idx < mentionSet.size - 2) { Text( ", ", fontSize = 13.sp, color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) ) - } else if (idx < mentions.size - 1) { + } else if (idx < mentionSet.size - 1) { Text( " and ", fontSize = 13.sp, @@ -115,7 +117,9 @@ fun ReplyInformationChannel(replyTo: MutableList?, color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) ) - mentions.toSet().forEachIndexed { idx, user -> + val mentionSet = mentions.toSet() + + mentionSet.forEachIndexed { idx, user -> val innerUserState by user.live.observeAsState() val innerUser = innerUserState?.user @@ -126,13 +130,13 @@ fun ReplyInformationChannel(replyTo: MutableList?, onClick = { onUserTagClick(myUser) } ) - if (idx < mentions.size - 2) { + if (idx < mentionSet.size - 2) { Text( ", ", fontSize = 13.sp, color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) ) - } else if (idx < mentions.size - 1) { + } else if (idx < mentionSet.size - 1) { Text( " and ", fontSize = 13.sp,