mapbox / mapbox-maps-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and Metal
https://www.mapbox.com/mapbox-mobile-sdk
Other
452 stars 149 forks source link

SwiftUI: Location Provider overrides are reset when changing puck bearing value #2199

Open jeffypooo opened 1 month ago

jeffypooo commented 1 month ago

Environment

Observed behavior and steps to reproduce

We use a state var to switch the Puck2D's bearing mode between nil and heading. We also use a custom LocationProvider/HeadingProvider, which we set during onAppear via the MapProxy, e.g. mapProxy.location!.override(provider: ourProvider). Our custom provider is a singleton instance.

When the puck bearing state variable is changed, we have to call LocationManager.override(provider:) again or it seems to reset to the default.

Expected behavior

We should only need to call LocationManager.override(provider:) once.

Notes / preliminary analysis

We can tell the provider is being reset because removeLocationObserver is being called when this puck bearing value is updated, and no subsequent call to addLocationObserver is received. We also change location accuracy filter settings on our provider when changing this puck bearing value, and those filters are not being respected unless we make another call to the override.

I am guessing this has to do with how the location manager handles the conversion from the provider to the Signal that it appears to use internally.

Additional links and references

Can provide a minimal example if needed.

jeffypooo commented 2 weeks ago

@persidskiy anything I can do to get eyes on this?

persidskiy commented 1 week ago

@jeffypooo Hi, can I ask you to get a minimal sample? That would definitely help.