mapbox / mapbox-gl-native-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and OpenGL
https://www.mapbox.com/mobile/
Other
210 stars 122 forks source link

Explore: Add an ornament with convenience methods to launch privacy settings. #384

Open fabian-guerra opened 4 years ago

fabian-guerra commented 4 years ago

Apple Maps integrates into their Navigation Bar an action controller with multiple options to change privacy settings. This is an exploratory ticket to understand how the Maps SDK can implement such functionality.

Apple Maps Nav Bar IMG_90B09C6B8ABD-1

fabian-guerra commented 4 years ago

This is an exploratory screenshot:

Ornament on top

newornament

Ornament at the bottom

bottom

Adding another ornament starts to overload the screen. It may be possible that we add an icon instead but we will have to educate users about any new visual representation. The difference with the Apple Maps app's screenshot on top is that they utilize the navigation bar to display this control without overloading the screen. As Mapbox supports multiple use cases this is something we may not want to enforce.

However developers can implement [MGLMapViewDelegate mapView:didChangeLocationManagerAuthorization:] delegate with a trivial controller to either direct users to the App's settings or keep precision off.

UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Mapbox GL works best with your precise location."
                                   message:@"You'll get turn-by-turn directions."
                                   preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:@"Turn On in Settings" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    }];

    UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"Keep Precise Location Off" style:UIAlertActionStyleDefault
       handler:nil];
    [alert addAction:settingsAction];
    [alert addAction:defaultAction];
    [self presentViewController:alert animated:YES completion:nil];
lloydsheng commented 3 years ago

@knov What does the precise location ornament looks like? Is there a design? Because of the scalebar may occupy half of the screen width. There may be no enough space to put down a precise location when scalebar and Mapbox logo are placed at the same horizontal position. image

I suggest putting the button on top of other ornaments at the bottom of the map, or something more appropriate.

image