maplibre / flutter-maplibre-gl

Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
https://pub.dev/packages/maplibre_gl
Other
226 stars 125 forks source link

Make iOS not require location permission if its not needed #243

Closed JulianBissekkou closed 1 year ago

JulianBissekkou commented 1 year ago

Some apps might want to display an app without user location, in that case the permission NSLocationWhenInUseUsageDescription should not be required and the app should not crash on startup.

This would be consistent with android

JulianBissekkou commented 1 year ago

I digged into the code and found the problem. The location permission is requested when we set the location render mode to "COMPASS" or "GPS". This is done in Convert.interpretMapboxMapOptions.

By default we are using MyLocationRenderMode.COMPASS which causes the request of the location permission also if you set myLocationEnabled to false.

I would love to contribute to this, but I would like to get guidance for the potnetial fixes. My proposal: Make myLocationRenderMode default to NORMAL and add an assertion that you have to set myLocationEnabled to true when using any other MyLocationRenderMode.