Skip to content

feat: settings rework#4678

Merged
jamesarich merged 8 commits intomainfrom
feat/settings-rework
Mar 2, 2026
Merged

feat: settings rework#4678
jamesarich merged 8 commits intomainfrom
feat/settings-rework

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements and fixes across navigation, data handling, BLE connection management, and internal utility classes. The most significant changes include adding new screens to the settings navigation, improving coroutine and flow usage for robustness, introducing timeout handling for sequential jobs, and making various codebase cleanups and enhancements.

Navigation and UI Enhancements:

  • Added new screens to the settings navigation (DeviceConfigurationScreen, ModuleConfigurationScreen, AdministrationScreen) and updated navigation logic to support them. Also passed settingsViewModel and handled state collection for excluded modules. [1] [2] [3]
  • Updated navigation callbacks to avoid unnecessary stack operations and improved state management using LaunchedEffect and lifecycle-aware state collection. [1] [2] [3]

Coroutines and Flow Improvements:

  • Replaced usage of simpleSharedFlow with MutableSharedFlow with buffer capacity in RadioInterfaceService, improving event delivery reliability for received data, connection errors, and mesh activity. [1] [2] [3] [4]
  • Made BLE connection connect and disconnect functions non-cancellable to ensure proper resource cleanup and state management. [1] [2] [3] [4]

Data Handling and Repository Fixes:

  • Ensured that SwitchingNodeInfoReadDataSource returns empty lists instead of null when database queries return null, preventing potential null pointer issues.
  • Updated SwitchingNodeInfoWriteDataSource to use block bodies for suspend functions, improving readability and maintainability.

Performance and Robustness:

  • Introduced an optional timeout to the SequentialJob utility, allowing jobs to be automatically cancelled and logged if they exceed a specified duration, preventing silent hangs. [1] [2] [3]
  • Updated MeshCommandSender and MeshService to provide cached config and channel set data, removing blocking calls and improving responsiveness. [1] [2] [3] [4]

Internal Codebase Cleanups:

  • Annotated DatabaseManager with @OptIn(ExperimentalCoroutinesApi::class) to suppress warnings and clarify usage of experimental APIs. [1] [2]

These changes collectively enhance the application's navigation capabilities, robustness in asynchronous operations, and maintainability of the codebase.

This commit refactors the settings user interface to improve organization by moving device configuration, module settings, and administration actions into dedicated sub-screens.

- **New Screens**: Introduced `DeviceConfigurationScreen`, `ModuleConfigurationScreen`, and `AdministrationScreen` to reduce clutter on the main Settings screen.
- **Navigation**: Updated the settings navigation graph with new routes for the sub-screens and added `LaunchedEffect` hooks to trigger configuration loading upon navigation.
- **UI Components**: Introduced the `ExpressiveSection` composable in `RadioConfig.kt` to provide a unified, styled container for settings groups.
- **State Management**: Refactored `RadioConfigViewModel` to use `copy()` for state updates and moved the "User" configuration into the primary radio configuration group.
- **Interaction**: Relocated packet response dialogs and administration confirmation dialogs (shutdown, reboot, node DB reset) to their respective sub-screens for better separation of concerns.

Signed-off-by: James Rich <[email protected]>
…gurations

This commit introduces a dedicated `LoadingOverlay` component to provide better visual feedback during asynchronous operations, such as updating radio settings or channel configurations.

Key changes include:
- **New Loading Component**: Added `LoadingOverlay` which utilizes a `CircularWavyProgressIndicator` and displays real-time progress percentages and status messages.
- **UI Refactoring**: Updated `ChannelConfigScreen`, `AdministrationScreen`, and `RadioConfigScreenList` to incorporate the new overlay. These screens now wrap their content in a `Box` to layer the overlay and conditionally show the `PacketResponseStateDialog` only upon task completion (Success or Error) rather than while waiting.
- **State Management**: Updated `RadioConfigViewModel` to track pending request IDs and explicitly trigger success or clear states once all administration packets are processed.
- **UI Polish**: Updated the "Acknowledgements" item in `SettingsScreen` to use a standard chevron icon and applied error color tints to the Administration section in `RadioConfig` for better visual hierarchy.

Signed-off-by: James Rich <[email protected]>
- Add `delivery_confirmed_reboot_warning` string resource.
- Update `PacketResponseStateDialog` to use Material 3 Expressive API components, including `LinearWavyProgressIndicator`.
- Enhance dialog layout with status icons for success and error states.
- Display a reboot warning message when settings are successfully applied.
- Refine dialog dismiss and back navigation logic.

Signed-off-by: James Rich <[email protected]>
- Replace `collectAsState` with `collectAsStateWithLifecycle` across multiple UI screens.
- Implement `limitedParallelism` and usage marking in `DatabaseManager.withDb`.
- Add timeout support to `SequentialJob` to prevent hanging coroutines.
- Use cached configurations in `MeshService` to eliminate `runBlocking` calls.
- Wrap BLE `connect` and `disconnect` operations in `NonCancellable` context.
- Increase buffer capacity for `meshPacketFlow` to improve packet handling.
- Ensure null safety for node queries in `SwitchingNodeInfoReadDataSource`.

Signed-off-by: James Rich <[email protected]>
…logs

Decomposes large composable functions in `AdministrationScreen` and `PacketResponseStateDialog` into smaller, more manageable components. Also cleans up unused parameters in `RadioConfigItemList` and replaces magic numbers with constants in `LoadingOverlay`.

Signed-off-by: James Rich <[email protected]>
@github-actions github-actions bot added the enhancement New feature or request label Mar 2, 2026
@jamesarich jamesarich changed the title Feat/settings rework feat: settings rework Mar 2, 2026
@jamesarich jamesarich enabled auto-merge March 2, 2026 14:22
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.31%. Comparing base (b2b21e1) to head (a3b500f).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...m/geeksville/mesh/navigation/SettingsNavigation.kt 0.00% 9 Missing ⚠️
...lle/mesh/repository/radio/RadioInterfaceService.kt 0.00% 3 Missing ⚠️
...a/com/geeksville/mesh/service/MeshCommandSender.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4678      +/-   ##
==========================================
- Coverage   15.35%   15.31%   -0.04%     
==========================================
  Files          83       83              
  Lines        4344     4354      +10     
  Branches      734      734              
==========================================
  Hits          667      667              
- Misses       3553     3563      +10     
  Partials      124      124              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit fdd07f8 Mar 2, 2026
7 checks passed
@jamesarich jamesarich deleted the feat/settings-rework branch March 2, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant