dont use isSyncing

This commit is contained in:
IndusAryan 2024-03-21 21:29:59 +05:30
parent 170442c912
commit c0982899ce

View file

@ -141,17 +141,18 @@ class SettingsFragment : Fragment() {
/** used to debug leaks /** used to debug leaks
showToast(activity,"${VideoDownloadManager.downloadStatusEvent.size} : showToast(activity,"${VideoDownloadManager.downloadStatusEvent.size} :
${VideoDownloadManager.downloadProgressEvent.size}") **/ ${VideoDownloadManager.downloadProgressEvent.size}") **/
// Check login status for each OAuth2API // Check login status for each OAuth2API
val isSyncing = accountManagers.any{ it.loginInfo() != null } val accountProfile = accountManagers.firstOrNull { it.loginInfo() != null }
val accountPFP = accountManagers.firstOrNull{ it.loginInfo() != null }
// show local account image and pfp when not syncing with any api. // show local account image and pfp when not syncing with any api.
if (!isSyncing && accountPFP == null) { if (accountProfile == null) {
val activity = activity ?: return val activity = activity ?: return
val currentAccount = try { val currentAccount = try {
DataStoreHelper.accounts.firstOrNull { DataStoreHelper.accounts.firstOrNull {
it.keyIndex == DataStoreHelper.selectedKeyIndex it.keyIndex == DataStoreHelper.selectedKeyIndex
} ?: activity.let { DataStoreHelper.getDefaultAccount(activity) } } ?: activity.let { DataStoreHelper.getDefaultAccount(activity) }
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
Log.e("AccountManager", "Activity not found", e) Log.e("AccountManager", "Activity not found", e)
null null