diff options
author | jacquarg <guillaume.jacquart@hoodbrains.com> | 2021-10-30 10:39:26 +0200 |
---|---|---|
committer | jacquarg <guillaume.jacquart@hoodbrains.com> | 2021-10-30 10:39:26 +0200 |
commit | 880a48c87686dfc976a11ade9429bc9c50d4c7f2 (patch) | |
tree | d4fcdf3b712ae1b95f2b7c979ee3a6e66b683880 /app/src | |
parent | 2ec4e4e78d28cbf703eefe2497a01d37af7b1c35 (diff) |
WIP fix location feature
Diffstat (limited to 'app/src')
3 files changed, 66 insertions, 2 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt new file mode 100644 index 0000000..6d13f0e --- /dev/null +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package foundation.e.privacycentralapp.domain.usecases + +/*import android.app.AppOpsManager +import android.content.Intent +import android.util.Log +import foundation.e.privacycentralapp.data.repositories.LocalStateRepository +import foundation.e.privacycentralapp.domain.entities.LocationMode +import foundation.e.privacycentralapp.features.location.LocationApiDelegate +import foundation.e.privacymodules.location.IFakeLocation +import foundation.e.privacymodules.permissions.PermissionsPrivacyModule +import foundation.e.privacymodules.permissions.data.AppOpModes +import foundation.e.privacymodules.permissions.data.ApplicationDescription +import kotlinx.coroutines.CoroutineScope + +class FakeLocationStateUseCase( + private val fakeLocationModule: IFakeLocation, + private val permissionsModule: PermissionsPrivacyModule, + private val localStateRepository: LocalStateRepository, + private val appDesc: ApplicationDescription, + private val coroutineScope: CoroutineScope +) { + + private fun acquireLocationPermission() { + try { + + permissionsModule.setAppOpMode( + appDesc, AppOpsManager.OPSTR_COARSE_LOCATION, + AppOpModes.ALLOWED + ) + permissionsModule.setAppOpMode( + appDesc, AppOpsManager.OPSTR_FINE_LOCATION, + AppOpModes.ALLOWED + ) + } catch (e: Exception) { + // Log.e(TAG, "Can't start RealLocation", e) + } + } + + private fun applySettings(isQuickPrivacyEnabled: Boolean, fakeLocationMode: LocationMode) { + when { + // isQuickPrivacyEnabled -> + } + } + + +}*/ diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt index a6bf50b..3db5674 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt @@ -65,7 +65,6 @@ class IpScramblingStateUseCase( init { coroutineScope.launch { localStateRepository.quickPrivacyEnabledFlow.collect { - Log.d("testQPFlow", "QuickPrivacy enabled: $it") applySettings(it, localStateRepository.isIpScramblingEnabled) } } diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt index e9fb078..b16af28 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt @@ -45,7 +45,9 @@ class FakeLocationFeature( { message -> Log.d("FakeLocationFeature", message) }, singleEventProducer ) { - data class State(val location: Location) + data class State( + val location: Location + ) sealed class SingleEvent { object RandomLocationSelectedEvent : SingleEvent() |