diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c9eae0e242fe2767335240c7eb7a6a701113495e..78fba17b62274128da0d3923a806e658feb3208e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -82,6 +82,12 @@ + + + + + + - list.addAll(streamCluster.clusterAppList) // Add all apps for this StreamCluster + list.addAll(streamCluster.clusterAppList) // Add all apps for this StreamCluster // Loop over possible next StreamClusters var currentStreamCluster = streamCluster @@ -265,7 +272,6 @@ class GPlayAPIImpl @Inject constructor( } nextStreamBundleUrl = streamBundle.streamNextPageUrl - } while (streamBundle.hasNext()) // TODO: DEAL WITH DUPLICATE AND LESS ITEMS diff --git a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListViewModel.kt b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListViewModel.kt index 795fdbd9724e9f2d8426ec946ea4a1373183e2b5..cd710a7317b7dbe1298980645515b7e903bc167d 100644 --- a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListViewModel.kt +++ b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListViewModel.kt @@ -125,7 +125,7 @@ class ApplicationListViewModel @Inject constructor( val existingPackageNames = newList.map { it.package_name } newList.addAll(first.filter { it.package_name !in existingPackageNames }) appListLiveData.postValue(newList) - nextClusterUrl = second // set the next "clusterNextPageUrl" + nextClusterUrl = second // set the next "clusterNextPageUrl" } } } diff --git a/app/src/main/java/foundation/e/apps/setup/signin/LocaleChangedBroadcastReceiver.kt b/app/src/main/java/foundation/e/apps/setup/signin/LocaleChangedBroadcastReceiver.kt new file mode 100644 index 0000000000000000000000000000000000000000..23339f87c5d1392d87d4c1ed985031afe61cd12b --- /dev/null +++ b/app/src/main/java/foundation/e/apps/setup/signin/LocaleChangedBroadcastReceiver.kt @@ -0,0 +1,58 @@ +/* + * Apps Quickly and easily install Android apps onto your device! + * Copyright (C) 2022 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 . + */ + +package foundation.e.apps.setup.signin + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import com.aurora.gplayapi.data.models.AuthData +import com.google.gson.Gson +import dagger.hilt.android.AndroidEntryPoint +import foundation.e.apps.utils.modules.DataStoreModule +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import okhttp3.Cache +import javax.inject.Inject + +@AndroidEntryPoint +@DelicateCoroutinesApi +class LocaleChangedBroadcastReceiver : BroadcastReceiver() { + + @Inject + lateinit var dataStoreModule: DataStoreModule + @Inject + lateinit var gson: Gson + @Inject + lateinit var cache: Cache + + override fun onReceive(context: Context, intent: Intent) { + GlobalScope.launch { + val authDataJson = dataStoreModule.getAuthDataSync() + val authData = gson.fromJson(authDataJson, AuthData::class.java) + authData.locale = context.resources.configuration.locales[0] + dataStoreModule.saveCredentials(authData) + withContext(Dispatchers.IO) { + cache.evictAll() + } + } + } +}