fix(chat): address mark-as-unread double-pop and missed map entry point

- Remove stray Navigator.pop(context) in _markAsUnread for both contact
  and channel chats so the action no longer exits the conversation
- Thread initialUnreadCount through map discovered-contact "Open Chat"
  button so the unread divider/jump still fires from that entry point

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
zjs81
2026-04-27 13:07:16 -07:00
parent f10aeaeba8
commit 0e5f1a45c4
3 changed files with 6 additions and 3 deletions
-1
View File
@@ -400,7 +400,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
if (found && !m.isOutgoing) count++;
}
connector.setChannelUnreadCount(widget.channel.index, count);
Navigator.pop(context);
}
Widget _buildMessageBubble(ChannelMessage message, double textScale) {
-1
View File
@@ -543,7 +543,6 @@ class _ChatScreenState extends State<ChatScreen> {
if (found && !m.isOutgoing && !m.isCli) count++;
}
connector.setContactUnreadCount(widget.contact.publicKeyHex, count);
Navigator.pop(context);
}
Widget _buildInputBar(MeshCoreConnector connector) {
+6 -1
View File
@@ -1463,11 +1463,16 @@ class _MapScreenState extends State<MapScreen> {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
final unread =
connector.getUnreadCountForContactKey(contact.publicKeyHex);
Navigator.pop(dialogContext);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChatScreen(contact: contact),
builder: (context) => ChatScreen(
contact: contact,
initialUnreadCount: unread,
),
),
);
},