From aa93b37883deb00c6ca74ad72a5464284fe9171f Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Thu, 4 Jan 2024 02:39:04 +0100 Subject: Added additional fake location parameters Bearing, Bearing jitter, Speed jitter, Altitude jitter --- .../domain/usecases/FakeLocationStateUseCase.kt | 40 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/foundation/e/advancedprivacy/domain') 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 b7743df..1f92554 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 @@ -54,7 +54,7 @@ class FakeLocationStateUseCase( coroutineScope: CoroutineScope ) { private val _configuredLocationMode = MutableStateFlow( - FakeLocationState(LocationMode.REAL_LOCATION, null, null, null, null, null, null, false, null, false, false) + FakeLocationState(LocationMode.REAL_LOCATION, null, null, null, null, null, null, null, null, null, null, false, null, false, false) ) val configuredLocationMode: StateFlow = _configuredLocationMode @@ -120,6 +120,10 @@ class FakeLocationStateUseCase( null, null, null, + null, + null, + null, + null, false, localStateRepository.route, isEnabled, @@ -129,13 +133,17 @@ class FakeLocationStateUseCase( localStateRepository.routeLoopEnabled = isEnabled } - fun setFakeLocationParameters(altitude: Float, speed: Float, jitter: Float) { + fun setFakeLocationParameters(altitude: Float, speed: Float, bearing: Float, jitter: Float, jitterAltitude: Float, jitterSpeed: Float, jitterBearing: Float) { _configuredLocationMode.value = FakeLocationState( LocationMode.SPECIFIC_LOCATION, null, altitude, speed, + bearing, jitter, + jitterAltitude, + jitterSpeed, + jitterBearing, localStateRepository.fakeLocation.first, localStateRepository.fakeLocation.second, false, @@ -146,7 +154,11 @@ class FakeLocationStateUseCase( localStateRepository.fakeAltitude = altitude localStateRepository.fakeSpeed = speed + localStateRepository.fakeBearing = bearing localStateRepository.fakeJitter = jitter + localStateRepository.fakeJitterAltitude = jitterAltitude + localStateRepository.fakeJitterSpeed = jitterSpeed + localStateRepository.fakeJitterBearing = jitterBearing } fun useRealLocation() { @@ -158,6 +170,10 @@ class FakeLocationStateUseCase( null, null, null, + null, + null, + null, + null, false, null, false, @@ -183,7 +199,11 @@ class FakeLocationStateUseCase( null, localStateRepository.fakeAltitude, localStateRepository.fakeSpeed, + localStateRepository.fakeBearing, localStateRepository.fakeJitter, + localStateRepository.fakeJitterAltitude, + localStateRepository.fakeJitterSpeed, + localStateRepository.fakeJitterBearing, location.first, location.second, false, @@ -197,7 +217,11 @@ class FakeLocationStateUseCase( localStateRepository.setLocationMode(LocationMode.SPECIFIC_LOCATION) fakeLocationModule.setFakeLocation(localStateRepository.fakeAltitude.toDouble(), localStateRepository.fakeSpeed, + localStateRepository.fakeBearing, localStateRepository.fakeJitter, + localStateRepository.fakeJitterAltitude.toDouble(), + localStateRepository.fakeJitterSpeed, + localStateRepository.fakeJitterBearing, localStateRepository.fakeLocation.first.toDouble(), localStateRepository.fakeLocation.second.toDouble()) } else { @@ -215,6 +239,10 @@ class FakeLocationStateUseCase( null, null, null, + null, + null, + null, + null, false, route ?: localStateRepository.route, localStateRepository.routeLoopEnabled, @@ -235,6 +263,10 @@ class FakeLocationStateUseCase( null, null, null, + null, + null, + null, + null, false, route, localStateRepository.routeLoopEnabled, @@ -253,6 +285,10 @@ class FakeLocationStateUseCase( null, null, null, + null, + null, + null, + null, false, localStateRepository.route, localStateRepository.routeLoopEnabled, -- cgit v1.2.3