diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt index 9bd2753fb..acbc4b65f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt @@ -84,8 +84,8 @@ private fun DisplayEvent( noteBase?.let { val noteState by it.live().metadata.observeAsState() - val note = noteState?.note ?: return - val channel = note.channel() + val note = remember(noteState) { noteState?.note } ?: return + val channel = remember(noteState) { note.channel() } if (note.event is ChannelCreateEvent) { CreateClickableText( @@ -105,7 +105,7 @@ private fun DisplayEvent( CreateClickableText( clickablePart = channel.toBestDisplayName(), suffix = "${nip19.additionalChars} ", - route = "Channel/${note.channel()?.idHex}", + route = "Channel/${channel.idHex}", navController = navController ) } else { @@ -196,7 +196,7 @@ private fun DisplayAddress( noteBase?.let { val noteState by it.live().metadata.observeAsState() - val note = noteState?.note ?: return + val note = remember(noteState) { noteState?.note } ?: return CreateClickableText( clickablePart = "@${note.idDisplayNote()}", diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt index c63ad607b..d45180015 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt @@ -82,10 +82,15 @@ fun MultiSetCompose(multiSetCard: MultiSetCard, routeForLastRead: String, accoun } } - val backgroundColor = if (isNew) { - MaterialTheme.colors.primary.copy(0.12f).compositeOver(MaterialTheme.colors.background) - } else { - MaterialTheme.colors.background + val primaryColor = MaterialTheme.colors.primary.copy(0.12f) + val defaultBackgroundColor = MaterialTheme.colors.background + + val backgroundColor = remember(isNew) { + if (isNew) { + primaryColor.compositeOver(defaultBackgroundColor) + } else { + defaultBackgroundColor + } } val columnModifier = remember(isNew) { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt index defb4810d..4940819b7 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt @@ -19,6 +19,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -34,7 +35,7 @@ import com.vitorpamplona.amethyst.model.UserMetadata import com.vitorpamplona.amethyst.service.Nip05Verifier import com.vitorpamplona.amethyst.ui.theme.Nip05 import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext +import kotlinx.coroutines.launch import java.util.Date @Composable @@ -50,9 +51,11 @@ fun nip05VerificationAsAState(user: UserMetadata, pubkeyHex: String): State Nip05Verifier().verifyNip05( nip05, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index ffc3d80b3..82d9bdf27 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -1169,12 +1169,14 @@ private fun FirstUserInfoRow( @Composable fun TimeAgo(time: Long) { val context = LocalContext.current - var timeStr by remember { mutableStateOf("") } LaunchedEffect(key1 = time) { withContext(Dispatchers.IO) { - timeStr = timeAgo(time, context = context) + val newTimeStr = timeAgo(time, context = context) + if (newTimeStr != timeStr) { + timeStr = newTimeStr + } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 1f8b86ab7..f4fbf8f41 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -352,10 +352,13 @@ fun ZapReaction( scope.launch(Dispatchers.IO) { if (!wasZappedByLoggedInUser) { wasZappedByLoggedInUser = accountViewModel.calculateIfNoteWasZappedByAccount(zappedNote) - zappingProgress = 1f } zapAmountTxt = showAmount(account.calculateZappedAmount(zappedNote)) + + if (wasZappedByLoggedInUser) { + zappingProgress = 1f + } } }