Unread badges per category + context menu stays open on action

- newMsg() now takes contact_type; room server messages (ADV_TYPE_ROOM)
  tracked separately in _room_unread; DM badge = msgCount - roomUnread
- MODE_SELECT shows unread badges for all 3 rows: DM, Channels, Rooms
- Room unread cleared when user opens Room Servers list or msgRead(0)
- Channel context menu: ENTER performs action but stays open; only
  CANCEL (Back button) closes it so user can see the updated state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-13 21:09:47 +02:00
co-authored by Claude Sonnet 4.6
parent 1a1cda4a1a
commit 158bbf74c8
4 changed files with 22 additions and 9 deletions
+5 -1
View File
@@ -36,6 +36,7 @@ class UITask : public AbstractUITask {
char _alert[80];
unsigned long _alert_expiry;
int _msgcount;
int _room_unread;
int _last_notif_ch_idx;
unsigned long ui_started_at, next_batt_chck;
uint16_t _batt_mv; // EMA-filtered battery voltage
@@ -73,6 +74,7 @@ public:
next_batt_chck = _next_refresh = 0;
ui_started_at = 0;
_batt_mv = 0;
_msgcount = _room_unread = 0;
_last_notif_ch_idx = -1;
curr = NULL;
}
@@ -87,6 +89,8 @@ public:
void addChannelMsg(uint8_t channel_idx, const char* text) override;
int getMsgCount() const { return _msgcount; }
int getChannelUnreadCount() const;
int getRoomUnreadCount() const { return _room_unread; }
void clearRoomUnread() { _room_unread = 0; }
bool hasDisplay() const { return _display != NULL; }
bool isButtonPressed() const;
@@ -114,7 +118,7 @@ public:
// from AbstractUITask
void msgRead(int msgcount) override;
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) override;
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount, uint8_t contact_type = 0) override;
void notify(UIEventType t = UIEventType::none) override;
void loop() override;