mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 18:56:15 +00:00
refactor(QuickMsgScreen): extract markReadAlert() helper
Deduplicate the snprintf+showAlert pattern used in three mark-as-read sites into a single private method. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
fec4828124
commit
9aadce2262
@@ -551,6 +551,12 @@ public:
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void markReadAlert(int n) {
|
||||||
|
char msg[32];
|
||||||
|
snprintf(msg, sizeof(msg), "%d marked read", n);
|
||||||
|
_task->showAlert(msg, 800);
|
||||||
|
}
|
||||||
|
|
||||||
void clearAllChannelUnread() {
|
void clearAllChannelUnread() {
|
||||||
memset(_ch_unread, 0, sizeof(_ch_unread));
|
memset(_ch_unread, 0, sizeof(_ch_unread));
|
||||||
}
|
}
|
||||||
@@ -1116,9 +1122,7 @@ public:
|
|||||||
cleared = _task->getRoomUnreadCount();
|
cleared = _task->getRoomUnreadCount();
|
||||||
_task->clearRoomUnread();
|
_task->clearRoomUnread();
|
||||||
}
|
}
|
||||||
char msg[32];
|
markReadAlert(cleared);
|
||||||
snprintf(msg, sizeof(msg), "%d marked read", cleared);
|
|
||||||
_task->showAlert(msg, 800);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1199,9 +1203,7 @@ public:
|
|||||||
if (sel == 0) {
|
if (sel == 0) {
|
||||||
int cleared = (int)_task->getDMUnread(ci.id.pub_key);
|
int cleared = (int)_task->getDMUnread(ci.id.pub_key);
|
||||||
_task->clearDMUnread(ci.id.pub_key);
|
_task->clearDMUnread(ci.id.pub_key);
|
||||||
char msg[32];
|
markReadAlert(cleared);
|
||||||
snprintf(msg, sizeof(msg), "%d marked read", cleared);
|
|
||||||
_task->showAlert(msg, 800);
|
|
||||||
} else if (sel == 3) {
|
} else if (sel == 3) {
|
||||||
// Pin / Unpin
|
// Pin / Unpin
|
||||||
int pinned_slot = _task->findFavouriteSlot(ci.id.pub_key);
|
int pinned_slot = _task->findFavouriteSlot(ci.id.pub_key);
|
||||||
@@ -1333,9 +1335,7 @@ public:
|
|||||||
if (sel == 0) {
|
if (sel == 0) {
|
||||||
int cleared = (int)_ch_unread[ch_idx];
|
int cleared = (int)_ch_unread[ch_idx];
|
||||||
_ch_unread[ch_idx] = 0;
|
_ch_unread[ch_idx] = 0;
|
||||||
char msg[32];
|
markReadAlert(cleared);
|
||||||
snprintf(msg, sizeof(msg), "%d marked read", cleared);
|
|
||||||
_task->showAlert(msg, 800);
|
|
||||||
}
|
}
|
||||||
// sel 1/2/3 already handled by LEFT/RIGHT; ENTER just closes.
|
// sel 1/2/3 already handled by LEFT/RIGHT; ENTER just closes.
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user