mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
feat(ui): retire Recent adverts home page, folded into Nodes
The Recent adverts carousel page was a read-only name+age list of recently-heard nodes — now covered by the Nodes screen (which folds getRecentlyHeard() non-contacts into its list). Remove it from the UX: - isPageVisible() hard-hides HomePage::RECENT, so it drops out of the carousel for everyone (default and custom page orders, existing users included). - Delete the dead RECENT render block, the nav "Recent adverts" alert and the unused AdvertPath recent[] member. - Drop HOME_RECENT from Settings > Home Pages so there's no dead toggle. HPB_RECENT bit index is left intact, so persisted page_order / home_pages_mask stay valid (a stored RECENT entry is simply skipped) — no migration, no schema bump. Both solo envs build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,7 @@ class SettingsScreen : public UIScreen {
|
||||
AD_SOUND_SCOPE,
|
||||
// Home pages section
|
||||
SECTION_HOME_PAGES,
|
||||
HOME_CLOCK, HOME_FAVOURITES, HOME_RECENT, HOME_RADIO, HOME_BT, HOME_ADVERT,
|
||||
HOME_CLOCK, HOME_FAVOURITES, HOME_RADIO, HOME_BT, HOME_ADVERT,
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
HOME_GPS,
|
||||
#endif
|
||||
@@ -217,8 +217,8 @@ class SettingsScreen : public UIScreen {
|
||||
}
|
||||
|
||||
bool isHomePage(int item) const {
|
||||
return item == HOME_CLOCK || item == HOME_RECENT || item == HOME_RADIO ||
|
||||
item == HOME_BT || item == HOME_ADVERT || item == HOME_TOOLS ||
|
||||
return item == HOME_CLOCK || item == HOME_RADIO || item == HOME_BT ||
|
||||
item == HOME_ADVERT || item == HOME_TOOLS ||
|
||||
item == HOME_SHUTDOWN || item == HOME_SETTINGS || item == HOME_QUICK_MSG ||
|
||||
item == HOME_FAVOURITES || item == HOME_MAP
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
@@ -260,7 +260,6 @@ class SettingsScreen : public UIScreen {
|
||||
int homePageBitIndex(int item) const {
|
||||
if (item == HOME_CLOCK) return NodePrefs::HPB_CLOCK;
|
||||
if (item == HOME_FAVOURITES) return NodePrefs::HPB_FAVOURITES;
|
||||
if (item == HOME_RECENT) return NodePrefs::HPB_RECENT;
|
||||
if (item == HOME_RADIO) return NodePrefs::HPB_RADIO;
|
||||
if (item == HOME_BT) return NodePrefs::HPB_BLUETOOTH;
|
||||
if (item == HOME_ADVERT) return NodePrefs::HPB_ADVERT;
|
||||
|
||||
@@ -342,7 +342,6 @@ class HomeScreen : public UIScreen {
|
||||
NodePrefs* _node_prefs;
|
||||
uint8_t _page;
|
||||
bool _shutdown_init;
|
||||
AdvertPath recent[UI_RECENT_LIST_SIZE];
|
||||
|
||||
int pageBit(int page) const {
|
||||
if (page == CLOCK) return NodePrefs::HPB_CLOCK;
|
||||
@@ -389,6 +388,7 @@ class HomeScreen : public UIScreen {
|
||||
}
|
||||
|
||||
bool isPageVisible(int page) const {
|
||||
if (page == RECENT) return false; // Recent adverts folded into Nearby Nodes; page retired
|
||||
int bit = pageBit(page);
|
||||
if (bit < 0) return true;
|
||||
uint16_t mask = (_node_prefs && _node_prefs->home_pages_mask) ? _node_prefs->home_pages_mask : NodePrefs::HP_ALL;
|
||||
@@ -919,31 +919,6 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (_page == HomePage::RECENT) {
|
||||
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE);
|
||||
display.setColor(DisplayDriver::LIGHT);
|
||||
int y = content_y;
|
||||
for (int i = 0; i < UI_RECENT_LIST_SIZE; i++, y += step) {
|
||||
auto a = &recent[i];
|
||||
if (a->name[0] == 0) continue; // empty slot
|
||||
int secs = _rtc->getCurrentTime() - a->recv_timestamp;
|
||||
if (secs < 60) {
|
||||
snprintf(tmp, sizeof(tmp),"%ds", secs);
|
||||
} else if (secs < 60*60) {
|
||||
snprintf(tmp, sizeof(tmp),"%dm", secs / 60);
|
||||
} else {
|
||||
snprintf(tmp, sizeof(tmp),"%dh", secs / (60*60));
|
||||
}
|
||||
|
||||
int timestamp_width = display.getTextWidth(tmp);
|
||||
int max_name_width = display.width() - timestamp_width - 1;
|
||||
|
||||
char filtered_recent_name[sizeof(a->name)];
|
||||
display.translateUTF8ToBlocks(filtered_recent_name, a->name, sizeof(filtered_recent_name));
|
||||
display.drawTextEllipsized(0, y, max_name_width, filtered_recent_name);
|
||||
display.setCursor(display.width() - timestamp_width - 1, y);
|
||||
display.print(tmp);
|
||||
}
|
||||
} else if (_page == HomePage::RADIO) {
|
||||
display.setColor(DisplayDriver::LIGHT);
|
||||
// freq / sf
|
||||
@@ -1362,9 +1337,6 @@ public:
|
||||
}
|
||||
if (c == KEY_NEXT || c == KEY_RIGHT) {
|
||||
_page = navPage(_page, +1);
|
||||
if (_page == HomePage::RECENT) {
|
||||
_task->showAlert("Recent adverts", 800);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (c == KEY_ENTER && _page == HomePage::BLUETOOTH) {
|
||||
|
||||
Reference in New Issue
Block a user