Skip to content

Commit 89fbb98

Browse files
Merge pull request nextcloud#15801 from nextcloud/backport/15800/stable-3.34
[stable-3.34] fix: file upload limit message visibility
2 parents 8b5ce92 + 8ca3786 commit 89fbb98

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadHelper.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
package com.nextcloud.client.jobs.upload
99

10+
import android.app.Activity
1011
import android.content.BroadcastReceiver
1112
import android.content.Context
1213
import android.content.Intent
@@ -20,6 +21,7 @@ import com.nextcloud.client.network.Connectivity
2021
import com.nextcloud.client.network.ConnectivityService
2122
import com.nextcloud.utils.extensions.getUploadIds
2223
import com.owncloud.android.MainApp
24+
import com.owncloud.android.R
2325
import com.owncloud.android.datamodel.FileDataStorageManager
2426
import com.owncloud.android.datamodel.OCFile
2527
import com.owncloud.android.datamodel.UploadsStorageManager
@@ -35,6 +37,7 @@ import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation
3537
import com.owncloud.android.lib.resources.files.model.RemoteFile
3638
import com.owncloud.android.operations.RemoveFileOperation
3739
import com.owncloud.android.operations.UploadFileOperation
40+
import com.owncloud.android.utils.DisplayUtils
3841
import com.owncloud.android.utils.FileUtil
3942
import kotlinx.coroutines.CoroutineScope
4043
import kotlinx.coroutines.Dispatchers
@@ -459,6 +462,14 @@ class FileUploadHelper {
459462
return false
460463
}
461464

465+
fun showFileUploadLimitMessage(activity: Activity) {
466+
val message = activity.getString(
467+
R.string.file_upload_limit_message,
468+
MAX_FILE_COUNT
469+
)
470+
DisplayUtils.showSnackMessage(activity, message)
471+
}
472+
462473
class UploadNotificationActionReceiver : BroadcastReceiver() {
463474
override fun onReceive(context: Context, intent: Intent) {
464475
val accountName = intent.getStringExtra(FileUploadWorker.EXTRA_ACCOUNT_NAME)

app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ public void uploadFiles() {
944944
}
945945

946946
if (mStreamsToUpload.size() > FileUploadHelper.MAX_FILE_COUNT) {
947-
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
947+
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
948948
return;
949949
}
950950

app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ public void onCheckAvailableSpaceFinish(boolean hasEnoughSpaceAvailable, String.
503503
} else {
504504
final var chosenFiles = mFileListFragment.getCheckedFilePaths();
505505
if (chosenFiles.length > FileUploadHelper.MAX_FILE_COUNT) {
506-
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
506+
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
507507
return;
508508
}
509509

@@ -670,7 +670,7 @@ public void onClick(View v) {
670670
} else {
671671
final var chosenFiles = mFileListFragment.getCheckedFilePaths();
672672
if (chosenFiles.length > FileUploadHelper.MAX_FILE_COUNT) {
673-
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
673+
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
674674
return;
675675
}
676676
boolean isPositionZero = (binding.uploadFilesSpinnerBehaviour.getSelectedItemPosition() == 0);
@@ -720,7 +720,7 @@ public void onConfirmation(String callerTag) {
720720
Log_OC.d(TAG, "Positive button in dialog was clicked; dialog tag is " + callerTag);
721721
final var chosenFiles = mFileListFragment.getCheckedFilePaths();
722722
if (chosenFiles.length > FileUploadHelper.MAX_FILE_COUNT) {
723-
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
723+
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
724724
return;
725725
}
726726

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
<string name="uploader_error_message_source_file_not_found">File selected for upload not found. Please check whether the file exists.</string>
173173
<string name="uploader_error_message_source_file_not_copied">Could not copy file to a temporary folder. Try to resend it.</string>
174174
<string name="uploader_upload_files_behaviour">Upload option:</string>
175-
<string name="max_file_count_warning_message">You have reached the maximum file upload limit. Please upload fewer than 500 files at a time.</string>
175+
<string name="file_upload_limit_message">You can upload up to %d files at once."</string>
176176
<string name="file_upload_worker_same_file_already_exists">%s already exists, no conflict detected</string>
177177
<string name="uploader_upload_files_behaviour_move_to_nextcloud_folder">Move file to %1$s folder</string>
178178
<string name="uploader_upload_files_behaviour_only_upload">Keep file in source folder</string>

0 commit comments

Comments
 (0)