diff --git a/CHANGELOG.md b/CHANGELOG.md index ace25e833bd..14fdf7e9ca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ ownCloud admins and users. * Bugfix - Content in Spaces not shown from third-party apps: [#4522](https://github.com/owncloud/android/issues/4522) * Bugfix - Add bottom margin for used quota in account dialog: [#4566](https://github.com/owncloud/android/issues/4566) * Bugfix - Infinite edges in Android 15: [#4576](https://github.com/owncloud/android/issues/4576) +* Bugfix - No message when uploading a file with no quota: [#4582](https://github.com/owncloud/android/issues/4582) * Change - Bump target SDK to 35: [#4529](https://github.com/owncloud/android/issues/4529) * Change - Replace dav4android location: [#4536](https://github.com/owncloud/android/issues/4536) * Change - Modify biometrics fail source string: [#4572](https://github.com/owncloud/android/issues/4572) @@ -81,6 +82,14 @@ ownCloud admins and users. https://github.com/owncloud/android/issues/4576 https://github.com/owncloud/android/pull/4581 +* Bugfix - No message when uploading a file with no quota: [#4582](https://github.com/owncloud/android/issues/4582) + + A message has been added in the file list when uploading a file (from file + system, camera or shortcut) without available quota + + https://github.com/owncloud/android/issues/4582 + https://github.com/owncloud/android/pull/4587 + * Change - Bump target SDK to 35: [#4529](https://github.com/owncloud/android/issues/4529) Target SDK has been upgraded to 35 in order to fulfill Android platform diff --git a/changelog/unreleased/4587 b/changelog/unreleased/4587 new file mode 100644 index 00000000000..1e299474557 --- /dev/null +++ b/changelog/unreleased/4587 @@ -0,0 +1,6 @@ +Bugfix: No message when uploading a file with no quota + +A message has been added in the file list when uploading a file (from file system, camera or shortcut) without available quota + +https://github.com/owncloud/android/issues/4582 +https://github.com/owncloud/android/pull/4587 diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/accounts/ManageAccountsViewModel.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/accounts/ManageAccountsViewModel.kt index 8b520fa90fc..adc1cb2089d 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/accounts/ManageAccountsViewModel.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/accounts/ManageAccountsViewModel.kt @@ -6,7 +6,7 @@ * @author Juan Carlos Garrote Gascón * @author Jorge Aguado Recio * - * Copyright (C) 2024 ownCloud GmbH. + * Copyright (C) 2025 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -92,4 +92,9 @@ class ManageAccountsViewModel( } quota.getDataOrNull()?.available == -4L } + + fun hasEnoughQuota(accountName: String): Boolean = runBlocking(CoroutinesDispatcherProvider().io) { + val quota = getStoredQuotaUseCase(GetStoredQuotaUseCase.Params(accountName)) + quota.getDataOrNull()?.available != 0L + } } diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt index 68b3356d340..2f25ea175c2 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt @@ -12,7 +12,7 @@ * @author Jorge Aguado Recio * * Copyright (C) 2011 Bartek Przybylski - * Copyright (C) 2024 ownCloud GmbH. + * Copyright (C) 2025 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -603,6 +603,9 @@ class FileDisplayActivity : FileActivity(), // Handle calls form internal activities. if (requestCode == REQUEST_CODE__SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == RESULT_OK_AND_MOVE)) { + if (!manageAccountsViewModel.hasEnoughQuota(account.name)) { + showMessageInSnackbar(message = getString(R.string.failed_upload_quota_exceeded_text)) + } requestUploadOfContentFromApps(data) @@ -618,6 +621,9 @@ class FileDisplayActivity : FileActivity(), capturedFilePaths: Array ) { if (hasEnoughSpace) { + if (!manageAccountsViewModel.hasEnoughQuota(account.name)) { + showMessageInSnackbar(message = getString(R.string.failed_upload_quota_exceeded_text)) + } requestUploadOfFilesFromFileSystem(capturedFilePaths) } } @@ -1918,6 +1924,9 @@ class FileDisplayActivity : FileActivity(), } override fun uploadShortcutFileFromApp(shortcutFilePath: Array) { + if (!manageAccountsViewModel.hasEnoughQuota(account.name)) { + showMessageInSnackbar(message = getString(R.string.failed_upload_quota_exceeded_text)) + } requestUploadOfFilesFromFileSystem(shortcutFilePath) }