Loading app/src/main/AndroidManifest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,12 @@ </intent-filter> </receiver> <receiver android:name=".setup.signin.LocaleChangedBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.LOCALE_CHANGED"/> </intent-filter> </receiver> <!-- If you want to disable android.startup completely. --> <provider android:name="androidx.startup.InitializationProvider" Loading app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt +2 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import retrofit2.Retrofit import retrofit2.converter.jackson.JacksonConverterFactory import retrofit2.converter.moshi.MoshiConverterFactory import java.net.ConnectException import java.util.Locale import javax.inject.Named import javax.inject.Singleton Loading Loading @@ -120,7 +121,7 @@ object RetrofitModule { builder.header( "User-Agent", "Dalvik/2.1.0 (Linux; U; Android ${Build.VERSION.RELEASE}; ${Build.FINGERPRINT})" ) ).header("Accept-Language", Locale.getDefault().language) try { return@Interceptor chain.proceed(builder.build()) } catch (e: ConnectException) { Loading app/src/main/java/foundation/e/apps/api/gplay/GPlayAPIImpl.kt +12 −6 Original line number Diff line number Diff line Loading @@ -18,8 +18,15 @@ package foundation.e.apps.api.gplay import android.content.Context import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.* import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.Category import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import com.aurora.gplayapi.data.models.StreamBundle import com.aurora.gplayapi.data.models.StreamCluster import com.aurora.gplayapi.helpers.AppDetailsHelper import com.aurora.gplayapi.helpers.AuthValidator import com.aurora.gplayapi.helpers.CategoryHelper Loading @@ -27,6 +34,7 @@ import com.aurora.gplayapi.helpers.PurchaseHelper import com.aurora.gplayapi.helpers.SearchHelper import com.aurora.gplayapi.helpers.StreamHelper import com.aurora.gplayapi.helpers.TopChartsHelper import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.api.gplay.token.TokenRepository import foundation.e.apps.api.gplay.utils.GPlayHttpClient import foundation.e.apps.utils.modules.DataStoreModule Loading @@ -34,10 +42,10 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.supervisorScope import kotlinx.coroutines.withContext import java.util.Locale import javax.inject.Inject class GPlayAPIImpl @Inject constructor( @ApplicationContext private val context: Context, private val tokenRepository: TokenRepository, private val dataStoreModule: DataStoreModule, private val gPlayHttpClient: GPlayHttpClient Loading @@ -47,7 +55,7 @@ class GPlayAPIImpl @Inject constructor( suspend fun fetchAuthData() = withContext(Dispatchers.IO) { val data = async { tokenRepository.getAuthData() } data.await()?.let { it.locale = Locale.getDefault() // update locale with the default locale from settings it.locale = context.resources.configuration.locales[0] // update locale with the default locale from settings dataStoreModule.saveCredentials(it) } } Loading Loading @@ -186,7 +194,6 @@ class GPlayAPIImpl @Inject constructor( urlList.addAll(streamClusters.map { it.clusterBrowseUrl }) nextStreamBundleUrl = streamBundle.streamNextPageUrl } while (nextStreamBundleUrl.isNotBlank()) } } Loading Loading @@ -265,7 +272,6 @@ class GPlayAPIImpl @Inject constructor( } nextStreamBundleUrl = streamBundle.streamNextPageUrl } while (streamBundle.hasNext()) // TODO: DEAL WITH DUPLICATE AND LESS ITEMS Loading app/src/main/java/foundation/e/apps/setup/signin/LocaleChangedBroadcastReceiver.kt 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * 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 <https://www.gnu.org/licenses/>. */ 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() } } } } app/src/main/java/foundation/e/apps/applicationlist/ApplicationListViewModel.kt +1 −1 File changed.Contains only whitespace changes. Show changes Loading
app/src/main/AndroidManifest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,12 @@ </intent-filter> </receiver> <receiver android:name=".setup.signin.LocaleChangedBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.LOCALE_CHANGED"/> </intent-filter> </receiver> <!-- If you want to disable android.startup completely. --> <provider android:name="androidx.startup.InitializationProvider" Loading
app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt +2 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import retrofit2.Retrofit import retrofit2.converter.jackson.JacksonConverterFactory import retrofit2.converter.moshi.MoshiConverterFactory import java.net.ConnectException import java.util.Locale import javax.inject.Named import javax.inject.Singleton Loading Loading @@ -120,7 +121,7 @@ object RetrofitModule { builder.header( "User-Agent", "Dalvik/2.1.0 (Linux; U; Android ${Build.VERSION.RELEASE}; ${Build.FINGERPRINT})" ) ).header("Accept-Language", Locale.getDefault().language) try { return@Interceptor chain.proceed(builder.build()) } catch (e: ConnectException) { Loading
app/src/main/java/foundation/e/apps/api/gplay/GPlayAPIImpl.kt +12 −6 Original line number Diff line number Diff line Loading @@ -18,8 +18,15 @@ package foundation.e.apps.api.gplay import android.content.Context import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.* import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.Category import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import com.aurora.gplayapi.data.models.StreamBundle import com.aurora.gplayapi.data.models.StreamCluster import com.aurora.gplayapi.helpers.AppDetailsHelper import com.aurora.gplayapi.helpers.AuthValidator import com.aurora.gplayapi.helpers.CategoryHelper Loading @@ -27,6 +34,7 @@ import com.aurora.gplayapi.helpers.PurchaseHelper import com.aurora.gplayapi.helpers.SearchHelper import com.aurora.gplayapi.helpers.StreamHelper import com.aurora.gplayapi.helpers.TopChartsHelper import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.api.gplay.token.TokenRepository import foundation.e.apps.api.gplay.utils.GPlayHttpClient import foundation.e.apps.utils.modules.DataStoreModule Loading @@ -34,10 +42,10 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.supervisorScope import kotlinx.coroutines.withContext import java.util.Locale import javax.inject.Inject class GPlayAPIImpl @Inject constructor( @ApplicationContext private val context: Context, private val tokenRepository: TokenRepository, private val dataStoreModule: DataStoreModule, private val gPlayHttpClient: GPlayHttpClient Loading @@ -47,7 +55,7 @@ class GPlayAPIImpl @Inject constructor( suspend fun fetchAuthData() = withContext(Dispatchers.IO) { val data = async { tokenRepository.getAuthData() } data.await()?.let { it.locale = Locale.getDefault() // update locale with the default locale from settings it.locale = context.resources.configuration.locales[0] // update locale with the default locale from settings dataStoreModule.saveCredentials(it) } } Loading Loading @@ -186,7 +194,6 @@ class GPlayAPIImpl @Inject constructor( urlList.addAll(streamClusters.map { it.clusterBrowseUrl }) nextStreamBundleUrl = streamBundle.streamNextPageUrl } while (nextStreamBundleUrl.isNotBlank()) } } Loading Loading @@ -265,7 +272,6 @@ class GPlayAPIImpl @Inject constructor( } nextStreamBundleUrl = streamBundle.streamNextPageUrl } while (streamBundle.hasNext()) // TODO: DEAL WITH DUPLICATE AND LESS ITEMS Loading
app/src/main/java/foundation/e/apps/setup/signin/LocaleChangedBroadcastReceiver.kt 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * 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 <https://www.gnu.org/licenses/>. */ 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() } } } }
app/src/main/java/foundation/e/apps/applicationlist/ApplicationListViewModel.kt +1 −1 File changed.Contains only whitespace changes. Show changes