diff --git a/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt b/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt index 72bd02b..ed3fe0d 100644 --- a/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt +++ b/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt @@ -1041,9 +1041,27 @@ class MessengerViewModel(app: Application) : AndroidViewModel(app) { } } result.onSuccess { sent -> + // ⚠️ The badge has to catch up on SUCCESS too, and this is the case + // that actually matters. Trust on first use pins the peer's keys + // during the send itself, so before the first message the header + // correctly says "No keys seen yet" — and without this it goes on + // saying it, with no safety number to read, until the user leaves + // the thread and comes back. The failure branch below already did + // this for the opposite reason; the pin is the more common one. + // + // Group threads have no single peer identity, so their trust is + // left alone rather than recomputed into something meaningless. + val peer = chat.peerId update { it.copy( - openChat = it.openChat?.copy(lines = current.history(chat.threadId)), + openChat = it.openChat?.copy(lines = current.history(chat.threadId)) + ?.let { open -> + if (peer == null) open + else open.copy( + trust = current.conversations.trust.state(peer), + safetyNumber = current.conversations.trust.safetyNumber(peer), + ) + }, // Partial delivery is stated, not hidden. "Sent" when one // of someone's three devices got it is a lie the user acts // on.