mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 00:16:59 +00:00
fix(marmot): don't mark own messages unread + pad empty group list
- `MarmotGroupList.addMessage` now routes self-authored messages through `restoreMessageSync` (the no-unread-bump path) so the relay round-trip of a message the user just sent doesn't show up as an unread bold entry in the group list and doesn't bump the unread badge counter. - `MarmotGroupListScreen` empty state now has 32dp horizontal padding and centered text alignment so the "No invitations" / "No groups yet" copy doesn't run into the screen edges.
This commit is contained in:
+6
-1
@@ -148,13 +148,17 @@ fun MarmotGroupListScreen(
|
||||
|
||||
if (visibleGroups.isEmpty()) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 32.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(
|
||||
text = if (selectedTab == 0) "No groups yet" else "No invitations",
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Text(
|
||||
text =
|
||||
@@ -165,6 +169,7 @@ fun MarmotGroupListScreen(
|
||||
},
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.padding(top = 4.dp),
|
||||
)
|
||||
}
|
||||
|
||||
+11
-2
@@ -46,8 +46,17 @@ class MarmotGroupList(
|
||||
msg: Note,
|
||||
) {
|
||||
val chatroom = getOrCreateGroup(nostrGroupId)
|
||||
if (chatroom.addMessageSync(msg)) {
|
||||
if (msg.author?.pubkeyHex == ownerPubKey) {
|
||||
val isSelfAuthored = msg.author?.pubkeyHex == ownerPubKey
|
||||
// Use the quiet path for our own messages so the relay round-trip
|
||||
// doesn't mark the user's own outgoing message as unread.
|
||||
val added =
|
||||
if (isSelfAuthored) {
|
||||
chatroom.restoreMessageSync(msg)
|
||||
} else {
|
||||
chatroom.addMessageSync(msg)
|
||||
}
|
||||
if (added) {
|
||||
if (isSelfAuthored) {
|
||||
chatroom.ownerSentMessage = true
|
||||
}
|
||||
_groupListChanges.tryEmit(nostrGroupId)
|
||||
|
||||
Reference in New Issue
Block a user