fix(ui/favourites): DM unread badge cleared by companion app sync

msgRead(0) was called when the companion app read the last message from
the offline queue, and it erased the entire _dm_unread_table. This wiped
Favourites Dial badges the moment the app synced — leaving a 3-second
window (the alert duration) where the badge was faintly visible behind
the incoming-message popup, then gone.

_dm_unread_table tracks per-contact UI state (Favourites Dial badges,
contact list counters). It should only be cleared by user action:
clearDMUnread (opens a DM) or clearAllDMUnread (mark-all-read). It has
no relationship to the offline queue drain state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-29 11:11:57 +02:00
parent 0e0e5b938a
commit f6d10bb8b2

View File

@@ -1344,7 +1344,9 @@ void UITask::msgRead(int msgcount) {
_msgcount = msgcount;
if (msgcount == 0) {
_room_unread = 0;
memset(_dm_unread_table, 0, sizeof(_dm_unread_table));
// Do NOT clear _dm_unread_table here — it tracks per-contact UI badges
// independently of the offline queue. Badges are cleared only when the
// user opens the DM (clearDMUnread) or explicitly marks all read.
((QuickMsgScreen*)quick_msg)->clearAllChannelUnread();
}
}