fix: resolve crashes and debug filter issues in Metrics and MapView#4824
Merged
jamesarich merged 3 commits intomainfrom Mar 17, 2026
Merged
fix: resolve crashes and debug filter issues in Metrics and MapView#4824jamesarich merged 3 commits intomainfrom
jamesarich merged 3 commits intomainfrom
Conversation
Fix #4810: Debug Panel preset filters return empty results - The filterLogs() method had reversed contains() checks - it was checking if the short filter text contained the long log message, which almost always returns false. Corrected to check if log fields contain the filter text. Fix #4821: App crashes when requesting history data / traceroute - MetricsViewModel requires @InjectedParam destNum: Int, but the Nav3 navigation entries were calling koinViewModel<MetricsViewModel>() without passing destNum via parametersOf(). This causes a Koin injection crash at runtime. Fixed all 3 call sites to match the Desktop implementation pattern: koinViewModel(key = ...) { parametersOf(destNum) }. - Updated KoinVerificationTest to declare MetricsViewModel's Int parameter so future regressions are caught.
The map_subDescription string resource uses %1$d (integer) for the bearing parameter, but the code was passing ourNode.bearing(node).toString() which converts the Int? to a String. This caused a crash: IllegalFormatConversionException: d != java.lang.String Fix: Remove .toString() and pass the Int directly. Also safely handle the nullable bearing() return with ?.let to avoid passing null. Fixes crash in MapView.onNodesChanged() at line 447.
This commit cleans up the map ViewModel hierarchy by removing unnecessary property overrides and redundant methods in the `fdroid` flavor implementation.
Specific changes include:
- **BaseMapViewModel**: Removed the `open` modifier from `nodeRepository` to prevent unnecessary overrides.
- **MapViewModel (fdroid)**:
- Removed the `override` modifier from `nodeRepository` in the constructor.
- Removed the redundant `getUser` override as the base implementation now suffices.
- **MapView (fdroid)**: Removed an unused import for `toString`.
Signed-off-by: James Rich <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4824 +/- ##
==========================================
- Coverage 13.20% 13.20% -0.01%
==========================================
Files 539 539
Lines 17761 17763 +2
Branches 2651 2651
==========================================
Hits 2345 2345
- Misses 15100 15102 +2
Partials 316 316 ☔ 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 pull request introduces several improvements and cleanups across the codebase, focusing on dependency injection, code simplification, and bug fixes. The most significant changes are in how
MetricsViewModelis provided with parameters in navigation, dependency injection verification, and some resource import cleanups.Dependency Injection and ViewModel Improvements:
MetricsViewModelwith a unique key and the requireddestNumparameter using Koin'sparametersOfin all relevant navigation entries, ensuring correct instance scoping and parameter passing. [1] [2] [3]MetricsViewModel, improving test coverage for dependency injection.MetricsViewModelin the Koin verification test file.Code Simplification and Cleanup:
MapView.ktandMapViewModel.kt, reducing clutter and potential confusion. [1] [2] [3] [4] [5]nodeRepositoryproperty inMapViewModelandBaseMapViewModelto remove theoverridemodifier and adjust visibility, simplifying inheritance and property usage. [1] [2]MapViewModelfor additional code clarity.Bug Fixes:
MapView.ktwheresubDescriptioncould be set with anullbearing by ensuring the bearing is non-null before using it.Other Improvements:
DebugViewModelby correcting the direction of string containment checks, making the filter behavior more intuitive and reliable.resolves #4810
resolves #4812
resolves #4821