refactor(settings): Use LocalConfig for radio configuration state#4579
Merged
Conversation
This commit refactors the `RadioConfigViewModel` to use `LocalConfig` and `LocalModuleConfig` for managing the configuration state, aligning it with the data sources from `RadioConfigRepository`. This change ensures that the local device's configuration is directly observed and updated in the UI. The `radioConfig` state is now of type `LocalConfig`, and separate flows for `localConfigFlow` and `moduleConfigFlow` are observed to keep the UI state synchronized when connected to the local node. The previous `Config` type is replaced, and updates to the state are now done by merging new partial `Config` data into the existing `LocalConfig` state. Additionally, this commit includes several smaller fixes and improvements: - Simplifies the `isLocal` property update logic. - Replaces direct access to `meshService.packetId` with `meshService.getPacketId()`. - Adds error handling for `setRingtone` and `setCannedMessages` to catch `RemoteException`. - Removes the unused `setChannels(channelUrl: String)` method. - In the Status Message screen, the current node status from telemetry is now used as a fallback if the configured status message is blank, providing a more informative default. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4579 +/- ##
==========================================
- Coverage 14.79% 14.78% -0.02%
==========================================
Files 429 429
Lines 14846 14861 +15
Branches 2457 2464 +7
==========================================
Hits 2197 2197
- Misses 12331 12346 +15
Partials 318 318 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit refactors the
RadioConfigViewModelto useLocalConfigandLocalModuleConfigfor managing the configuration state, aligning it with the data sources fromRadioConfigRepository. This change ensures that the local device's configuration is directly observed and updated in the UI.The
radioConfigstate is now of typeLocalConfig, and separate flows forlocalConfigFlowandmoduleConfigFloware observed to keep the UI state synchronized when connected to the local node. The previousConfigtype is replaced, and updates to the state are now done by merging new partialConfigdata into the existingLocalConfigstate.Additionally, this commit includes several smaller fixes and improvements:
isLocalproperty update logic.meshService.packetIdwithmeshService.getPacketId().setRingtoneandsetCannedMessagesto catchRemoteException.setChannels(channelUrl: String)method.