mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-26 20:56:37 +00:00
fix(mesh): don't mark our own channel post as unread
An app-originated channel send (mirrored into the on-device history) bumped that channel's unread badge whenever the device's own UI wasn't already showing that exact channel -- unlike an on-device compose, which sidesteps this by forcing itself into that channel's view right before sending. Adds an explicit own_message flag through addChannelMsg (MessageHistory -> AbstractUITask -> UITask -> MessagesScreen) so an own post is never counted unread regardless of what's on screen when it's sent. Found the same bug in MyMeshBot.h's three auto-reply-into-channel call sites (Remote Bot's own reply showing as unread on itself) and fixed those with the same mechanism. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -202,7 +202,7 @@ void MyMesh::tryBotReplyChannel(uint8_t channel_idx, const char* text, uint8_t h
|
||||
if (_ui) {
|
||||
char with_sender[240]; // node_name(32) + ": "(2) + expanded(200) + margin
|
||||
snprintf(with_sender, sizeof(with_sender), "%s: %s", _prefs.node_name, expanded);
|
||||
_ui->addChannelMsg(channel_idx, with_sender);
|
||||
_ui->addChannelMsg(channel_idx, with_sender, 0, nullptr, 0, true); // own_message: our own bot reply, never unread
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -499,7 +499,7 @@ bool MyMesh::tryBotChannelCommand(uint8_t channel_idx, const char* text, uint8_t
|
||||
if (_ui) {
|
||||
char with_sender[240];
|
||||
snprintf(with_sender, sizeof(with_sender), "%s: %s", _prefs.node_name, out);
|
||||
_ui->addChannelMsg(channel_idx, with_sender);
|
||||
_ui->addChannelMsg(channel_idx, with_sender, 0, nullptr, 0, true); // own_message: our own bot reply, never unread
|
||||
}
|
||||
#endif
|
||||
if (_locfix_requested) startLocFix(LOCFIX_DEST_CHANNEL, nullptr, channel_idx);
|
||||
@@ -658,7 +658,7 @@ void MyMesh::sendLocFixResult(const char* msg) {
|
||||
if (_ui) {
|
||||
char with_sender[240];
|
||||
snprintf(with_sender, sizeof(with_sender), "%s: %s", _prefs.node_name, msg);
|
||||
_ui->addChannelMsg(_loc_fix.channel_idx, with_sender);
|
||||
_ui->addChannelMsg(_loc_fix.channel_idx, with_sender, 0, nullptr, 0, true); // own_message: our own bot reply, never unread
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user