diff options
| author | Guillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com> | 2022-08-17 19:02:40 +0200 |
|---|---|---|
| committer | Guillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com> | 2022-08-18 09:59:46 +0200 |
| commit | 47f580838db0185292c989fb448f2bcb6ab33dac (patch) | |
| tree | 3b4dc41652e671a74903f96f7f6582d87b6049ac /app/src/main/java/foundation/e/privacycentralapp/features | |
| parent | 8884e0423a4e50406b221ee07321a8560bb7420c (diff) | |
| download | advanced-privacy-47f580838db0185292c989fb448f2bcb6ab33dac.tar.gz | |
5842: fix real location never fix in A-P UI
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp/features')
| -rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt index d98cb5d..2e014e2 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt @@ -135,6 +135,15 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location) bindClickListeners() render(viewModel.state.value) + viewLifecycleOwner.lifecycleScope.launch { + viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { + viewModel.singleEvents.collect { event -> + if (event is FakeLocationViewModel.SingleEvent.LocationUpdatedEvent) { + updateLocation(event.location, event.mode) + } + } + } + } } } @@ -156,9 +165,6 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location) is FakeLocationViewModel.SingleEvent.ErrorEvent -> { displayToast(event.error) } - is FakeLocationViewModel.SingleEvent.LocationUpdatedEvent -> { - updateLocation(event.location, event.mode) - } is FakeLocationViewModel.SingleEvent.RequestLocationPermission -> { // TODO for standalone: rationale dialog locationPermissionRequest.launch(arrayOf( @@ -166,6 +172,9 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location) Manifest.permission.ACCESS_COARSE_LOCATION )) } + is FakeLocationViewModel.SingleEvent.LocationUpdatedEvent -> { + // Nothing here, another collect linked to mapbox view. + } } } } |
