Commit Graph

42 Commits

Author SHA1 Message Date
James Rich
6450c69820 Add distance-based node filter
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:06 -05:00
James Rich
0b5791a61d refactor: remove getPacketId() from public interface
- Remove getPacketId() from MessageSender interface (SDK owns packet IDs)
- Remove requestId parameter from requestTraceroute/requestNeighborInfo
- Make getPacketId() private in SdkRadioController (still used internally
  for delivery tracking correlation)
- Replace radioController.getPacketId() in map with local Random.nextInt()
  for waypoint ID generation (only needs uniqueness, not SDK correlation)
- Remove messageSender dependency from CommonNodeRequestActions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
f4c6cee332 feat: typed telemetry dispatch + MeshTopology service
- Replace magic int dispatch in requestTelemetry with TelemetryType enum
- Update DataRequester interface: remove requestId param, use TelemetryType directly
- Add HEALTH and TRAFFIC_MANAGEMENT to TelemetryType, remove stale PAX variant
- Create MeshTopologyService wrapping SDK's MeshTopology with thread-safe Mutex
- Wire NeighborInfo packet ingestion in SdkStateBridge → topology graph
- Clear topology on node snapshot (reconnect)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
3fb45e05bd fix: architecture review P0/P1 fixes
- P0: setDeviceAddress now persists address to RadioPrefs before reconnect
- P0: Document nodedbReset firmware limitation (preserveFavorites is local-only)
- P1: Add writeAction helper for AdminException → sendError in RadioConfigViewModel
- P1: Wrap CommonNodeRequestActions scope.launch with runCatching for crash safety
- P1: Create CongestionLevel typealias in core/model to decouple feature modules from SDK
- P1: Cancel prior loadJob in setResponseStateLoading to prevent stale results

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
140e062eee refactor: eliminate ProcessRadioResponseUseCase and packet-ID correlation
Replace the manual packet-ID tracking and meshPacketFlow subscription in
RadioConfigViewModel with direct typed returns from the SDK via
RadioConfigUseCase. The ViewModel now awaits typed results (User, Config,
ModuleConfig, channels, etc.) from suspend calls and maps AdminException
to UI error states.

Key changes:
- Delete ProcessRadioResponseUseCase (130 lines of manual proto decode)
- Remove requestIds state, registerRequestId, processPacketResponse,
  sendAdminRequest, and meshPacketFlow subscription from ViewModel
- Rewrite setResponseStateLoading to use direct coroutine calls
- Admin actions (reboot/shutdown/etc.) fire directly without session key
  preflight (SDK handles retryOnSessionExpiry transparently)
- All setters (setConfig, setModuleConfig, setOwner, updateChannels)
  no longer return/track packetIds
- Remove messageSender dependency from NodeManagementActions
- Update InstallProfileUseCase to use editSettings {} receiver pattern
- Update all callers: CleanNodeDatabaseUseCase, Esp32OtaUpdateHandler,
  NodeManagementActions
- Rewrite RadioConfigViewModelTest for new direct-await semantics
- Update RadioConfigUseCaseTest and InstallProfileUseCaseTest

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
7683db0c57 feat: deep SDK integration — retry delivery, Store-and-Forward API, congestion surfacing
I1 — RetryPolicy in MessageDeliveryTracker:
- track() now accepts optional RetryPolicy (default: ExponentialBackoff 3 attempts)
- Failed sends automatically retry before marking ERROR
- UI sees ENROUTE during retry attempts

I2 — Store-and-Forward SDK consumption:
- SdkStateBridge observes storeForward.events and servers
- ServiceRepository exposes storeForwardServers StateFlow
- SdkRadioController.requestStoreForwardHistory() delegates to SDK
- HistoryManagerImpl uses SDK path instead of manual packet construction

I3 — Congestion level surfacing:
- SdkStateBridge handles MeshEvent.CongestionWarning
- ServiceRepository.congestionLevel StateFlow exposed to UI
- Cleared on disconnect

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
296f27dc73 refactor: merge NodeManager into NodeRepository
Eliminate the vestigial NodeManager/NodeRepository interface split.
All runtime node state management methods (handleReceivedUser,
handleReceivedPosition, handleReceivedTelemetry, updateNode, etc.)
now live directly on NodeRepository alongside the query surface.

- Delete NodeManager.kt (82 LOC)
- Extend NodeRepository with NodeIdLookup and add all manager methods
- Update 8 consumers to inject NodeRepository instead of NodeManager
- Remove dead nodeManager param from MeshServiceOrchestrator
- Add NodeManager methods to FakeNodeRepository test double
- Update all tests (mocks, constructor params, verifications)
- SdkNodeRepositoryImpl now binds [NodeRepository, NodeIdLookup]

Build: assembleDebug , desktop:compileKotlin , all jvmTests 

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
e7d1767527 chore: remove ~220 LOC dead code from node layer
Delete dead methods from NodeManager/NodeRepository interfaces:
- allowNodeDbWrites, setAllowNodeDbWrites (never read)
- loadCachedNodeDB (no-op, zero-value call in orchestrator)
- getNodes(): List<NodeInfo> (deprecated, unused)
- handleReceivedPaxcounter (zero callers)
- handleReceivedNodeStatus, updateNodeStatus (zero callers)
- insertMetadata (zero production callers)

Delete NodeInfo data class (85 LOC):
- All consumers now use Node domain model directly
- Retained MeshUser, Position, DeviceMetrics, EnvironmentMetrics
  which have active consumers across feature modules

Remove corresponding implementations from SdkNodeRepositoryImpl,
FakeNodeRepository, and test verifications.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
551d4419a4 refactor: merge NodeManager into SdkNodeRepositoryImpl + restore MeshActivity
- Merge NodeManagerImpl logic into SdkNodeRepositoryImpl (single source
  of truth for all node state — eliminates duplicate in-memory maps)
- SdkNodeRepositoryImpl now binds NodeRepository, NodeManager, NodeIdLookup
- Delete NodeManagerImpl.kt (377 LOC)
- Add meshActivityFlow to ServiceRepository for nav-bar icon animation
- Emit MeshActivity.Send from SdkPacketHandler and SdkRadioController
- Emit MeshActivity.Receive from ServiceRepositoryImpl.emitMeshPacket()
- Wire UIViewModel.meshActivity to serviceRepository.meshActivityFlow
- Align insertMetadata signature (remove unnecessary suspend)
- Adapt NodeManagerImplTest to test SdkNodeRepositoryImpl directly
- Update FakeServiceRepository with meshActivityFlow stub

All targets compile clean (Android + Desktop), all tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
3cdad0da28 refactor: delete transport layer and dead intermediaries, slim RadioInterfaceService
- Delete entire transport layer: BleRadioTransport, TcpRadioTransport,
  SerialRadioTransport, StreamTransport, HeartbeatSender, StreamFrameCodec,
  AndroidRadioTransportFactory, BaseRadioTransportFactory, MockRadioTransport,
  NopRadioTransport, BleReconnectPolicy, TcpTransport, SerialTransport
- Delete MeshConfigHandler interface + impl (replaced by RadioConfigRepository)
- Delete RadioTransportCallback, RadioTransport, RadioTransportFactory interfaces
- Delete FakeRadioTransport, RadioTransportTest, MeshConfigHandlerImplTest
- Delete UseCase tests (impls restored, tests for deleted patterns removed)
- Slim RadioInterfaceService interface: remove transport internals, keep only
  device-address/connection surface needed by Scanner and connections UIs
- Create SdkRadioInterfaceService: thin SDK-backed impl delegating to
  RadioPrefs + RadioClientAccessor
- Update NoopRadioInterfaceService to match slimmed interface
- Update JvmUsbScanner to use SDK's JvmSerialPorts.list() instead of
  deleted SerialTransport.getAvailablePorts()
- Remove DesktopRadioTransportFactory from desktop DI module
- Fix NodeListViewModel: replace RadioInterfaceService with RadioPrefs
- Fix MeshServiceOrchestratorTest: align with updated constructor params
- Fix UIViewModel: use emptyFlow() for meshActivity (SDK doesn't emit
  raw transport-level activity events)

All targets compile clean, all JVM + Android unit tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
2de57a9e81 feat: align theme with Design Standards v1.3, remove contrast setting (#5355)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-04 16:10:06 -05:00
James Rich
5a95201b4e fix(connections): improve BLE scan reliability and UI lifecycle (#5329) 2026-05-02 14:25:40 +00:00
James Rich
400e0404f6 fix(data): default new-node notifications off for event firmware (#5323) 2026-05-02 02:02:30 +00:00
James Rich
e198f52de5 refactor(coroutines): migrate to kotlinx-coroutines 1.11.0-rc02 (#5312)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-01 03:11:22 +00:00
James Rich
2822290908 refactor(build): build-logic cleanup, CC safety, and detekt 2.0 upgrade (#5311) 2026-05-01 02:48:37 +00:00
James Rich
1966889c2d feat(connections): connection sorting & conversation empty channel ranking (#5295) 2026-04-29 17:18:57 +00:00
James Rich
0b873be228 fix(ble): unblock reconnect + kable audit (logging, priority, backoff, StateFlow) (#5222)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 18:35:22 -05:00
James Rich
228d872f9d feat(connections): unified device list, ACCESS_LOCAL_NETWORK, transport filter chips (#5219)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 19:34:22 +00:00
James Rich
58eeef1152 feat(service): send polite ToRadio(disconnect=true) before transport close (#5210)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 11:04:29 -05:00
James Rich
f22e5a70d9 feat(firmware): nRF52 BLE Legacy DFU support (#5209)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 10:12:15 -05:00
James Rich
9f3fe865e3 test: migrate MigrationTest to runTest and add missing repository fakes (#5171)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-17 16:35:41 +00:00
James Rich
17e69c6d4c chore: review-cleanup fleet (audit + fix + hardening) (#5158) 2026-04-17 00:02:59 +00:00
James Rich
fa63a4ac50 feat: add high-contrast theme with accessible message bubbles (#5135)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-15 01:14:20 +00:00
James Rich
5c47256b3f test(prefs): migrate DataStore tests from androidHostTest to commonTest (#5092) 2026-04-12 20:45:19 +00:00
James Rich
e85300531e refactor(transport): complete transport architecture overhaul — extract callback, wire BleReconnectPolicy, fix safety issues (#5080) 2026-04-12 04:22:18 +00:00
James Rich
9468bc6ebe refactor(service): unify dual connectionState flows into single source of truth (#5077) 2026-04-12 00:50:52 +00:00
James Rich
62264b10c6 refactor(model): remove ConnectionState helper methods and fix updateStatusNotification return type (#5074) 2026-04-11 23:41:34 +00:00
James Rich
a3c0a4832d fix(transport): Kable BLE audit + thread-safety, MQTT, and logging fixes across transport layers (#5071) 2026-04-11 22:56:29 +00:00
James Rich
1649e46dd5 chore(deps): remove 7 unused dependencies across modules (#5017) 2026-04-09 12:35:28 -05:00
James Rich
6af3ad6f0c refactor(service): harden KMP service layer — database init, connection reliability, handler decomposition (#4992) 2026-04-04 18:07:44 +00:00
James Rich
0167063497 feat(analytics): expand DataDog RUM integration and align with iOS parity (#4970) 2026-04-01 20:27:28 +00:00
James Rich
e249461e3c feat(tak): introduce built-in Local TAK Server and mesh integration (#4951)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
2026-04-01 20:21:25 +00:00
James Rich
89547afe6b Refactor and unify firmware update logic across platforms (#4966) 2026-04-01 12:14:26 +00:00
James Rich
c75c9b34d6 feat: implement XModem file transfers and enhance BLE connection robustness (#4959) 2026-03-31 03:49:31 +00:00
James Rich
a005231d94 Refactor map layer management and navigation infrastructure (#4921)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
2026-03-26 00:29:24 +00:00
James Rich
6516287c62 refactor: BLE transport and UI for Kotlin Multiplatform unification (#4911)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
2026-03-25 02:15:51 +00:00
James Rich
96060a0a4d refactor: coroutine dispatchers and modernize testing infrastructure (#4901)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
2026-03-24 01:31:48 +00:00
James Rich
d136b162a4 feat: Implement iOS support and unify Compose Multiplatform infrastructure (#4876) 2026-03-21 23:19:13 +00:00
James Rich
6e50db0b91 docs: Unify notification channel management and migrate unit tests (#4867) 2026-03-20 22:58:47 +00:00
James Rich
dcbbc0823b feat: Integrate Mokkery and Turbine into KMP testing framework (#4845) 2026-03-18 18:33:37 -05:00
James Rich
6e81ceec91 feat: Complete ViewModel extraction and update documentation (#4817) 2026-03-16 20:05:50 +00:00
James Rich
ac6bb5479b feat: introduce Desktop target and expand Kotlin Multiplatform (KMP) architecture (#4761)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
2026-03-12 21:14:49 +00:00