blob: 97823c74222e75f06ff2190bad4246e4b8b65e13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
name: "Fix WeatherActivity silent fallback to San Francisco"
description: "WeatherActivity silently uses lat=37.8, lon=-122.4 (San Francisco Bay) when GPS is unavailable, showing real API weather data for the wrong location with no indication to the user."
agent:
model: "sonnet"
working_dir: "/workspace/nav"
instructions: |
Context
-------
WeatherActivity has:
(android-app/app/src/main/kotlin/org/terst/nav/ui/WeatherActivity.kt, lines ~23-24)
private val defaultLat = 37.8
private val defaultLon = -122.4
When GPS permission is denied or location unavailable, loadWeatherAtDefault() calls
viewModel.loadWeather(defaultLat, defaultLon) and displays the result as if it were
the user's actual location weather — with no disclaimer or error state shown.
Goal
----
Instead of silently fetching weather for San Francisco, show an explicit error/unavailable
state when the device location cannot be obtained. Do not fetch any weather data in that path.
Remove defaultLat/defaultLon and loadWeatherAtDefault() entirely.
When location is unavailable, set UiState.Error("Location unavailable") so the existing
error UI in the layout is shown instead.
Step 1 — Read the current WeatherActivity
-----------------------------------------
Read android-app/app/src/main/kotlin/org/terst/nav/ui/WeatherActivity.kt in full
to understand the current permission and location flow before making changes.
Step 2 — Remove the fallback
----------------------------
- Delete the defaultLat and defaultLon fields
- Delete the loadWeatherAtDefault() method (or equivalent fallback call)
- Where loadWeatherAtDefault() was called (on permission denied or location null),
replace with:
viewModel.setError("Location unavailable — enable GPS to load weather")
OR if MainViewModel does not have setError(), use:
// Just leave UiState.Loading — do not fetch for a fake position
The simplest correct fix: do nothing when location is unavailable.
The existing "Loading" spinner is less harmful than wrong-location data.
Step 3 — Build
--------------
cd android-app && ANDROID_HOME=/opt/android-sdk ./gradlew assembleDebug 2>&1 | tail -5
Confirm BUILD SUCCESSFUL.
Step 4 — Commit and push
------------------------
git add android-app/app/src/main/kotlin/org/terst/nav/ui/WeatherActivity.kt
git commit -m "fix(weather): remove silent fallback to San Francisco coordinates
When GPS was unavailable, WeatherActivity fetched and displayed real weather
data for lat=37.8 lon=-122.4 (San Francisco Bay) with no indication to the
user. Remove the fallback; leave the loading state when location is unavailable."
git push github main && git push local main
timeout: "15m"
tags:
- "weather"
- "bug"
- "ux"
|