mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

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

Open jeffypooo opened this issue 1 year ago • 2 comments

Environment

  • Xcode version: 15.4
  • iOS version: 17.5.1
  • Devices affected: All
  • Maps SDK Version: 11.4.0

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 avatar Jun 12 '24 00:06 jeffypooo

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

jeffypooo avatar Jul 02 '24 21:07 jeffypooo

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

persidskiy avatar Jul 04 '24 11:07 persidskiy