mirror of
https://github.com/pelgraine/Meck.git
synced 2026-03-28 17:42:44 +01:00
sync new message message read or unread notification display better between device ui and ble app; keep in channel after message sent, moved sent toaster popup to in channel
This commit is contained in:
@@ -48,6 +48,9 @@ public:
|
||||
virtual void forceRefresh() {}
|
||||
virtual void addSentChannelMessage(uint8_t channel_idx, const char* sender, const char* text) {}
|
||||
|
||||
// Mark a channel as read when BLE companion app syncs a message
|
||||
virtual void markChannelReadFromBLE(uint8_t channel_idx) {}
|
||||
|
||||
// Repeater admin callbacks (from MyMesh)
|
||||
virtual void onAdminLoginResult(bool success, uint8_t permissions, uint32_t server_time) {}
|
||||
virtual void onAdminCliResponse(const char* from_name, const char* text) {}
|
||||
|
||||
@@ -1410,7 +1410,19 @@ void MyMesh::handleCmdFrame(size_t len) {
|
||||
if ((out_len = getFromOfflineQueue(out_frame)) > 0) {
|
||||
_serial->writeFrame(out_frame, out_len);
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (_ui) _ui->msgRead(offline_queue_len);
|
||||
if (_ui) {
|
||||
_ui->msgRead(offline_queue_len);
|
||||
|
||||
// Mark channel as read when BLE companion app syncs the message.
|
||||
// Frame layout V3: [resp_code][snr][res1][res2][channel_idx][path_len]...
|
||||
// Frame layout V1: [resp_code][channel_idx][path_len]...
|
||||
bool is_v3_ch = (out_frame[0] == RESP_CODE_CHANNEL_MSG_RECV_V3);
|
||||
bool is_old_ch = (out_frame[0] == RESP_CODE_CHANNEL_MSG_RECV);
|
||||
if (is_v3_ch || is_old_ch) {
|
||||
uint8_t ch_idx = is_v3_ch ? out_frame[4] : out_frame[1];
|
||||
_ui->markChannelReadFromBLE(ch_idx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
out_frame[0] = RESP_CODE_NO_MORE_MESSAGES;
|
||||
|
||||
@@ -1156,7 +1156,7 @@ void handleKeyboardInput() {
|
||||
if (wasDM) {
|
||||
ui_task.gotoContactsScreen();
|
||||
} else {
|
||||
ui_task.gotoHomeScreen();
|
||||
ui_task.gotoChannelScreen();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1176,7 +1176,7 @@ void handleKeyboardInput() {
|
||||
if (wasDM) {
|
||||
ui_task.gotoContactsScreen();
|
||||
} else {
|
||||
ui_task.gotoHomeScreen();
|
||||
ui_task.gotoChannelScreen();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <MeshCore.h>
|
||||
|
||||
// Forward declarations
|
||||
class UITask;
|
||||
#include "../AbstractUITask.h"
|
||||
class MyMesh;
|
||||
extern MyMesh the_mesh;
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
UITask* _task;
|
||||
AbstractUITask* _task;
|
||||
mesh::RTCClock* _rtc;
|
||||
|
||||
AdminState _state;
|
||||
@@ -421,7 +421,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
RepeaterAdminScreen(UITask* task, mesh::RTCClock* rtc)
|
||||
RepeaterAdminScreen(AbstractUITask* task, mesh::RTCClock* rtc)
|
||||
: _task(task), _rtc(rtc), _state(STATE_PASSWORD_ENTRY),
|
||||
_contactIdx(-1), _permissions(0), _serverTime(0),
|
||||
_pwdLen(0), _lastCharAt(0),
|
||||
|
||||
@@ -1486,6 +1486,12 @@ void UITask::addSentChannelMessage(uint8_t channel_idx, const char* sender, cons
|
||||
((ChannelScreen *) channel_screen)->addMessage(channel_idx, 0, sender, formattedMsg);
|
||||
}
|
||||
|
||||
void UITask::markChannelReadFromBLE(uint8_t channel_idx) {
|
||||
((ChannelScreen *) channel_screen)->markChannelRead(channel_idx);
|
||||
// Trigger a refresh so the home screen unread count updates in real-time
|
||||
_next_refresh = millis() + 200;
|
||||
}
|
||||
|
||||
void UITask::gotoRepeaterAdmin(int contactIdx) {
|
||||
// Lazy-initialize on first use (same pattern as audiobook player)
|
||||
if (repeater_admin == nullptr) {
|
||||
|
||||
@@ -155,6 +155,9 @@ public:
|
||||
// Add a sent message to the channel screen history
|
||||
void addSentChannelMessage(uint8_t channel_idx, const char* sender, const char* text) override;
|
||||
|
||||
// Mark channel as read when BLE companion app syncs messages
|
||||
void markChannelReadFromBLE(uint8_t channel_idx) override;
|
||||
|
||||
// Repeater admin callbacks
|
||||
void onAdminLoginResult(bool success, uint8_t permissions, uint32_t server_time) override;
|
||||
void onAdminCliResponse(const char* from_name, const char* text) override;
|
||||
|
||||
Reference in New Issue
Block a user