Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 880a48c8 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

WIP fix location feature

parent 2ec4e4e7
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
/*
 * 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 ->
        }
    }


}*/
+0 −1
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ class IpScramblingStateUseCase(
    init {
        coroutineScope.launch {
            localStateRepository.quickPrivacyEnabledFlow.collect {
                Log.d("testQPFlow", "QuickPrivacy enabled: $it")
                applySettings(it, localStateRepository.isIpScramblingEnabled)
            }
        }
+3 −1
Original line number Diff line number Diff line
@@ -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()