diff options
| author | Claude <noreply@anthropic.com> | 2026-04-11 17:56:12 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-04-11 17:56:12 +0000 |
| commit | 069585f85966724827240e1cd85ae77cb0209e47 (patch) | |
| tree | 01856c69d2d7becb8da9c0bb0c09e47801f3f151 /android-app | |
| parent | b7810d0ff62e18ec991b624482d94f1363778872 (diff) | |
Stop 1 Hz conditions hammering; improve error logging
The camera idle listener fires every time following-mode GPS moves the
map (~1 Hz). Each fire was calling loadConditions, which meant a new
API request (and spinner flash) every second. Fix: skip the camera idle
loadConditions call when isFollowing == true — the GPS first-fix handler
already owns that trigger. Camera idle only loads conditions when the
user has manually panned away from their position.
Also include exception class + message in the logcat tag so the actual
API failure reason is visible without --stacktrace:
adb logcat -s Nav:E
https://claude.ai/code/session_01HXPjBsogsJVRwCiekDGkJX
Diffstat (limited to 'android-app')
| -rw-r--r-- | android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt | 6 | ||||
| -rw-r--r-- | android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt b/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt index bdd8bd9..ecf2254 100644 --- a/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt +++ b/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt @@ -454,7 +454,11 @@ class MainActivity : AppCompatActivity(), SafetyFragment.SafetyListener { ) } maplibreMap.cameraPosition.target?.let { center -> - viewModel.loadConditions(center.latitude, center.longitude) + // Only refresh conditions when the user has manually panned — + // in following mode the GPS handler already triggers the load. + if (mapHandler?.isFollowing?.value == false) { + viewModel.loadConditions(center.latitude, center.longitude) + } } } diff --git a/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt b/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt index df3ab5e..b2d5529 100644 --- a/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt +++ b/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt @@ -177,7 +177,7 @@ class MainViewModel( try { repository.fetchCurrentConditions(lat, lon) .onSuccess { _marineConditions.value = it } - .onFailure { android.util.Log.e("Nav", "fetchCurrentConditions failed", it) } + .onFailure { android.util.Log.e("Nav", "fetchCurrentConditions failed: ${it.javaClass.simpleName} — ${it.message}", it) } } finally { _conditionsLoading.value = false } |
