mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-01 01:36:12 +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
@@ -860,8 +860,27 @@ public:
|
||||
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_ENTER) {
|
||||
// Phase 2/3 wires this: open DM if filled, picker if empty. Consume for now.
|
||||
_task->showAlert("Pin from contact options", 1000);
|
||||
// Filled slot → open the DM directly. Empty slot waits for phase 3
|
||||
// (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;
|
||||
}
|
||||
// Edge LEFT/RIGHT and unhandled keys fall through to page nav below.
|
||||
@@ -1046,6 +1065,12 @@ void UITask::gotoQuickMsgScreen() {
|
||||
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) {
|
||||
_last_notif_ch_idx = (int)channel_idx;
|
||||
((QuickMsgScreen*)quick_msg)->addChannelMsg(channel_idx, text);
|
||||
|
||||
Reference in New Issue
Block a user