-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added banner to notify user to enable precise location during turn-by-turn navigation #2693
added banner to notify user to enable precise location during turn-by-turn navigation #2693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested changelog entry:
- Added the
NavigationServiceDelegate.navigationServiceDidChangeAuthorization(_:)
method to find out when the user changes the application’s Location Services permissions. (#2693)
…ontroller to optional downcasting, changed PassiveLocationManager to use fullAccuracy instead of forced downcasting
@@ -367,6 +367,7 @@ open class NavigationViewController: UIViewController, NavigationStatusPresenter | |||
showStatus(title: title, spinner: false, duration: 3, animated: true, interactive: false) | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove the extra white space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
|
||
if #available(iOS 14.0, *), accuracyAuthorization == .reducedAccuracy { | ||
let title = NSLocalizedString("ENABLE_PRECISE_LOCATION", bundle: .mapboxNavigation, value: "Enable precise location to navigate", comment: "Label indicating precise location is off and needs to be turned on to navigate") | ||
showStatus(title: title, spinner: false, duration: 20, animated: true, interactive: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to make this status stay up until precise location is enabled, or is that the focus of another issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging, please open an issue to track persisting this banner until precise location is reenabled, so that we don’t lose track of that important detail. #2691 is sort of related, but I think persisting the accuracy authorization banner and automatically hiding it at the right time would be more tractable, because we’re already observing the notification that we need to observe to know when to hide the banner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is almost there, but there are a few more things to take care of before merging.
/** | ||
Posted when user changes location authorization settings. | ||
|
||
The user info dictionary indicates which keys and values changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user info dictionary indicates which keys and values changed. | |
The user info dictionary contains the key `MapboxNavigationService.NotificationUserInfoKey.locationAuthorizationKey`. |
} | ||
|
||
/** | ||
A key in the user info dictionary of a `Notification.Name.locationAuthorizationDidChange` notification. The corresponding value is a `Int` object the current location authorization setting. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s technically an Int
when we put it in the dictionary, due to our internal workaround, but the developer would be expected to cast it to a CLAccuracyAuthorization
.
If the developer needs to similarly work around the lack of CLAccuracyAuthorization
on iOS 13, they’d conditionally implement an enumeration on iOS 13 that would match a typedef on iOS 14. But documenting that workaround is probably outside the scope of the documentation here, since the workaround requires a modicum of Objective-C code that might not be appropriate for every application.
A key in the user info dictionary of a `Notification.Name.locationAuthorizationDidChange` notification. The corresponding value is a `Int` object the current location authorization setting. */ | |
A key in the user info dictionary of a `Notification.Name.locationAuthorizationDidChange` notification. The corresponding value is a `CLAccuracyAuthorization` indicating the current location authorization setting. */ |
|
||
if #available(iOS 14.0, *), accuracyAuthorization == .reducedAccuracy { | ||
let title = NSLocalizedString("ENABLE_PRECISE_LOCATION", bundle: .mapboxNavigation, value: "Enable precise location to navigate", comment: "Label indicating precise location is off and needs to be turned on to navigate") | ||
showStatus(title: title, spinner: false, duration: 20, animated: true, interactive: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging, please open an issue to track persisting this banner until precise location is reenabled, so that we don’t lose track of that important detail. #2691 is sort of related, but I think persisting the accuracy authorization banner and automatically hiding it at the right time would be more tractable, because we’re already observing the notification that we need to observe to know when to hide the banner.
…ationUserInfoKey struct, fixed CoreConstants comments to be more clear to developers
Fixed a change (commit hash: 9295eb9) that I accidentally deleted. |
Added banner to notify a user to enable precise location during turn-by-turn navigation using
CLLocationManager
andlocationDidChangeAuthorization(..)
, bringing this value up the delegate chain. Banner displays for 9 seconds (about the time it takes for a user to notice the banner and change their settings).fix #2555
/cc @mapbox/navigation-ios