mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
Merge branch 'wio-tracker-l1-improvements' into wio-eink-unified
This commit is contained in:
@@ -250,6 +250,21 @@ class QuickMsgScreen : public UIScreen {
|
||||
if (!show_all && !(c.flags & 0x01)) continue;
|
||||
_sorted[_num_contacts++] = i;
|
||||
}
|
||||
// Sort by message count descending; contacts with no messages keep original order.
|
||||
int counts[MAX_CONTACTS];
|
||||
for (int i = 0; i < _num_contacts; i++) {
|
||||
the_mesh.getContactByIdx(_sorted[i], c);
|
||||
counts[i] = dmHistCountForContact(c.id.pub_key);
|
||||
}
|
||||
for (int i = 1; i < _num_contacts; i++) {
|
||||
if (counts[i] == 0) continue;
|
||||
uint16_t key = _sorted[i]; int kc = counts[i];
|
||||
int j = i;
|
||||
while (j > 0 && counts[j-1] < kc) {
|
||||
_sorted[j] = _sorted[j-1]; counts[j] = counts[j-1]; j--;
|
||||
}
|
||||
_sorted[j] = key; counts[j] = kc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user