Skip to content

Commit c82c343

Browse files
authored
Merge pull request #4587 from owncloud/fix/snackbar_when_uploading_with_no_quota
[FIX] No message when uploading a file with no quota
2 parents eea7960 + 5c66c4c commit c82c343

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ ownCloud admins and users.
4040
* Bugfix - Content in Spaces not shown from third-party apps: [#4522](https://github.com/owncloud/android/issues/4522)
4141
* Bugfix - Add bottom margin for used quota in account dialog: [#4566](https://github.com/owncloud/android/issues/4566)
4242
* Bugfix - Infinite edges in Android 15: [#4576](https://github.com/owncloud/android/issues/4576)
43+
* Bugfix - No message when uploading a file with no quota: [#4582](https://github.com/owncloud/android/issues/4582)
4344
* Change - Bump target SDK to 35: [#4529](https://github.com/owncloud/android/issues/4529)
4445
* Change - Replace dav4android location: [#4536](https://github.com/owncloud/android/issues/4536)
4546
* Change - Modify biometrics fail source string: [#4572](https://github.com/owncloud/android/issues/4572)
@@ -81,6 +82,14 @@ ownCloud admins and users.
8182
https://github.com/owncloud/android/issues/4576
8283
https://github.com/owncloud/android/pull/4581
8384

85+
* Bugfix - No message when uploading a file with no quota: [#4582](https://github.com/owncloud/android/issues/4582)
86+
87+
A message has been added in the file list when uploading a file (from file
88+
system, camera or shortcut) without available quota
89+
90+
https://github.com/owncloud/android/issues/4582
91+
https://github.com/owncloud/android/pull/4587
92+
8493
* Change - Bump target SDK to 35: [#4529](https://github.com/owncloud/android/issues/4529)
8594

8695
Target SDK has been upgraded to 35 in order to fulfill Android platform

changelog/unreleased/4587

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: No message when uploading a file with no quota
2+
3+
A message has been added in the file list when uploading a file (from file system, camera or shortcut) without available quota
4+
5+
https://github.com/owncloud/android/issues/4582
6+
https://github.com/owncloud/android/pull/4587

owncloudApp/src/main/java/com/owncloud/android/presentation/accounts/ManageAccountsViewModel.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @author Juan Carlos Garrote Gascón
77
* @author Jorge Aguado Recio
88
*
9-
* Copyright (C) 2024 ownCloud GmbH.
9+
* Copyright (C) 2025 ownCloud GmbH.
1010
*
1111
* This program is free software: you can redistribute it and/or modify
1212
* it under the terms of the GNU General Public License version 2,
@@ -92,4 +92,9 @@ class ManageAccountsViewModel(
9292
}
9393
quota.getDataOrNull()?.available == -4L
9494
}
95+
96+
fun hasEnoughQuota(accountName: String): Boolean = runBlocking(CoroutinesDispatcherProvider().io) {
97+
val quota = getStoredQuotaUseCase(GetStoredQuotaUseCase.Params(accountName))
98+
quota.getDataOrNull()?.available != 0L
99+
}
95100
}

owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @author Jorge Aguado Recio
1313
*
1414
* Copyright (C) 2011 Bartek Przybylski
15-
* Copyright (C) 2024 ownCloud GmbH.
15+
* Copyright (C) 2025 ownCloud GmbH.
1616
*
1717
* This program is free software: you can redistribute it and/or modify
1818
* it under the terms of the GNU General Public License version 2,
@@ -603,6 +603,9 @@ class FileDisplayActivity : FileActivity(),
603603

604604
// Handle calls form internal activities.
605605
if (requestCode == REQUEST_CODE__SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == RESULT_OK_AND_MOVE)) {
606+
if (!manageAccountsViewModel.hasEnoughQuota(account.name)) {
607+
showMessageInSnackbar(message = getString(R.string.failed_upload_quota_exceeded_text))
608+
}
606609

607610
requestUploadOfContentFromApps(data)
608611

@@ -618,6 +621,9 @@ class FileDisplayActivity : FileActivity(),
618621
capturedFilePaths: Array<String>
619622
) {
620623
if (hasEnoughSpace) {
624+
if (!manageAccountsViewModel.hasEnoughQuota(account.name)) {
625+
showMessageInSnackbar(message = getString(R.string.failed_upload_quota_exceeded_text))
626+
}
621627
requestUploadOfFilesFromFileSystem(capturedFilePaths)
622628
}
623629
}
@@ -1918,6 +1924,9 @@ class FileDisplayActivity : FileActivity(),
19181924
}
19191925

19201926
override fun uploadShortcutFileFromApp(shortcutFilePath: Array<String>) {
1927+
if (!manageAccountsViewModel.hasEnoughQuota(account.name)) {
1928+
showMessageInSnackbar(message = getString(R.string.failed_upload_quota_exceeded_text))
1929+
}
19211930
requestUploadOfFilesFromFileSystem(shortcutFilePath)
19221931
}
19231932

0 commit comments

Comments
 (0)