diff --git a/app/src/androidTest/java/org/eu/exodus_privacy/exodusprivacy/ExodusDataStoreRepositoryTest.kt b/app/src/androidTest/java/org/eu/exodus_privacy/exodusprivacy/ExodusDataStoreRepositoryTest.kt index 5065b672..bb4b2245 100644 --- a/app/src/androidTest/java/org/eu/exodus_privacy/exodusprivacy/ExodusDataStoreRepositoryTest.kt +++ b/app/src/androidTest/java/org/eu/exodus_privacy/exodusprivacy/ExodusDataStoreRepositoryTest.kt @@ -45,7 +45,6 @@ class ExodusDataStoreRepositoryTest { // then assert(defaults.containsValue(ExodusConfig("privacy_policy_consent", false))) - assert(defaults.containsValue(ExodusConfig("is_setup_complete", false))) assert(defaults.containsValue(ExodusConfig("notification_requested", false))) } @@ -62,7 +61,6 @@ class ExodusDataStoreRepositoryTest { val newValues = mapOf( "privacy_policy" to ExodusConfig("privacy_policy_consent", true), - "app_setup" to ExodusConfig("is_setup_complete", true), "notification_perm" to ExodusConfig("notification_requested", true) ) @@ -72,33 +70,6 @@ class ExodusDataStoreRepositoryTest { // then assert(values.containsValue(ExodusConfig("privacy_policy_consent", true))) - assert(values.containsValue(ExodusConfig("is_setup_complete", true))) assert(values.containsValue(ExodusConfig("notification_requested", true))) } - - @Test - fun testInsertsAppSetupCorrectly() = runTest { - // given - dataStoreRepository = ExodusDataStoreRepository( - Gson(), - stringPreferencesKey("testKey"), - object : TypeToken>() {}, - DataStoreName("testDataStore3"), - context - ) - - val values = mapOf( - "privacy_policy" to ExodusConfig("privacy_policy_consent", true), - "app_setup" to ExodusConfig("is_setup_complete", true), - "notification_perm" to ExodusConfig("notification_requested", true) - ) - - // when - dataStoreRepository.insert(values) - dataStoreRepository.insertAppSetup(ExodusConfig("is_setup_complete", false)) - val appSetup = dataStoreRepository.get("app_setup").first() - - // then - assert(appSetup == ExodusConfig("is_setup_complete", false)) - } } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ExodusUpdateService.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ExodusUpdateService.kt index b0e21589..2af00827 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ExodusUpdateService.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ExodusUpdateService.kt @@ -31,8 +31,6 @@ import org.eu.exodus_privacy.exodusprivacy.manager.network.ExodusAPIRepository import org.eu.exodus_privacy.exodusprivacy.manager.network.NetworkManager import org.eu.exodus_privacy.exodusprivacy.manager.network.data.AppDetails import org.eu.exodus_privacy.exodusprivacy.manager.packageinfo.ExodusPackageRepository -import org.eu.exodus_privacy.exodusprivacy.manager.storage.ExodusConfig -import org.eu.exodus_privacy.exodusprivacy.manager.storage.ExodusDataStoreRepository import org.eu.exodus_privacy.exodusprivacy.objects.Application import javax.inject.Inject @@ -78,9 +76,6 @@ class ExodusUpdateService : LifecycleService() { @Inject lateinit var exodusDatabaseRepository: ExodusDatabaseRepository - @Inject - lateinit var exodusDataStoreRepository: ExodusDataStoreRepository - @Inject lateinit var notificationBuilder: NotificationCompat.Builder @@ -264,12 +259,6 @@ class ExodusUpdateService : LifecycleService() { exodusDatabaseRepository.saveApp(it) } Log.d(TAG, "Done saving app details.") - exodusDataStoreRepository.insertAppSetup( - ExodusConfig( - "is_setup_complete", - true - ) - ) // We are done, gracefully exit! stopService() } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.kt index 086bee5f..5e5c9f5f 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.kt @@ -96,8 +96,7 @@ class MainActivity : AppCompatActivity() { private fun startInitial() { viewModel.config.observe(this) { config -> - if (!config["app_setup"]?.enable!! && - config["privacy_policy"]?.enable!! && + if (config["privacy_policy"]?.enable!! && !ExodusUpdateService.IS_SERVICE_RUNNING ) { Log.d( diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/dialog/ExodusDialogFragment.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/dialog/ExodusDialogFragment.kt index 8406b855..d034a82a 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/dialog/ExodusDialogFragment.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/dialog/ExodusDialogFragment.kt @@ -78,7 +78,7 @@ class ExodusDialogFragment : DialogFragment() { private fun startInitial() { exodusDialogViewModel.config.observe(this) { config -> - if (!config["app_setup"]?.enable!! && config["privacy_policy"]?.enable!! && !ExodusUpdateService.IS_SERVICE_RUNNING) { + if (config["privacy_policy"]?.enable!! && !ExodusUpdateService.IS_SERVICE_RUNNING) { Log.d(TAG, "Populating database for the first time.") val intent = Intent(requireContext(), ExodusUpdateService::class.java) intent.apply { diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/packageinfo/ExodusPackageRepository.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/packageinfo/ExodusPackageRepository.kt index 71d203e3..ffa5346b 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/packageinfo/ExodusPackageRepository.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/packageinfo/ExodusPackageRepository.kt @@ -45,7 +45,7 @@ class ExodusPackageRepository @Inject constructor( permissionsMap[packageInfo.packageName] ?: emptyList(), getAppStore(packageInfo.packageName, packageManager) ) - Log.d(TAG, "Add app: $app") + Log.d(TAG, "Add app: ${app.name}, ${app.versionName}") applicationList.add(app) } applicationList.sortBy { it.name } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusDataStoreRepository.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusDataStoreRepository.kt index 8ec0fdd8..5c3cbe9f 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusDataStoreRepository.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusDataStoreRepository.kt @@ -8,7 +8,6 @@ import com.google.gson.Gson import com.google.gson.reflect.TypeToken import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.map import javax.inject.Inject @@ -34,7 +33,6 @@ class ExodusDataStoreRepository @Inject constructor( return gson.toJson( mapOf( "privacy_policy" to ExodusConfig("privacy_policy_consent", false), - "app_setup" to ExodusConfig("is_setup_complete", false), "notification_perm" to ExodusConfig("notification_requested", false) ) ) @@ -61,15 +59,6 @@ class ExodusDataStoreRepository @Inject constructor( } } - override suspend fun insertAppSetup(data: ExodusConfig) { - val currentData = getAll().first() as MutableMap - currentData["app_setup"] = data - dataStore.edit { - val jsonString = gson.toJson(currentData, typeToken.type) - it[preferenceKey] = jsonString - } - } - override fun clearAll(): Flow { return flow { dataStore.edit { diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusStorage.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusStorage.kt index 3901276c..f5a9b416 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusStorage.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/storage/ExodusStorage.kt @@ -5,8 +5,6 @@ import kotlinx.coroutines.flow.Flow interface ExodusStorage { suspend fun insert(data: Map) - suspend fun insertAppSetup(data: T) - fun get(key: String): Flow fun getAll(): Flow>