diff options
Diffstat (limited to 'app/src/main/java/foundation/e')
2 files changed, 19 insertions, 6 deletions
diff --git a/app/src/main/java/foundation/e/advancedprivacy/domain/usecases/FakeLocationStateUseCase.kt b/app/src/main/java/foundation/e/advancedprivacy/domain/usecases/FakeLocationStateUseCase.kt index 76a1e69..b7743df 100644 --- a/app/src/main/java/foundation/e/advancedprivacy/domain/usecases/FakeLocationStateUseCase.kt +++ b/app/src/main/java/foundation/e/advancedprivacy/domain/usecases/FakeLocationStateUseCase.kt @@ -245,6 +245,20 @@ class FakeLocationStateUseCase( } fun routeStart() { + _configuredLocationMode.value = FakeLocationState( + LocationMode.ROUTE, + null, + null, + null, + null, + null, + null, + false, + localStateRepository.route, + localStateRepository.routeLoopEnabled, + true + ) + if (hasAcquireMockLocationPermission()) { fakeLocationModule.startFakeLocation() fakeLocationModule.routeStart(localStateRepository.route, localStateRepository.routeLoopEnabled) @@ -254,12 +268,8 @@ class FakeLocationStateUseCase( } fun routeStop() { - if (hasAcquireMockLocationPermission()) { - fakeLocationModule.stopFakeLocation() - fakeLocationModule.routeStop() - } else { - useRealLocation() - } + fakeLocationModule.routeStop() + useRealLocation() } val currentLocation = MutableStateFlow<Location?>(null) diff --git a/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt b/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt index 6dafd5d..33884f7 100644 --- a/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt +++ b/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt @@ -443,6 +443,9 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location) binding.buttonLocationRouteStart.isVisible = state.mode == LocationMode.ROUTE binding.buttonLocationRouteStop.isVisible = state.mode == LocationMode.ROUTE + binding.buttonLocationRouteStart.isEnabled = state.route != null + binding.checkboxRouteLoop.isEnabled = state.route != null + if(binding.checkboxRouteLoop.isVisible) binding.checkboxRouteLoop.isChecked = state.loopRoute |