fix: messages that arrive while asleep or locked stay unread

A conversation left open under the lock screen or a dark display no longer
counts as read: the counters and the lock screen's tally go up, and on
waking (L2: on unlocking) the conversation reopens on its first unread
under the "New" line, a typed draft kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-08 23:41:40 +02:00
co-authored by Claude Opus 5.5
parent 92e379e05c
commit e09a90b325
6 changed files with 57 additions and 5 deletions
@@ -1063,6 +1063,13 @@ public:
_dm_hist_scroll = 0;
_dm_fs.active = false;
}
// The display came back on over a conversation: what was filed while it was
// dark is unread -- read on from its first message, as on opening.
void onDisplayOn() {
if (_ctx_menu.active) return;
if (_phase == CHANNEL_HIST && !_fs.active && _history.chUnread(_sel_channel_idx) > 0) beginChannelView(_sel_channel_idx);
else if (_phase == DM_HIST && !_dm_fs.active && _task->getDMUnread(_sel_contact.id.pub_key) > 0) beginDmView();
}
void beginChannelView(uint8_t channel_idx) {
_sel_channel_idx = channel_idx;
_unread_at_entry = (int)_history.chUnread(channel_idx);