Skip to content

fix(map, settings): allow null IDs and implement request timeout#4851

Merged
jamesarich merged 2 commits intomainfrom
fix/nav
Mar 19, 2026
Merged

fix(map, settings): allow null IDs and implement request timeout#4851
jamesarich merged 2 commits intomainfrom
fix/nav

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

@jamesarich jamesarich commented Mar 19, 2026

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.

resolves #4848
resolves #4849

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]>
@github-actions github-actions bot added the bugfix PR tag label Mar 19, 2026
@jamesarich jamesarich enabled auto-merge March 19, 2026 13:10
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.20%. Comparing base (06b9f8c) to head (e185d93).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tic/feature/settings/radio/RadioConfigViewModel.kt 75.00% 0 Missing and 2 partials ⚠️
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     
Flag Coverage Δ
host-unit 10.20% <75.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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]>
@jamesarich jamesarich added this pull request to the merge queue Mar 19, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 19, 2026
@jamesarich jamesarich added this pull request to the merge queue Mar 19, 2026
@jamesarich jamesarich removed this pull request from the merge queue due to a manual request Mar 19, 2026
@jamesarich jamesarich merged commit bc08093 into main Mar 19, 2026
8 checks passed
@jamesarich jamesarich deleted the fix/nav branch March 19, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Settings tab opens Remote Admin menu [Bug]: Remote Administration menu seems frozen

1 participant