-
-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't enter compass mode before location is found #3166
Conversation
When location is first turned on, and you're set to follow the location, but haven't yet found it, tapping the compass should behave as if you're not following the location yet. For streetcomplete#3147
@westnordost The StreetComplete/app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt Lines 278 to 282 in d6f31b5
StreetComplete/app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt Lines 568 to 573 in d6f31b5
Are both of these needed? If not, which would you prefer to be removed? If it's the same to you, I am slightly leaning towards receiving location updates in the StreetComplete/app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt Lines 703 to 707 in d6f31b5
|
Both are needed, because both do different things. Maybe the naming is off:
|
Anyway, I'll merge this as it is, the change you did so far fixes the mentioned bug. |
Well, ok. I was going to get back to this, but I can continue in another PR :)
[written several days ago] Okay, I see: the
This is not exactly true, as far as I can tell. In summary:
MainFragment triggers the MapFragment to begin location tracking any time location services are enabled.MapFragment does not stop location tracking except when location services are turned off or when the fragment is closed (in onStop() ).MainFragment , regardless of whether the map location changed (edit: in other words, even it is still displaying the same bbox on screen).
…I'd call this, "The MainFragment subscribing to location updates, with extra steps." 😄 It makes me feel like the abstraction boundary is wrong, somewhere.I understand the relationship between the MainFragment and GPS button: the button is a dumb view*, which the fragment updates sometimes. I don't really understand the relationship with the map fragment. It's a 3-class hierarchy, seemingly just to split the logic up in to manageable/logical chunks. It definitely is the source of truth for map state. But the responsibilities for managing state updates and the "business logic" are split up between the different classes and the MainFragment in confusing ways. Actually, the abstraction boundaries are not that confusing. It seems like MainFragment is intended to have the high level logic, for coordinating the various components. Then the fragments hold the state and implementation details. It's just that a few corner cases, like *Actually, there's one place where the fragment uses the state of the view as part of control flow… perhaps we should change this. StreetComplete/app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt Lines 625 to 628 in 0ca3031
I'm not totally confident in my analysis of the abstraction boundaries, and I'm less certain what I would like to change. So for now I will change nothing, and proceed with my original plan: finish the bugfixes "locally" however I need to, then check if there is anything begging to be refactored :) Finally, completely unrelated: I've noticed in several places we do something like Would you accept a PR adding an extension function, |
Yes, yes |
@smichel17 Thanks for this fix! I got bitten by it and failed to track down or notice what is causing problems. |
@westnordost Before you release v34, there's one more quick bugfix I can get in… |
Also, I think the changelog gets this backwards.
The conditions are right, but the undesired behavior was entering compass mode, not rotating back to north. I would suggest phrasing, but I'm not sure how you want to refer to compass mode. |
Fixes #3147
This is a draft because I'm going to add a few more commits, and I may want to refactor after that, to avoid making the same fix in many places.