- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 337
 
feat(map): Persist Google Maps camera position #3605
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
base: main
Are you sure you want to change the base?
Conversation
This commit introduces the functionality to persist the Google Maps camera position (target, zoom, tilt, and bearing) across app sessions. - The `GoogleMapsPrefs` is extended to store the camera's latitude, longitude, zoom, tilt, and bearing. - `MapViewModel` now initializes the `CameraPositionState` with the saved values and saves the new position whenever the camera stops moving. - The `MapView` is updated to use the `CameraPositionState` from the `ViewModel`. - A one-time auto-zoom/bound functionality on map load has been removed to respect the persisted camera state. - `MapsInitializer.initialize(context)` is now called on app startup to support the compose map toolkit. Signed-off-by: James Rich <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
          Codecov Report❌ Patch coverage is  Additional details and impacted files@@           Coverage Diff            @@
##            main   #3605      +/-   ##
========================================
- Coverage   0.51%   0.51%   -0.01%     
========================================
  Files        369     372       +3     
  Lines      21259   21278      +19     
  Branches    2577    2576       -1     
========================================
  Hits         109     109              
- Misses     21130   21149      +19     
  Partials      20      20              ☔ View full report in Codecov by Sentry.  | 
    
| 
           Would we want to ignore the prefs if the current location is sufficiently far from the location the prefs were set?  | 
    
          
 would the current location be the node's current location, the phones? how far is far enough away to reset? and would we want to be considering the last heard time as well? maybe the current node is stationary... seems like maybe we could further tweak the logic here in a followon once we have some of those details nailed down, but for now improves the experience greatly by leaving the map where it was last viewed.  | 
    
Signed-off-by: James Rich <[email protected]>
Signed-off-by: James Rich <[email protected]>
          
 All good questions. Just a thought.  | 
    
This commit introduces the functionality to persist the Google Maps camera position (target, zoom, tilt, and bearing) across app sessions.
GoogleMapsPrefsis extended to store the camera's latitude, longitude, zoom, tilt, and bearing.MapViewModelnow initializes theCameraPositionStatewith the saved values and saves the new position whenever the camera stops moving.MapViewis updated to use theCameraPositionStatefrom theViewModel.MapsInitializer.initialize(context)is now called on app startup to address some crashes seen on firebase relating to maps init.