mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-01 09:46:22 +00:00
feat(ui): open DM from filled Favourites tile
Enter on a populated slot of the Favourites grid now jumps straight into that contact's DM history — resolves the pinned 6-byte pub_key prefix against the contact list, then routes through new UITask::openContactDM(ci) which resets QuickMsgScreen and calls enterDM() to land directly in DM_HIST. Empty slots still show the "pin from contact options" hint until phase 3 wires the in-grid mini-picker. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
bee8e7c3dd
commit
fd37b84d71
@@ -473,6 +473,18 @@ public:
|
|||||||
_viewing_max_seen = 0;
|
_viewing_max_seen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Jump straight into a contact's DM history (used by the Favourites dial).
|
||||||
|
// Caller must have already reset() the screen.
|
||||||
|
void enterDM(const ContactInfo& ci) {
|
||||||
|
_sel_contact = ci;
|
||||||
|
_task->clearDMUnread(ci.id.pub_key);
|
||||||
|
_dm_hist_sel = -1;
|
||||||
|
_dm_hist_scroll = 0;
|
||||||
|
_dm_fs.active = false;
|
||||||
|
_room_mode = false;
|
||||||
|
_phase = DM_HIST;
|
||||||
|
}
|
||||||
|
|
||||||
int render(DisplayDriver& display) override {
|
int render(DisplayDriver& display) override {
|
||||||
display.setTextSize(1);
|
display.setTextSize(1);
|
||||||
display.setColor(DisplayDriver::LIGHT);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
|
|||||||
@@ -860,8 +860,27 @@ public:
|
|||||||
if (c == KEY_UP && row > 0) { _fav_sel -= cols; return true; }
|
if (c == KEY_UP && row > 0) { _fav_sel -= cols; return true; }
|
||||||
if (c == KEY_DOWN && row < rows - 1) { _fav_sel += cols; return true; }
|
if (c == KEY_DOWN && row < rows - 1) { _fav_sel += cols; return true; }
|
||||||
if (c == KEY_ENTER) {
|
if (c == KEY_ENTER) {
|
||||||
// Phase 2/3 wires this: open DM if filled, picker if empty. Consume for now.
|
// Filled slot → open the DM directly. Empty slot waits for phase 3
|
||||||
_task->showAlert("Pin from contact options", 1000);
|
// (mini-picker); for now show the pin hint.
|
||||||
|
NodePrefs* p = _task->getNodePrefs();
|
||||||
|
const uint8_t* pfx = (p && _fav_sel < NodePrefs::FAVOURITES_COUNT)
|
||||||
|
? p->favourite_contacts[_fav_sel] : nullptr;
|
||||||
|
bool filled = false;
|
||||||
|
if (pfx) for (uint8_t b = 0; b < NodePrefs::FAVOURITE_PREFIX_LEN; b++)
|
||||||
|
if (pfx[b]) { filled = true; break; }
|
||||||
|
if (filled) {
|
||||||
|
for (int idx = 0; ; idx++) {
|
||||||
|
ContactInfo c2;
|
||||||
|
if (!the_mesh.getContactByIdx(idx, c2)) break;
|
||||||
|
if (memcmp(c2.id.pub_key, pfx, NodePrefs::FAVOURITE_PREFIX_LEN) == 0) {
|
||||||
|
_task->openContactDM(c2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_task->showAlert("Contact not found", 800);
|
||||||
|
} else {
|
||||||
|
_task->showAlert("Pin from contact options", 1000);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Edge LEFT/RIGHT and unhandled keys fall through to page nav below.
|
// Edge LEFT/RIGHT and unhandled keys fall through to page nav below.
|
||||||
@@ -1046,6 +1065,12 @@ void UITask::gotoQuickMsgScreen() {
|
|||||||
setCurrScreen(quick_msg);
|
setCurrScreen(quick_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UITask::openContactDM(const ContactInfo& ci) {
|
||||||
|
((QuickMsgScreen*)quick_msg)->reset();
|
||||||
|
((QuickMsgScreen*)quick_msg)->enterDM(ci);
|
||||||
|
setCurrScreen(quick_msg);
|
||||||
|
}
|
||||||
|
|
||||||
void UITask::addChannelMsg(uint8_t channel_idx, const char* text) {
|
void UITask::addChannelMsg(uint8_t channel_idx, const char* text) {
|
||||||
_last_notif_ch_idx = (int)channel_idx;
|
_last_notif_ch_idx = (int)channel_idx;
|
||||||
((QuickMsgScreen*)quick_msg)->addChannelMsg(channel_idx, text);
|
((QuickMsgScreen*)quick_msg)->addChannelMsg(channel_idx, text);
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ public:
|
|||||||
void gotoHomeScreen() { setCurrScreen(home); }
|
void gotoHomeScreen() { setCurrScreen(home); }
|
||||||
void gotoSettingsScreen();
|
void gotoSettingsScreen();
|
||||||
void gotoQuickMsgScreen();
|
void gotoQuickMsgScreen();
|
||||||
|
void openContactDM(const ContactInfo& ci);
|
||||||
void gotoToolsScreen();
|
void gotoToolsScreen();
|
||||||
void gotoRingtoneEditor(int slot = 0);
|
void gotoRingtoneEditor(int slot = 0);
|
||||||
void gotoBotScreen();
|
void gotoBotScreen();
|
||||||
|
|||||||
Reference in New Issue
Block a user