fix(map, settings): allow null IDs and implement request timeout#4851
Merged
jamesarich merged 2 commits intomainfrom Mar 19, 2026
Merged
fix(map, settings): allow null IDs and implement request timeout#4851jamesarich merged 2 commits intomainfrom
jamesarich merged 2 commits intomainfrom
Conversation
This commit fixes logic in `MapViewModel` and `RadioConfigViewModel` to correctly handle null values when clearing selections and introduces a timeout mechanism for radio configuration requests. Specific changes include: - **Map Selection Fixes:** - Updated `setWaypointId` in both Google and FOSS/fdroid `MapViewModel` implementations to allow setting the ID to `null`. This ensures that waypoint selections can be cleared rather than ignoring the update. - Added a safety check to avoid redundant camera movements in the Google Maps implementation when the ID hasn't changed. - **Radio Configuration Improvements:** - Modified `RadioConfigViewModel.initDestNum` to allow `null` values, enabling the clearing of destination node filters. - Introduced a 30-second timeout for configuration requests via `registerRequestId`. If a response is not received within the window, the request ID is cleared, and a timeout error event is dispatched. - **Testing:** - Added unit tests in `MapViewModelTest.kt` to verify that `setWaypointId` correctly handles null values. - Added unit tests in `RadioConfigViewModelTest.kt` to cover `initDestNum` nullability and the new timeout logic. Signed-off-by: James Rich <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4851 +/- ##
==========================================
+ Coverage 10.13% 10.20% +0.07%
==========================================
Files 545 545
Lines 18095 18102 +7
Branches 2697 2699 +2
==========================================
+ Hits 1834 1848 +14
+ Misses 16081 16073 -8
- Partials 180 181 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This commit cleans up the `RadioConfigViewModelTest` by using shorter imports for coroutine test utilities and adding necessary imports for navigation and assertions. Specific changes: - Simplified usage of `advanceTimeBy` and `runCurrent` by using explicit imports. - Added missing imports for `ConfigRoute`, `assertTrue`, and coroutine test utilities. - Refined timeout test logic for `RadioConfigViewModel`. Signed-off-by: James Rich <[email protected]>
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 fixes logic in
MapViewModelandRadioConfigViewModelto correctly handle null values when clearing selections and introduces a timeout mechanism for radio configuration requests.Specific changes include:
Map Selection Fixes:
setWaypointIdin both Google and FOSS/fdroidMapViewModelimplementations to allow setting the ID tonull. This ensures that waypoint selections can be cleared rather than ignoring the update.Radio Configuration Improvements:
RadioConfigViewModel.initDestNumto allownullvalues, enabling the clearing of destination node filters.registerRequestId. If a response is not received within the window, the request ID is cleared, and a timeout error event is dispatched.Testing:
MapViewModelTest.ktto verify thatsetWaypointIdcorrectly handles null values.RadioConfigViewModelTest.ktto coverinitDestNumnullability and the new timeout logic.resolves #4848
resolves #4849