From 31646a725bc49463faac94d625848a4b85ae4061 Mon Sep 17 00:00:00 2001 From: joragua Date: Tue, 3 Dec 2024 10:37:39 +0100 Subject: [PATCH] fix: set the correct account for automatic uploads when there are users light --- .../automaticuploads/SettingsPictureUploadsFragment.kt | 10 +++++++++- .../automaticuploads/SettingsVideoUploadsFragment.kt | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsPictureUploadsFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsPictureUploadsFragment.kt index 3bc89b18374..cb7a19de19b 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsPictureUploadsFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsPictureUploadsFragment.kt @@ -137,7 +137,15 @@ class SettingsPictureUploadsFragment : PreferenceFragmentCompat() { enablePictureUploads(false, true) showMessageInSnackbar(getString(R.string.prefs_automatic_uploads_not_available_users_light)) } else { - selectedAccount = availableAccounts.first().accountName + val currentAccount = manageAccountsViewModel.getCurrentAccount()?.name + currentAccount?.let { + selectedAccount = if (manageAccountsViewModel.checkUserLight(currentAccount)) { + availableAccounts.first().accountName + } else { + currentAccount + } + } + picturesViewModel.pictureUploads.collect { pictureUploadsConfiguration -> enablePictureUploads(pictureUploadsConfiguration != null, false) pictureUploadsConfiguration?.let { diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsVideoUploadsFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsVideoUploadsFragment.kt index ba09630b7f6..5adb6ff0dc2 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsVideoUploadsFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/settings/automaticuploads/SettingsVideoUploadsFragment.kt @@ -134,7 +134,15 @@ class SettingsVideoUploadsFragment : PreferenceFragmentCompat() { enableVideoUploads(false, true) showMessageInSnackbar(getString(R.string.prefs_automatic_uploads_not_available_users_light)) } else { - selectedAccount = availableAccounts.first().accountName + val currentAccount = manageAccountsViewModel.getCurrentAccount()?.name + currentAccount?.let { + selectedAccount = if (manageAccountsViewModel.checkUserLight(currentAccount)) { + availableAccounts.first().accountName + } else { + currentAccount + } + } + videosViewModel.videoUploads.collect { videoUploadsConfiguration -> enableVideoUploads(videoUploadsConfiguration != null, false) videoUploadsConfiguration?.let {