From 911b919cfdd826b336873fe3b78d89a4d4aa26f9 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 21 Mar 2024 05:17:55 +0530 Subject: [PATCH 01/14] fix cancelable on ApplicationDialogFragment --- .../apps/ui/application/subFrags/ApplicationDialogFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/ui/application/subFrags/ApplicationDialogFragment.kt b/app/src/main/java/foundation/e/apps/ui/application/subFrags/ApplicationDialogFragment.kt index c5702ec9d..5d7bd3e85 100644 --- a/app/src/main/java/foundation/e/apps/ui/application/subFrags/ApplicationDialogFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/application/subFrags/ApplicationDialogFragment.kt @@ -63,8 +63,9 @@ class ApplicationDialogFragment() : DialogFragment() { this.positiveButtonAction = positiveButtonAction this.cancelButtonText = cancelButtonText this.cancelButtonAction = cancelButtonAction - this.cancellable = cancellable this.onDismissListener = onDismissListener + this.cancellable = cancellable + isCancelable = cancellable } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { @@ -77,7 +78,6 @@ class ApplicationDialogFragment() : DialogFragment() { positiveButtonAction?.invoke() this.dismiss() } - .setCancelable(cancellable) if (cancelButtonText?.isNotEmpty() == true) { materialAlertDialogBuilder.setNegativeButton(cancelButtonText) { _, _ -> cancelButtonAction?.invoke() -- GitLab From c4de370e0c357930e5a8388734668bbc8f10b4a6 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 21 Mar 2024 05:28:22 +0530 Subject: [PATCH 02/14] use ApplicationDialogFragment to show dialog for session expiry --- .../java/foundation/e/apps/MainActivity.kt | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index 9ec898a0b..bb8b82b6c 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -70,6 +70,7 @@ class MainActivity : AppCompatActivity() { companion object { private val TAG = MainActivity::class.java.simpleName + private val SESSION_DIALOG_TAG = "session_dialog" } override fun onCreate(savedInstanceState: Bundle?) { @@ -407,21 +408,30 @@ class MainActivity : AppCompatActivity() { appEvent is AppEvent.TooManyRequests }.collectLatest { val shouldShowDialog = viewModel.shouldRefreshSession() - if (shouldShowDialog) { - binding.sessionErrorLayout.visibility = View.VISIBLE - binding.retrySessionButton.setOnClickListener { onRefreshSessionClick() } - binding.ignoreSessionButton.setOnClickListener { onIgnoreSessionClick() } + val isDialogShowing = supportFragmentManager.findFragmentByTag(SESSION_DIALOG_TAG) != null + if (shouldShowDialog && !isDialogShowing) { + ApplicationDialogFragment( + title = "", + message = getString(R.string.too_many_requests_desc), + positiveButtonText = getString(R.string.refresh_session), + positiveButtonAction = { + onRefreshSessionClick() + }, + cancelButtonText = getString(R.string.ignore).uppercase(), + cancelButtonAction = { + onIgnoreSessionClick() + }, + cancellable = false, + ).show(supportFragmentManager, SESSION_DIALOG_TAG) } } } private fun onIgnoreSessionClick() { viewModel.updateIgnoreRefreshPreference(true) - binding.sessionErrorLayout.visibility = View.GONE } private fun onRefreshSessionClick() { - binding.sessionErrorLayout.visibility = View.GONE refreshSession() } -- GitLab From 266dcc75659c5efc5e1d074df519cefd9f1bef8f Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 21 Mar 2024 05:28:54 +0530 Subject: [PATCH 03/14] remove old banner --- app/src/main/res/layout/activity_main.xml | 65 ----------------------- 1 file changed, 65 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 66ff2e512..b2056ce54 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -23,71 +23,6 @@ android:layout_height="match_parent" tools:context=".MainActivity"> - - - - - - - - - - - - - Date: Mon, 25 Mar 2024 19:26:56 +0530 Subject: [PATCH 04/14] fix regressions --- .../java/foundation/e/apps/MainActivity.kt | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index bb8b82b6c..d399a58af 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -124,17 +124,6 @@ class MainActivity : AppCompatActivity() { observeEvents() } - override fun onStart() { - super.onStart() - checkSessionRefresh() - } - - private fun checkSessionRefresh() { - if (viewModel.shouldRefreshSession()) { - refreshSession() - } - } - private fun refreshSession() { loginViewModel.startLoginFlow(listOf(PlayStoreAuthenticator::class.java.simpleName)) } @@ -146,6 +135,7 @@ class MainActivity : AppCompatActivity() { override fun onBackPressed() { if (isInitialScreen()) { resetIgnoreStatusForSessionRefresh() + finish() } super.onBackPressed() } @@ -168,7 +158,7 @@ class MainActivity : AppCompatActivity() { if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { onBackInvokedDispatcher.registerOnBackInvokedCallback(PRIORITY_DEFAULT) { resetIgnoreStatusForSessionRefresh() - super.onBackPressed() // Deprecated for Android 13+ + finish() } } } @@ -415,7 +405,7 @@ class MainActivity : AppCompatActivity() { message = getString(R.string.too_many_requests_desc), positiveButtonText = getString(R.string.refresh_session), positiveButtonAction = { - onRefreshSessionClick() + refreshSession() }, cancelButtonText = getString(R.string.ignore).uppercase(), cancelButtonAction = { @@ -431,10 +421,6 @@ class MainActivity : AppCompatActivity() { viewModel.updateIgnoreRefreshPreference(true) } - private fun onRefreshSessionClick() { - refreshSession() - } - private fun setupBottomNavItemSelectedListener( bottomNavigationView: BottomNavigationView, navHostFragment: NavHostFragment, -- GitLab From 27f7697308695b2bd49542e28daa0a61f407d420 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 00:49:06 +0530 Subject: [PATCH 05/14] Remove SessionPreference.kt and use variable to track session ignore --- .../java/foundation/e/apps/MainActivity.kt | 10 +++-- .../java/foundation/e/apps/data/Constants.kt | 2 - .../apps/data/preference/SessionPreference.kt | 41 ------------------- .../e/apps/ui/MainActivityViewModel.kt | 10 ----- 4 files changed, 7 insertions(+), 56 deletions(-) delete mode 100644 app/src/main/java/foundation/e/apps/data/preference/SessionPreference.kt diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index d399a58af..cf9a020b8 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -68,6 +68,8 @@ class MainActivity : AppCompatActivity() { private lateinit var binding: ActivityMainBinding private lateinit var viewModel: MainActivityViewModel + private var shouldIgnoreSessionError = false + companion object { private val TAG = MainActivity::class.java.simpleName private val SESSION_DIALOG_TAG = "session_dialog" @@ -121,6 +123,8 @@ class MainActivity : AppCompatActivity() { viewModel.updateAppWarningList() + shouldIgnoreSessionError = false + observeEvents() } @@ -150,7 +154,7 @@ class MainActivity : AppCompatActivity() { } private fun resetIgnoreStatusForSessionRefresh() { - viewModel.updateIgnoreRefreshPreference(ignore = false) + shouldIgnoreSessionError = false } @Suppress("DEPRECATION") @@ -397,7 +401,7 @@ class MainActivity : AppCompatActivity() { EventBus.events.filter { appEvent -> appEvent is AppEvent.TooManyRequests }.collectLatest { - val shouldShowDialog = viewModel.shouldRefreshSession() + val shouldShowDialog = !shouldIgnoreSessionError val isDialogShowing = supportFragmentManager.findFragmentByTag(SESSION_DIALOG_TAG) != null if (shouldShowDialog && !isDialogShowing) { ApplicationDialogFragment( @@ -418,7 +422,7 @@ class MainActivity : AppCompatActivity() { } private fun onIgnoreSessionClick() { - viewModel.updateIgnoreRefreshPreference(true) + shouldIgnoreSessionError = true } private fun setupBottomNavItemSelectedListener( diff --git a/app/src/main/java/foundation/e/apps/data/Constants.kt b/app/src/main/java/foundation/e/apps/data/Constants.kt index 7e7bac60d..09b79b972 100644 --- a/app/src/main/java/foundation/e/apps/data/Constants.kt +++ b/app/src/main/java/foundation/e/apps/data/Constants.kt @@ -30,6 +30,4 @@ object Constants { const val ACTION_DUMP_APP_INSTALL_STATE = "foundation.e.apps.action.APP_INSTALL_STATE" const val TAG_APP_INSTALL_STATE = "APP_INSTALL_STATE" - - const val PREFERENCE_IGNORE_SESSION_REFRESH = "ignoreSessionRefresh" } diff --git a/app/src/main/java/foundation/e/apps/data/preference/SessionPreference.kt b/app/src/main/java/foundation/e/apps/data/preference/SessionPreference.kt deleted file mode 100644 index c5a50d3d2..000000000 --- a/app/src/main/java/foundation/e/apps/data/preference/SessionPreference.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021-2024 MURENA SAS - * - * 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.data.preference - -import android.content.Context -import androidx.preference.PreferenceManager -import dagger.hilt.android.qualifiers.ApplicationContext -import foundation.e.apps.data.Constants.PREFERENCE_IGNORE_SESSION_REFRESH -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class SessionPreference @Inject constructor( - @ApplicationContext private val context: Context -) { - private val preferenceManager = PreferenceManager.getDefaultSharedPreferences(context) - - fun shouldIgnoreSessionRefresh(): Boolean { - return preferenceManager.getBoolean(PREFERENCE_IGNORE_SESSION_REFRESH, false) - } - - fun updateIgnoreSessionRefreshPreference(ignore: Boolean) { - preferenceManager.edit().putBoolean(PREFERENCE_IGNORE_SESSION_REFRESH, ignore).apply() - } -} diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt index 3401e3c12..f5039ca0c 100644 --- a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt +++ b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt @@ -42,7 +42,6 @@ import foundation.e.apps.data.enums.isUnFiltered import foundation.e.apps.data.fusedDownload.FusedManagerRepository import foundation.e.apps.data.fusedDownload.models.FusedDownload import foundation.e.apps.data.preference.AppLoungeDataStore -import foundation.e.apps.data.preference.SessionPreference import foundation.e.apps.data.preference.getSync import foundation.e.apps.install.pkg.AppLoungePackageManager import foundation.e.apps.install.pkg.PWAManager @@ -61,7 +60,6 @@ class MainActivityViewModel @Inject constructor( private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, private val appInstallProcessor: AppInstallProcessor, - private val sessionPreference: SessionPreference ) : ViewModel() { val tocStatus: LiveData = appLoungeDataStore.tocStatus.asLiveData() @@ -240,12 +238,4 @@ class MainActivityViewModel @Inject constructor( fun launchPwa(application: Application) { pwaManager.launchPwa(application) } - - fun updateIgnoreRefreshPreference(ignore: Boolean) { - sessionPreference.updateIgnoreSessionRefreshPreference(ignore) - } - - fun shouldRefreshSession(): Boolean { - return !sessionPreference.shouldIgnoreSessionRefresh() - } } -- GitLab From 235cedd1f139d1d112dad3a9d6e08e9746419599 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 15:32:09 +0530 Subject: [PATCH 06/14] move shouldIgnoreSessionError to MainActivityViewModel --- app/src/main/java/foundation/e/apps/MainActivity.kt | 10 +++------- .../java/foundation/e/apps/ui/MainActivityViewModel.kt | 2 ++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index cf9a020b8..3ab4ba754 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -68,8 +68,6 @@ class MainActivity : AppCompatActivity() { private lateinit var binding: ActivityMainBinding private lateinit var viewModel: MainActivityViewModel - private var shouldIgnoreSessionError = false - companion object { private val TAG = MainActivity::class.java.simpleName private val SESSION_DIALOG_TAG = "session_dialog" @@ -123,8 +121,6 @@ class MainActivity : AppCompatActivity() { viewModel.updateAppWarningList() - shouldIgnoreSessionError = false - observeEvents() } @@ -154,7 +150,7 @@ class MainActivity : AppCompatActivity() { } private fun resetIgnoreStatusForSessionRefresh() { - shouldIgnoreSessionError = false + viewModel.shouldIgnoreSessionError = false } @Suppress("DEPRECATION") @@ -401,7 +397,7 @@ class MainActivity : AppCompatActivity() { EventBus.events.filter { appEvent -> appEvent is AppEvent.TooManyRequests }.collectLatest { - val shouldShowDialog = !shouldIgnoreSessionError + val shouldShowDialog = !viewModel.shouldIgnoreSessionError val isDialogShowing = supportFragmentManager.findFragmentByTag(SESSION_DIALOG_TAG) != null if (shouldShowDialog && !isDialogShowing) { ApplicationDialogFragment( @@ -422,7 +418,7 @@ class MainActivity : AppCompatActivity() { } private fun onIgnoreSessionClick() { - shouldIgnoreSessionError = true + viewModel.shouldIgnoreSessionError = true } private fun setupBottomNavItemSelectedListener( diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt index f5039ca0c..9a54ffd78 100644 --- a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt +++ b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt @@ -82,6 +82,8 @@ class MainActivityViewModel @Inject constructor( lateinit var connectivityManager: ConnectivityManager + var shouldIgnoreSessionError = false + fun getUser(): User { return appLoungeDataStore.getUserType() } -- GitLab From b12e0225f24aae4b4e4338fce5601ca759931522 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 15:33:54 +0530 Subject: [PATCH 07/14] make session dialog cancellable --- app/src/main/java/foundation/e/apps/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index 3ab4ba754..cc9ae451c 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -411,7 +411,7 @@ class MainActivity : AppCompatActivity() { cancelButtonAction = { onIgnoreSessionClick() }, - cancellable = false, + cancellable = true, ).show(supportFragmentManager, SESSION_DIALOG_TAG) } } -- GitLab From 41f5ca388d96badc2500d645a43de18f320b9586 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 16:07:45 +0530 Subject: [PATCH 08/14] make session dialog conform to design --- .../java/foundation/e/apps/MainActivity.kt | 3 ++- app/src/main/res/drawable/ic_warning.xml | 26 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_warning.xml diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index cc9ae451c..5308946f9 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -401,8 +401,9 @@ class MainActivity : AppCompatActivity() { val isDialogShowing = supportFragmentManager.findFragmentByTag(SESSION_DIALOG_TAG) != null if (shouldShowDialog && !isDialogShowing) { ApplicationDialogFragment( - title = "", + title = getString(R.string.account_unavailable), message = getString(R.string.too_many_requests_desc), + drawable = R.drawable.ic_warning, positiveButtonText = getString(R.string.refresh_session), positiveButtonAction = { refreshSession() diff --git a/app/src/main/res/drawable/ic_warning.xml b/app/src/main/res/drawable/ic_warning.xml new file mode 100644 index 000000000..618cbc76e --- /dev/null +++ b/app/src/main/res/drawable/ic_warning.xml @@ -0,0 +1,26 @@ + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6a5387047..2cd4f7fb5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -182,6 +182,7 @@ More info The anonymous account you\'re currently using is unavailable. Please refresh the session to get another one. + Account unavailable REFRESH SESSION Error occurred while loading apps. -- GitLab From 9f66a36df93748d4e36dbb533532a09d3b7ff368 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 18:29:20 +0530 Subject: [PATCH 09/14] fix detekt --- app/src/main/java/foundation/e/apps/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index 5308946f9..52d595c2f 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -70,7 +70,7 @@ class MainActivity : AppCompatActivity() { companion object { private val TAG = MainActivity::class.java.simpleName - private val SESSION_DIALOG_TAG = "session_dialog" + private const val SESSION_DIALOG_TAG = "session_dialog" } override fun onCreate(savedInstanceState: Bundle?) { -- GitLab From d1239a05974b3a449adda902768c0ffc4db0ff78 Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Tue, 26 Mar 2024 13:31:39 +0000 Subject: [PATCH 10/14] Apply 1 suggestion(s) to 1 file(s) --- app/src/main/res/drawable/ic_warning.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/drawable/ic_warning.xml b/app/src/main/res/drawable/ic_warning.xml index 618cbc76e..872b7286e 100644 --- a/app/src/main/res/drawable/ic_warning.xml +++ b/app/src/main/res/drawable/ic_warning.xml @@ -1,6 +1,6 @@ - @@ -31,13 +13,13 @@ InstanceOfCheckForException:GPlayHttpClient.kt$GPlayHttpClient$e is SocketTimeoutException InvalidPackageDeclaration:Trackers.kt$package foundation.e.apps.data.exodus LargeClass:ApplicationFragment.kt$ApplicationFragment : TimeoutFragment - LongParameterList:ApplicationDialogFragment.kt$ApplicationDialogFragment$( drawable: Int = -1, title: String, message: String, positiveButtonText: String = "", positiveButtonAction: (() -> Unit)? = null, cancelButtonText: String = "", cancelButtonAction: (() -> Unit)? = null, cancellable: Boolean = true, onDismissListener: (() -> Unit)? = null, ) + LongParameterList:ApplicationDialogFragment.kt$ApplicationDialogFragment$( drawable: Int = -1, title: String, message: String, positiveButtonText: String = "", positiveButtonAction: (() -> Unit)? = null, cancelButtonText: String = "", cancelButtonAction: (() -> Unit)? = null, cancelable: Boolean = true, onDismissListener: (() -> Unit)? = null, ) LongParameterList:ApplicationListRVAdapter.kt$ApplicationListRVAdapter$( private val applicationInstaller: ApplicationInstaller, private val privacyInfoViewModel: PrivacyInfoViewModel, private val appInfoFetchViewModel: AppInfoFetchViewModel, private val mainActivityViewModel: MainActivityViewModel, private val currentDestinationId: Int, private var lifecycleOwner: LifecycleOwner?, private var paidAppHandler: ((Application) -> Unit)? = null ) LongParameterList:ApplicationViewModel.kt$ApplicationViewModel$( id: String, packageName: String, origin: Origin, isFdroidLink: Boolean, authObjectList: List<AuthObject>, retryBlock: (failedObjects: List<AuthObject>) -> Boolean, ) LongParameterList:CleanApkRetrofit.kt$CleanApkRetrofit$( @Query("keyword") keyword: String, @Query("source") source: String = APP_SOURCE_FOSS, @Query("type") type: String = APP_TYPE_ANY, @Query("nres") nres: Int = 20, @Query("page") page: Int = 1, @Query("by") by: String? = null, ) LongParameterList:EglExtensionProvider.kt$EglExtensionProvider$( egl10: EGL10, eglDisplay: EGLDisplay, eglConfig: EGLConfig?, ai: IntArray, ai1: IntArray?, set: MutableSet<String> ) LongParameterList:FusedManagerImpl.kt$FusedManagerImpl$( @Named("cacheDir") private val cacheDir: String, private val downloadManager: DownloadManager, private val notificationManager: NotificationManager, private val fusedDownloadRepository: FusedDownloadRepository, private val pwaManager: PWAManager, private val appLoungePackageManager: AppLoungePackageManager, @Named("download") private val downloadNotificationChannel: NotificationChannel, @Named("update") private val updateNotificationChannel: NotificationChannel, @ApplicationContext private val context: Context ) - LongParameterList:MainActivityViewModel.kt$MainActivityViewModel$( private val appLoungeDataStore: AppLoungeDataStore, private val applicationRepository: ApplicationRepository, private val fusedManagerRepository: FusedManagerRepository, private val appLoungePackageManager: AppLoungePackageManager, private val pwaManager: PWAManager, private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, private val appInstallProcessor: AppInstallProcessor, private val sessionPreference: SessionPreference ) + LongParameterList:MainActivityViewModel.kt$MainActivityViewModel$( private val appLoungeDataStore: AppLoungeDataStore, private val applicationRepository: ApplicationRepository, private val fusedManagerRepository: FusedManagerRepository, private val appLoungePackageManager: AppLoungePackageManager, private val pwaManager: PWAManager, private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, private val appInstallProcessor: AppInstallProcessor, ) LongParameterList:UpdatesManagerImpl.kt$UpdatesManagerImpl$( @ApplicationContext private val context: Context, private val appLoungePackageManager: AppLoungePackageManager, private val applicationRepository: ApplicationRepository, private val faultyAppRepository: FaultyAppRepository, private val appLoungePreference: AppLoungePreference, private val fdroidRepository: FdroidRepository, private val blockedAppRepository: BlockedAppRepository, ) LongParameterList:UpdatesWorker.kt$UpdatesWorker$( @Assisted private val context: Context, @Assisted private val params: WorkerParameters, private val updatesManagerRepository: UpdatesManagerRepository, private val dataStoreManager: DataStoreManager, private val authenticatorRepository: AuthenticatorRepository, private val appInstallProcessor: AppInstallProcessor, private val blockedAppRepository: BlockedAppRepository, ) MagicNumber:AnonymousLoginManager.kt$AnonymousLoginManager$200 @@ -74,7 +56,6 @@ MagicNumber:PackageInstallerService.kt$PackageInstallerService$69 MagicNumber:PkgManagerBR.kt$PkgManagerBR$69 MagicNumber:PlayStoreLoginWrapper.kt$PlayStoreLoginWrapper$200 - MagicNumber:RetrofitModule.kt$RetrofitModule$999 MagicNumber:ScreenshotRVAdapter.kt$ScreenshotRVAdapter$10f MagicNumber:ScreenshotRVAdapter.kt$ScreenshotRVAdapter$50f MagicNumber:StorageComputer.kt$StorageComputer$1000 @@ -83,12 +64,10 @@ MagicNumber:StorageComputer.kt$StorageComputer$999950 MagicNumber:TOSFragment.kt$TOSFragment$20 MaxLineLength:AppInstallProcessor.kt$AppInstallProcessor$"Enqueuing App install work is failed for ${fusedDownload.packageName} exception: ${e.localizedMessage}" - MaxLineLength:AppInstallProcessor.kt$AppInstallProcessor$fusedDownload.areFilesDownloaded() && (!fusedManagerRepository.isFusedDownloadInstalled(fusedDownload) || fusedDownload.status == Status.INSTALLING) MaxLineLength:AppPrivacyInfo.kt$AppPrivacyInfo MaxLineLength:ApplicationFragment.kt$ApplicationFragment.Companion$"https://gitlab.e.foundation/e/os/apps/-/blob/main/app/src/main/java/foundation/e/apps/data/exodus/repositories/PrivacyScoreRepositoryImpl.kt" MaxLineLength:CommonUtilsModule.kt$CommonUtilsModule$* MaxLineLength:DownloadManager.kt$DownloadManager$Timber.e("Download Issue: $downloadId : DownloadManager returns status: $status but the failed because: reason: $reason") - MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$"Download failed for ${fusedDownload.packageName}, " + "reason: " + "${downloadManager.getDownloadFailureReason(downloadId)}" MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$Timber.d("===> updateDownloadStatus: ${fusedDownload.name}: $downloadId: $numberOfDownloadedItems/${fusedDownload.downloadIdMap.size}") MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$if MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$numberOfDownloadedItems == fusedDownload.downloadIdMap.size && numberOfDownloadedItems == fusedDownload.downloadURLList.size @@ -112,13 +91,11 @@ PrintStackTrace:CommonUtilsModule.kt$CommonUtilsModule$e PrintStackTrace:EcloudRepository.kt$EcloudRepository$e PrintStackTrace:InstallWorkManager.kt$InstallWorkManager$e - PrintStackTrace:AppLoungePackageManager.kt$PkgManagerModule$e PrintStackTrace:PlayStoreAuthenticator.kt$PlayStoreAuthenticator$e PrintStackTrace:SystemInfoProvider.kt$SystemInfoProvider$e ProtectedMemberInFinalClass:ApplicationListFragment.kt$ApplicationListFragment$// protected to avoid SyntheticAccessor protected val args: ApplicationListFragmentArgs by navArgs() ProtectedMemberInFinalClass:ApplicationListFragment.kt$ApplicationListFragment$// protected to avoid SyntheticAccessor protected val viewModel: ApplicationListViewModel by viewModels() ProtectedMemberInFinalClass:GoogleSignInFragment.kt$GoogleSignInFragment$// protected to avoid SyntheticAccessor protected val viewModel: LoginViewModel by lazy { ViewModelProvider(requireActivity())[LoginViewModel::class.java] } - ProtectedMemberInFinalClass:MainActivityViewModel.kt$MainActivityViewModel$protected fun ProducerScope<Boolean>.sendInternetStatus(connectivityManager: ConnectivityManager) ProtectedMemberInFinalClass:SearchFragment.kt$SearchFragment$protected val searchViewModel: SearchViewModel by viewModels() ReturnCount:ApkSignatureManager.kt$ApkSignatureManager$private fun verifyAPKSignature( apkInputStream: BufferedInputStream, apkSignatureInputStream: InputStream, publicKeyInputStream: InputStream, packageName: String ): Boolean ReturnCount:AppInstallProcessor.kt$AppInstallProcessor$private suspend fun updateDownloadUrls(fusedDownload: FusedDownload): Boolean @@ -140,18 +117,19 @@ SpreadOperator:NativeDeviceInfoProviderModule.kt$NativeDeviceInfoProviderModule$(*systemSharedLibraryNames) SwallowedException:AppInfoFetchViewModel.kt$AppInfoFetchViewModel$e: Exception SwallowedException:AppInstallProcessor.kt$AppInstallProcessor$e: ApiException.AppNotPurchased + SwallowedException:AppLoungePackageManager.kt$AppLoungePackageManager$e: PackageManager.NameNotFoundException SwallowedException:ApplicationViewModel.kt$ApplicationViewModel$e: ApiException.AppNotFound SwallowedException:ApplicationViewModel.kt$ApplicationViewModel$e: Exception SwallowedException:GPlayHttpClient.kt$GPlayHttpClient$e: Exception SwallowedException:NativeDeviceInfoProviderModule.kt$NativeDeviceInfoProviderModule$e: Exception SwallowedException:NativeGsfVersionProvider.kt$NativeGsfVersionProvider$e: PackageManager.NameNotFoundException - SwallowedException:AppLoungePackageManager.kt$AppLoungePackageManager$e: PackageManager.NameNotFoundException SwallowedException:UpdatesManagerImpl.kt$UpdatesManagerImpl$e: Exception TooGenericExceptionCaught:AnonymousLoginManager.kt$AnonymousLoginManager$e: Exception TooGenericExceptionCaught:ApiCaller.kt$e: Exception TooGenericExceptionCaught:ApkSignatureManager.kt$ApkSignatureManager$e: Exception TooGenericExceptionCaught:AppInfoFetchViewModel.kt$AppInfoFetchViewModel$e: Exception TooGenericExceptionCaught:AppInstallProcessor.kt$AppInstallProcessor$e: Exception + TooGenericExceptionCaught:AppLoungePackageManager.kt$AppLoungePackageManager$e: Exception TooGenericExceptionCaught:ApplicationViewModel.kt$ApplicationViewModel$e: Exception TooGenericExceptionCaught:BlockedAppRepository.kt$BlockedAppRepository$exception: Exception TooGenericExceptionCaught:CommonUtilsModule.kt$CommonUtilsModule$e: Exception @@ -170,15 +148,14 @@ TooGenericExceptionCaught:NetworkHandler.kt$e: Exception TooGenericExceptionCaught:PWAManager.kt$PWAManager$e: Exception TooGenericExceptionCaught:PWAPlayerStatusReceiver.kt$PWAPlayerStatusReceiver$e: Exception - TooGenericExceptionCaught:AppLoungePackageManager.kt$AppLoungePackageManager$e: Exception TooGenericExceptionCaught:PlayStoreAuthenticator.kt$PlayStoreAuthenticator$e: Exception - TooGenericExceptionCaught:RetrofitModule.kt$RetrofitModule$e: Exception TooGenericExceptionCaught:SystemInfoProvider.kt$SystemInfoProvider$e: Exception TooGenericExceptionCaught:UpdatesManagerImpl.kt$UpdatesManagerImpl$e: Exception TooGenericExceptionCaught:UpdatesWorker.kt$UpdatesWorker$e: Throwable TooGenericExceptionThrown:AnonymousLoginManager.kt$AnonymousLoginManager$throw Exception( "Error fetching Anonymous credentials\n" + "Network code: ${response.code}\n" + "Success: ${response.isSuccessful}" + response.errorString.run { if (isNotBlank()) "\nError message: $this" else "" } ) TooGenericExceptionThrown:PlayStoreLoginWrapper.kt$PlayStoreLoginWrapper$throw Exception("Validation network code: ${response.code}") TooGenericExceptionThrown:PlayStoreLoginWrapper.kt$PlayStoreLoginWrapper$throw Exception(error) + TooManyFunctions:AppLoungePackageManager.kt$AppLoungePackageManager TooManyFunctions:ApplicationListFragment.kt$ApplicationListFragment : TimeoutFragmentApplicationInstaller TooManyFunctions:ApplicationRepository.kt$ApplicationRepository TooManyFunctions:FusedManagerImpl.kt$FusedManagerImpl : IFusedManager @@ -186,7 +163,6 @@ TooManyFunctions:HomeFragment.kt$HomeFragment : TimeoutFragmentApplicationInstaller TooManyFunctions:IFusedManager.kt$IFusedManager TooManyFunctions:MainActivityViewModel.kt$MainActivityViewModel : ViewModel - TooManyFunctions:AppLoungePackageManager.kt$AppLoungePackageManager TooManyFunctions:SearchFragment.kt$SearchFragment : TimeoutFragmentOnQueryTextListenerOnSuggestionListenerApplicationInstaller TooManyFunctions:TimeoutFragment.kt$TimeoutFragment : Fragment TooManyFunctions:UpdatesFragment.kt$UpdatesFragment : TimeoutFragmentApplicationInstaller -- GitLab From 6b07bcf8376be6a45047d453811ece3816662b06 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 19:25:18 +0530 Subject: [PATCH 13/14] refactor --- .../java/foundation/e/apps/MainActivity.kt | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index 799391568..7b2b1217c 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -397,27 +397,35 @@ class MainActivity : AppCompatActivity() { EventBus.events.filter { appEvent -> appEvent is AppEvent.TooManyRequests }.collectLatest { - val shouldShowDialog = !viewModel.shouldIgnoreSessionError - val isDialogShowing = supportFragmentManager.findFragmentByTag(SESSION_DIALOG_TAG) != null - if (shouldShowDialog && !isDialogShowing) { - ApplicationDialogFragment( - title = getString(R.string.account_unavailable), - message = getString(R.string.too_many_requests_desc), - drawable = R.drawable.ic_warning, - positiveButtonText = getString(R.string.refresh_session), - positiveButtonAction = { - refreshSession() - }, - cancelButtonText = getString(R.string.ignore).uppercase(), - cancelButtonAction = { - onIgnoreSessionClick() - }, - cancelable = true, - ).show(supportFragmentManager, SESSION_DIALOG_TAG) - } + handleRefreshSessionEvent() } } + private fun handleRefreshSessionEvent() { + val shouldShowDialog = !viewModel.shouldIgnoreSessionError + val isDialogShowing = supportFragmentManager.findFragmentByTag(SESSION_DIALOG_TAG) != null + if (shouldShowDialog && !isDialogShowing) { + showRefreshSessionDialog() + } + } + + private fun showRefreshSessionDialog() { + ApplicationDialogFragment( + title = getString(R.string.account_unavailable), + message = getString(R.string.too_many_requests_desc), + drawable = R.drawable.ic_warning, + positiveButtonText = getString(R.string.refresh_session), + positiveButtonAction = { + refreshSession() + }, + cancelButtonText = getString(R.string.ignore).uppercase(), + cancelButtonAction = { + onIgnoreSessionClick() + }, + cancelable = true, + ).show(supportFragmentManager, SESSION_DIALOG_TAG) + } + private fun onIgnoreSessionClick() { viewModel.shouldIgnoreSessionError = true } -- GitLab From ad92b86767b1e965b85815029761acaed4608a5e Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 26 Mar 2024 20:26:43 +0530 Subject: [PATCH 14/14] add translation for "Account unavailable" --- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-is/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-nb-rNO/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-uk/strings.xml | 1 + 12 files changed, 12 insertions(+) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4cb3a2fd6..47e45387d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -177,4 +177,5 @@ Split-Installationskanal Einloggen Ignorieren + Konto nicht verfügbar \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6d7a60c08..a3f4a8773 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -177,4 +177,5 @@ \n\t- mitigar el microtargeting \n - limitar el impacto en caso de que esta cuenta sea restringida por Google" Archivo adicional para %s + Cuenta no disponible \ No newline at end of file diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 97a732be5..7332e7173 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -153,4 +153,5 @@ Kirjaudu sisään Sinun on kirjauduttava sisään nähdäksesi yleiset sovellukset. PWA ja avoimen lähdekoodin sovellukset + Tili ei ole käytettävissä \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 77d6840b6..26a7d1081 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -173,4 +173,5 @@ Canal d\'installation fractionnée Connexion Ignorer + Compte indisponible \ No newline at end of file diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index 778468262..548808e9c 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -176,4 +176,5 @@ Aðvörun viðkomandi %s %s vill fá að setja upp viðbótareiningar.Þú þarft að skrá þig aftur inn í AppLounge til að geta sett þær inn. Skrá inn + Reikningur ekki í boði \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a06fe7b42..46c6e9b55 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -177,4 +177,5 @@ Toccando su \"%1$s\" verrà aperto un tab sul tuo browser con il nome del pacchetto app preimpostato.<br /><br />Tocca su \"Perform analysis\" per aviare l\'analisi da parte di Exodus.<br /><br />Quando verrò mostrato il pulsante \"See the report\" (potrebbe volerci un pò di tempo, a seconda dell\'app scelta) puoi chiudere il tab e tornare alla descrizione app su %2$s dove dovresti vedere il Punteggio Privacy. A volte Exodus non riesce ad analizzare l\'app.<br /><br />NB: potresti dover aspettare anche 10 min per poter vedere il punteggio nella descrizione app. L\'account anonimo che stai utilizzando non è disponibile. Agiorna la sessione per ottenerne un altro. AGGIORNA SESSIONE + Account non disponibile \ No newline at end of file diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index d127090b6..4fc1145fa 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -176,4 +176,5 @@ Advarsel angående %s %s vil installere ekstra moduler. Du må logge inn på App Lounge på nytt for å kunne installere dem. Logg inn + Konto utilgjengelig \ No newline at end of file diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index cd5d91f7b..957585699 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -156,4 +156,5 @@ Downloaden… Aanvullend bestand voor %s Update apps geïnstalleerd door andere app-stores + Account niet beschikbaar \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index dcd14689e..89fe24e1d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -155,4 +155,5 @@ Необходимо войти в систему, чтобы увидеть обычные приложения. Пожалуйста, выберите хотя бы один источник приложений. Выйти из системы + Аккаунт недоступен \ No newline at end of file diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 500d1e997..67e4b3516 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -25,4 +25,5 @@ Hľadať Kategórie Domov + Účet nedostupný \ No newline at end of file diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b1eb1f3f1..f2d8d2440 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -176,4 +176,5 @@ Varning gällande %s %s vill installera extra moduler. Du måste logga in till AppLounge igen för att kunna installera dom. Logga in + Konto otillgängligt \ No newline at end of file diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 88eac496b..a276b3660 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -156,4 +156,5 @@ \n \nНатисніть «Повторити спробу» щоб спробувати знову. Зареєструватися + Обліковий запис недоступний \ No newline at end of file -- GitLab