Skip to content

Commit e78deb7

Browse files
authored
check if location permissions are granted on onResume (#6489)
1 parent e44115b commit e78deb7

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Mapbox welcomes participation and contributions from everyone.
1010
- Made `MapViewBinder#shouldLoadMapStyle` false by default. [#6485](https://github.com/mapbox/mapbox-navigation-android/pull/6485)
1111
- Fixed an issue that prevented any registered `OnBackPressedCallback`s to fire when `NavigationView` is attached. [#6483](https://github.com/mapbox/mapbox-navigation-android/pull/6483)
1212
- Removed `NavigationViewListener.onBackPressed()`. You can register your own [OnBackPressedCallback](https://developer.android.com/reference/androidx/activity/OnBackPressedCallback) to intercept any `NavigationView` BACK press events. [#6483](https://github.com/mapbox/mapbox-navigation-android/pull/6483)
13+
- Fixed an issue with `NavigationView` that caused trip session not to start after granting location permissions that were requested outside of Drop-In UI by an application. [#6489](https://github.com/mapbox/mapbox-navigation-android/pull/6489)
1314

1415
## Mapbox Navigation SDK 2.9.0-beta.2 - 14 October, 2022
1516
### Changelog

libnavui-dropin/src/main/java/com/mapbox/navigation/dropin/permission/LocationPermissionComponent.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ internal class LocationPermissionComponent(
8080
/**
8181
* When the app is launched without location permissions. Run a check to see if location
8282
* permissions have been accepted yet. This will catch the case where a user will enable
83-
* location permissions through the app settings.
83+
* location permissions through the app settings or
84+
* when developers request location permissions themselves.
8485
*/
8586
private fun notifyGrantedOnForegrounded(applicationContext: Context) {
8687
coroutineScope.launch {
87-
componentActivityRef.get()?.repeatOnLifecycle(Lifecycle.State.STARTED) {
88+
componentActivityRef.get()?.repeatOnLifecycle(Lifecycle.State.RESUMED) {
8889
if (!store.state.value.tripSession.isLocationPermissionGranted) {
8990
val isGranted = PermissionsManager.areLocationPermissionsGranted(
9091
applicationContext

libnavui-dropin/src/test/java/com/mapbox/navigation/dropin/permission/LocationPermissionComponentTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class LocationPermissionComponentTest {
188188

189189
locationPermissionComponent.onAttached(mockMapboxNavigation())
190190
every { PermissionsManager.areLocationPermissionsGranted(any()) } returns true
191-
testLifecycle.lifecycleRegistry.currentState = Lifecycle.State.STARTED
191+
testLifecycle.lifecycleRegistry.currentState = Lifecycle.State.RESUMED
192192

193193
verify {
194194
testStore.dispatch(

0 commit comments

Comments
 (0)