fix(ui): refuse adding a channel whose secret already exists

The on-device "+ Add channel" flow (Public quick-add, Hashtag, Private) wrote
to the first free slot with no check, so a second Public -- or any channel
already present -- could be added, giving the same on-air channel two list
entries with split history/unread state. A channel's identity is its secret,
not its name, so ChannelsView now rejects a save whose 16-byte secret is held
by a different slot. Edit skips its own slot, so renaming still works. Public
quick-add says "Already added"; the forms say "Channel already exists" and stay
open. App-side CMD_SET_CHANNEL and already-saved duplicates are untouched.

Verified: sim_companion_radio builds; in the WASM sim, adding Public with
Public present shows the alert and leaves one entry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-19 13:01:41 +02:00
co-authored by Claude Sonnet 5
parent 461107e31e
commit b3e3bae21b
2 changed files with 18 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@
### Fixes
- **Long messages no longer stretch their chat bubble across the whole row**, which hid which side a message came from. A bubble now always leaves a gutter on the side away from its sender — on the left for your own messages, on the right for received ones — and long text wraps a little earlier to fit.
- **The same channel could be added twice from the device.** "+ Add channel" happily saved a second copy of Public (or of any channel you already had), which is the same channel listed twice with split history and unread counts. Adding a channel whose key already exists is now refused ("Already added" / "Channel already exists"); renaming an existing channel still works. Duplicates you already have are left alone.
- **Upgrading from a very old firmware** (one that predates several past settings-layout changes) no longer runs a chain of one-time migrations on first boot: the few settings they used to backfill now start at today's plain defaults, the same as a fresh device. Current-version upgrades are unaffected.
- **Heltec V3/V4 with a wired joystick: Enter felt laggy and unreliable.** The Enter contact had no internal pull-up and buffered every click for ~280 ms waiting for a double/triple click that the joystick code ignores, so a quick double-tap was silently dropped. It's now wired like the direction and Back contacts. Boards without a joystick are unaffected.
- **Every altitude reading (baro + GPS, Clock and Lock screen) and the GPS home page's "alt" row now respect Settings › System › Units**, same as every other distance in the UI — none of them checked metric/imperial before. Locator's Radius row had the same gap and is fixed the same way.