maplibre / maplibre-navigation-ios

MapLibre Navigation SDK for iOS
Other
29 stars 27 forks source link

Make background Audio (and RouteVoiceController?) optional #63

Closed michaelkirk closed 2 weeks ago

michaelkirk commented 2 weeks ago

Motivation

I'm not currently using voice instructions. I'd like to add it at some point, but my app is still useful without this feature.

The SDK requires the background "Audio" entitlement at runtime, but without the voice instructions, there's no reason for the background "Audio" entitlement.

The AppStore may not accept an application with the background audio entitlement that doesn't actually use background audio. (speaking from experience here 😬)

RouteVoiceController.verifyBackgroundAudio is called upon init, which happens when instantiating a NavigationViewController.

Design Alternatives

  1. Make the RouteVoiceController optional so that it's not initialized at all. This will have broaded implications and likely conflict with #54

  2. Keep the RouteVoiceController in place, but only call verifyBackgroundAudio once we actually try to use audio — during speech synthesis.

  3. Keep the RouteVoiceController in place, but never call verifyBackgroundAudio, or reduce the assert to a logging statement. This runs the risk of the user's app not working the way they expect.

Design

My preference is alternative 2. It's a small change.