Skip to content

Conversation

@jamesarich
Copy link
Collaborator

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 address some crashes seen on firebase relating to maps init.

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]>
Copy link
Contributor

Copilot AI left a 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.

@github-actions github-actions bot added the enhancement New feature or request label Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.51%. Comparing base (e147025) to head (0494420).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...in/org/meshtastic/core/prefs/DoublePrefDelegate.kt 0.00% 11 Missing ⚠️
...lin/org/meshtastic/core/prefs/FloatPrefDelegate.kt 0.00% 6 Missing ⚠️
...n/org/meshtastic/core/prefs/map/GoogleMapsPrefs.kt 0.00% 5 Missing ⚠️
...in/java/com/geeksville/mesh/MeshUtilApplication.kt 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@poliver
Copy link
Member

poliver commented Nov 4, 2025

Would we want to ignore the prefs if the current location is sufficiently far from the location the prefs were set?

@jamesarich
Copy link
Collaborator Author

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]>
@poliver
Copy link
Member

poliver commented Nov 4, 2025

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.

All good questions. Just a thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants