Skip to content

Extract shared node helpers, add Room management UI#270

Merged
Avi0n merged 4 commits into
devfrom
refactor/room-repeater-shared-helpers
Mar 27, 2026
Merged

Extract shared node helpers, add Room management UI#270
Avi0n merged 4 commits into
devfrom
refactor/room-repeater-shared-helpers

Conversation

@Avi0n
Copy link
Copy Markdown
Owner

@Avi0n Avi0n commented Mar 27, 2026

Summary

Repeater and Room node management shared most of their settings/status logic but had separate implementations. This PR extracts the common parts into shared helpers, then builds Room management on top of them.

Also fixes two bugs where the Swift validation didn't match what the firmware actually accepts.

43 files changed, +3893 −2155 (net −1025 lines with the Room UI included).

What changed

New shared helpers:

  • NodeSettingsHelper — radio, identity, contact, security, behavior validation, password change
  • NodeStatusHelper — status/telemetry response handling and snapshot persistence
  • SharedNodeViews — 14 extracted SwiftUI components used by both Room and Repeater

New Room management:

  • RoomSettingsView / RoomSettingsViewModel — guest password, allow-read-only, behavior config
  • RoomStatusView / RoomStatusViewModel — post counts (postedCount/postPushCount as UInt16)
  • RoomAdminService — mirrors RepeaterAdminService

Bug fixes (both pre-existing, found by diffing against CommonCLI.cpp):

  • flood.advert.interval validation was 3–48h. Firmware accepts 0 (disabled) and 3–168h. Fixed validation and all 9 locale strings.
  • password command: firmware echoes "password now: {pw}" on success, not "OK". The app was showing "password change failed" even though it worked. Now recognizes the echo as success.

Cleanup:

  • Removed dead handler methods and repeaterAdminService from MessageEventBroadcaster
  • Extracted NodeActionRows in ContactDetailView (Room/Repeater cases were copy-pasted)
  • clearHandlers() instead of no-op closure assignment
  • Wired up unused allowReadOnlyFooter L10n key
  • DeviceInfo section now in position 2 for both Room and Repeater settings
  • ExpandableSettingsSection: error: Binding<String?>hasError: Binding<Bool>

Test plan

  • Builds on iPhone 17e simulator
  • Unit tests pass (MC1Tests, MC1ServicesTests)
  • Repeater settings/status views work the same as before
  • Room settings loads and saves config (guest password, allow-read-only, behavior)
  • Room status shows post counts, telemetry, battery curve
  • Password change on Room and Repeater shows success, not failure
  • Flood advert interval accepts 0 and values up to 168

…t UI

Extract shared node management logic from Repeater-specific views into
reusable helpers (NodeSettingsHelper, NodeStatusHelper, SharedNodeViews)
and create parallel Room management views with RoomAdminService.

Fix two pre-existing MeshCore spec alignment bugs:
- flood.advert.interval validation now accepts 0 (disabled) and 3-168h,
  matching firmware (was incorrectly limited to 3-48h)
- password change response now recognized as success when firmware echoes
  "password now: {pw}" instead of "OK"

Remove dead code from MessageEventBroadcaster (unused handler methods).
Consistent DeviceInfo section ordering across Room and Repeater settings.
@Avi0n Avi0n marked this pull request as draft March 27, 2026 19:14
Avi0n added 3 commits March 27, 2026 12:22
…d.only

- CLIResponse.parse() has no cases for these queries, so responses
  parsed as .raw and the content-based matcher silently discarded them,
  causing both fields to time out instead of loading
- switch to rawMatching: true (FIFO delivery) for these two commands
- align cleanup() with RepeaterSettingsViewModel: clear only the CLI
  handler instead of all three handlers via clearHandlers()
Radio → Behavior → Regions → Identity → Contact → Security → Device Info → Actions
- Firmware echoes "password now: {pw}" on success, which parses as
  .raw and gets discarded by the content-based matcher
- Same class of bug as guest.password and allow.read.only
@Avi0n Avi0n marked this pull request as ready for review March 27, 2026 20:12
@Avi0n Avi0n merged commit 06c59a8 into dev Mar 27, 2026
2 checks passed
@Avi0n Avi0n deleted the refactor/room-repeater-shared-helpers branch March 27, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant