diff options
3 files changed, 20 insertions, 7 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 diff --git a/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt index d13e263..f9a3c52 100644 --- a/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt +++ b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt @@ -207,7 +207,7 @@ class FakeLocationService : Service() { override fun onTick(millisUntilFinished: Long) { var coord = calculateRouteSegment() if(coord == null) { - // done with route + fakeLocationModule.routeStop() return } try { |