Commit Graph

369 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
fa6d625d90 perf: Phase 4 Android performance optimizations
- frequentEmojis: computed List → cached StateFlow (avoids parse+sort on every recomposition)
- SdkNodeRepositoryImpl: SharingStarted.Eagerly → WhileSubscribed(5_000) for ourNodeInfo, myId, localStats
- PacketRepositoryImpl: deduplicate flatMapLatest chains via shared combine(myNodeNumFlow, currentDb)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:06 -05:00
James Rich
046efd50dd refactor: replace string-based route with typed Enum in RadioConfigState
- Change RadioConfigState.route from String to Enum<*>?
- ChannelScreen resolves navigation target via typed cast instead of
  string lookup through getNavRouteFrom()
- Delete dead SettingsNavUtils.kt (getNavRouteFrom now unused)
- Eliminates fragile string→enum round-trip that could silently fail

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:06 -05:00
James Rich
44b2a8c98a refactor: extract MqttProbeCoordinator and ProfileCoordinator from RadioConfigViewModel
Extract self-contained logic into plain coordinator classes:
- MqttProbeCoordinator: MQTT broker probe state + cancellation
- ProfileCoordinator: import/export/install profile file I/O

RadioConfigViewModel delegates to coordinators while retaining
state ownership and config-loading orchestration (its core job).
Reduces VM body by ~60 lines of implementation detail.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:06 -05:00
James Rich
07214bd307 refactor: decouple feature/connections from feature/settings
- Move ResponseState<T> to core/model
- Move PacketResponseStateDialog to core/ui/component
- Create RadioConfigStateProvider interface in core/model
- RadioConfigViewModel implements RadioConfigStateProvider
- ConnectionsScreen accepts interface instead of concrete VM
- ConnectionsNavigation receives provider via lambda from app/desktop
- Remove projects.feature.settings dependency from connections build

This eliminates a feature→feature dependency, improving build
parallelism and enforcing proper module boundaries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:06 -05:00
James Rich
b3542c76aa fix: remove circular StateFlow observation in RadioConfigViewModel
The combine(serviceRepository.connectionState, radioConfigState) pattern
subscribed to the ViewModel's own output StateFlow, causing redundant
re-evaluations on every state change. Replace with direct observation
of the source connectionState flow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:06 -05:00
James Rich
5dd5ebc074 chore: remove more dead dependencies + stability annotations
- feature/map: remove unused core.data, core.database, core.datastore;
  add missing core.common, core.repository (actual dependencies)
- feature/node: remove unused core.datastore
- feature/connections: remove unused core.database
- Add @Immutable to NodesUiState, NodeFilterState

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
6487d1316d refactor: remove dead deps + add Compose stability annotations
- Remove unused feature/node → feature/map dependency (nothing imported)
- Add @Immutable to RadioConfigState, DiscoveredDevices, DeviceListEntry
  to prevent unnecessary Compose recompositions from unstable inference

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
0b6d8eca08 chore: remove unused core.service dependencies from 5 feature modules
Only feature/messaging actually imports from core.service (SendMessageWorker).
The other 5 feature modules (connections, firmware, map, node, settings)
had vestigial dependency declarations from pre-migration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -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
31f792c71e fix: remove SFPP vestige, resource-back badge strings, add bridge tests
- Remove handleStoreForwardPlusPlus() from interface + impl (dead code post-SDK cutover)
- Move StoreForwardBadge/CongestionBadge hardcoded strings to string resources (i18n)
- Add SdkStateBridge tests: congestion warning → ServiceRepository, S&F server propagation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
64464196b0 feat: SFPP delegation to SDK, NeighborInfo SDK model, congestion + S&F badges
- SdkStateBridge: handle SfppLinkProvided/SfppCanonAnnounced events from SDK
- StoreForwardPacketHandlerImpl: SFPP parsing removed (SDK-owned)
- NeighborInfoHandlerImpl: delegate formatting to SDK NeighborInfo.fromProto()
- NodeStatusIcons: CongestionBadge (yellow/orange/red for MEDIUM/HIGH/CRITICAL)
- NodeStatusIcons: StoreForwardBadge (blue cloud icon for S&F servers)
- NodeListViewModel: expose congestionLevel + storeForwardServers flows
- Tests updated for SFPP bridge coverage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
27b2c19e69 refactor: narrow ViewModel injections, add ConnectionAware, delete dead code, integration tests
ViewModel Narrowing:
- V1: Created ConnectionAware interface; MessageSender, DeviceAdmin, DeviceControl extend it
- V2: Narrowed 6 ViewModels/actions to focused sub-interfaces (DeviceAdmin, MessageSender, DataRequester, DeviceControl)

Cleanup:
- C1: Deleted dead MeshDataMapper and its DI registration

Integration Tests:
- T2: SdkStateBridgeTest verifying WentOffline/CameOnline presence handling
- Verified Koin resolution, full test suite passes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
e9cb439849 feat: rearchitect around SDK — decompose RadioController, simplify DataPacket, integrate SDK utilities
Android rearchitecture consuming meshtastic-sdk improvements:

A1 — ConnectionState Enrichment:
- Rich sealed interface with Connecting(attempt), Configuring(phase, progress), Reconnecting(attempt)
- SdkStateBridge maps SDK states preserving metadata

A2 — MessageHandle Integration:
- MessageDeliveryTracker: tracks delivery via SDK MessageHandle
- SdkRadioController captures handles on send

A3 — RadioController Decomposition:
- Split into 5 focused interfaces: MessageSender, DeviceAdmin, RemoteAdmin, DeviceControl, DataRequester
- RadioController extends all; SdkRadioController binds all via Koin

A4 — DataPacket Simplification:
- to/from fields changed from String? to Int (node numbers directly)
- Removed string ID parsing layer; added BROADCAST/LOCAL constants
- Updated ~40 consumer files across feature modules

A5 — SDK Utility Consumption:
- DeviceVersion, Capabilities, SfppHasher, LocationUtils delegate to SDK
- Removed duplicated protocol logic

A6 — Presence Events:
- SdkStateBridge handles NodeChange.WentOffline/CameOnline
- Updates node online status via repository

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
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
74ba959b24 feat: DRY SDK integration — shared bridge, Desktop cutover, dead infra deletion
Major architectural changes:

1. SHARED KMP BRIDGE (core/data/radio/):
   - RadioClientAccessor: Platform-agnostic interface for SDK RadioClient
   - SdkRadioController: Shared RadioController impl (replaces per-platform copies)
   - SdkStateBridge: Shared SDK→repository bridge (event dispatch, node sync)
   - SdkPacketHandler: Thin SDK-backed PacketHandler for MQTT/XModem/History

2. DESKTOP SDK CUTOVER:
   - DesktopRadioClientProvider: TCP + Serial transport support
   - Removed DirectRadioControllerImpl (old desktop radio path)
   - Desktop now shares the same SDK bridge code as Android

3. DEAD INFRASTRUCTURE DELETION (~5,100 LOC removed):
   - PacketHandlerImpl, MeshDataHandlerImpl, MeshRouterImpl
   - CommandSenderImpl, MeshActionHandlerImpl, MeshConfigFlowManagerImpl
   - MeshConnectionManagerImpl, AdminPacketHandlerImpl
   - ServiceBroadcasts (Android intent-based pub/sub)
   - NodeRepositoryImpl (Room-backed, replaced by SdkNodeRepositoryImpl)
   - 8 trivial UseCases (SetLocale, SetTheme, ToggleAnalytics, etc.)
   - All associated test files for deleted impls
   - Deleted interfaces: AdminPacketHandler, CommandSender, MeshActionHandler,
     MeshConfigFlowManager, MeshConnectionManager, MeshRouter, ServiceBroadcasts

4. NEW FEATURES:
   - NodeMetadataEntity + Room migration 38→39 (persistent favorites/notes)
   - AppMetadataRepository (clean access to node metadata)
   - MessagePersistenceHandler (focused rememberDataPacket for StoreForward)

All three targets compile clean: :app:compileGoogleDebugKotlin,
:desktop:compileKotlin, :core:data:jvmTest passes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
2162e0a340 feat: full SDK integration — drop AIDL, eliminate pipeline, SDK-backed nodes
Phase 1: Drop AIDL
- Delete all 6 .aidl files (core/api/src/main/aidl/)
- Strip binder object from MeshService (onBind returns null)
- Simplify MeshServiceClient to lifecycle observer (no AIDL binding)
- Remove meshService field from AndroidServiceRepository
- Delete ServiceClient, AndroidRadioControllerImpl, FakeIMeshService,
  IMeshServiceContractTest

Phase 2: Migrate TAK to RadioController
- GenericCoTHandler: RadioController replaces CommandSender
- TAKMeshIntegration: RadioController replaces CommandSender
- CoreTakServerModule: DI updated

Phase 3: Port remaining consumers
- MeshConnectionManagerImpl: RadioController, remove time sync/passkey
  (SDK handles internally), wrap telemetry in coroutine
- MeshConfigFlowManagerImpl: remove CommandSender dependency, use 0L
  for currentPacketId
- RefreshLocalStatsAction: RadioController for widget telemetry
- EnsureRemoteAdminSessionUseCase: serviceRepository.onServiceAction()
  replaces meshActionHandler

Phase 4: Delete dead pipeline
- Delete FromRadioPacketHandler interface + FromRadioPacketHandlerImpl
- Delete MeshMessageProcessor interface + MeshMessageProcessorImpl
- Delete related tests
- Remove MeshMessageProcessor dep from MeshActionHandlerImpl
- Keep CommandSender/MeshRouter/MeshActionHandler for
  DirectRadioControllerImpl (desktop target)

Phase 5: SDK-backed NodeRepository
- New SdkNodeRepositoryImpl: in-memory StateFlow backed by NodeManager
- SDK handles persistence via its own SqlDelight storage
- Deactivate Room-backed NodeRepositoryImpl (@Single removed)
- NodeManagerImpl propagates myNodeNum to SdkNodeRepositoryImpl
- Cold start: brief empty state until SDK emits snapshot (<1s)
- Node notes: in-memory for POC (does not survive process death)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 17:52:05 -05:00
James Rich
213c380514 refactor(firmware): replace PlatformBackHandler with NavigationBackHandler (#5376)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 20:01:40 +00:00
James Rich
3c75510f01 fix(mqtt): harden TLS enforcement, add user CA trust, and improve error diagnostics (#5365)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 12:09:49 -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
82926fd734 feat: event firmware easter egg with ambient branding (#5354)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-04 19:37:47 +00:00
James Rich
c0b0b9edd4 fix(network): resolve empty MQTT address and enforce TLS on default server (#5333)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-02 14:59:44 +00:00
James Rich
5a95201b4e fix(connections): improve BLE scan reliability and UI lifecycle (#5329) 2026-05-02 14:25:40 +00:00
James Rich
68a1c578a7 fix: add explicit DI binds and ensure scans start after DataStore load (#5319) 2026-05-01 15:39:40 +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
cbd26b06dd fix: ensure snackbar respects safe drawing padding over host modifiers (#5290) 2026-04-29 14:59:18 +00:00
James Rich
e8f8e14984 fix: persist language switching and correctly map locales (#5287) 2026-04-29 14:59:10 +00:00
James Rich
247f342210 chore: project-wide cruft cleanup and dead code removal (#5249)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-27 16:09:37 +00:00
James Rich
534b4fde24 feat(messaging): send message on Enter keypress (#5246) 2026-04-25 20:52:58 +00:00
James Rich
bbb7f8b23f fix(crashlytics): resolve beta 2.7.14 crash issues (#5245)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-25 19:23:21 +00:00
James Rich
815882d880 feat(messaging): add entry points for filter settings (#5229) 2026-04-23 10:25:43 +00:00
Nick
019c65ad8b fix(ui): make footer buttons expand downwards (#5226) 2026-04-23 09:47:34 +00:00
James Rich
cf834a77f6 feat: Enhance mPWRD-os WiFi provisioning success state and UI components (#5225)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-23 02:04:16 +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
f14ae2643c feat(node): smoother remote-admin UX with per-node session tracking (#5217)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 14:21:04 -05:00
James Rich
ba559549ba refactor: eliminate Accompanist permissions library (#5211)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 11:04:57 -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
6e1a500ca7 fix(settings): restore Import/Export button functionality in #4913 (#5204) 2026-04-21 14:48:39 +00:00
James Rich
4fd52ffb46 fix(canned-messages): enable multiline text editing for long message lists (#5203)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-21 14:44:44 +00:00
James Rich
38c2e9fb33 fix(compass): stop coarse network fixes from clobbering GPS fixes (#5200)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-21 14:06:19 +00:00
James Rich
f21d8af9ae fix(transport): improve BLE / TCP / USB reconnect and handshake resilience (#5196)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 17:34:16 +00:00
Copilot
7492a33cf8 Fix node-details remove action to preserve confirmation flow (#5192)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jamesarich <2199651+jamesarich@users.noreply.github.com>
Co-authored-by: James Rich <james.a.rich@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 15:59:20 +00:00
James Rich
84fe24467f fix(widget): drive updates via debounced state observer (#5185)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-18 04:11:32 +00:00