mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
Merge pull request #13336 from nextcloud/limit-max-file-upload-count
Limit Max File Upload Count
This commit is contained in:
commit
37e83c3e2c
4 changed files with 16 additions and 1 deletions
|
@ -64,6 +64,9 @@ class FileUploadHelper {
|
|||
companion object {
|
||||
private val TAG = FileUploadWorker::class.java.simpleName
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
const val MAX_FILE_COUNT = 500
|
||||
|
||||
val mBoundListeners = HashMap<String, OnDatatransferProgressListener>()
|
||||
|
||||
private var instance: FileUploadHelper? = null
|
||||
|
|
|
@ -880,7 +880,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
}
|
||||
|
||||
private boolean somethingToUpload() {
|
||||
return (mStreamsToUpload != null && mStreamsToUpload.size() > 0 && mStreamsToUpload.get(0) != null ||
|
||||
return (mStreamsToUpload != null && !mStreamsToUpload.isEmpty() && mStreamsToUpload.get(0) != null ||
|
||||
mUploadFromTmpFile);
|
||||
}
|
||||
|
||||
|
@ -904,6 +904,11 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
return;
|
||||
}
|
||||
|
||||
if (mStreamsToUpload.size() > FileUploadHelper.MAX_FILE_COUNT) {
|
||||
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
|
||||
return;
|
||||
}
|
||||
|
||||
UriUploader uploader = new UriUploader(
|
||||
this,
|
||||
mStreamsToUpload,
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.jobs.upload.FileUploadHelper;
|
||||
import com.nextcloud.client.jobs.upload.FileUploadWorker;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.utils.extensions.ActivityExtensionsKt;
|
||||
|
@ -653,6 +654,11 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
|
|||
@Override
|
||||
public void onConfirmation(String callerTag) {
|
||||
Log_OC.d(TAG, "Positive button in dialog was clicked; dialog tag is " + callerTag);
|
||||
if (mFileListFragment.getCheckedFilePaths().length > FileUploadHelper.MAX_FILE_COUNT) {
|
||||
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (QUERY_TO_MOVE_DIALOG_TAG.equals(callerTag)) {
|
||||
// return the list of selected files to the caller activity (success),
|
||||
// signaling that they should be moved to the ownCloud folder, instead of copied
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<string name="uploader_error_message_source_file_not_found">File selected for upload not found. Please check whether the file exists.</string>
|
||||
<string name="uploader_error_message_source_file_not_copied">Could not copy file to a temporary folder. Try to resend it.</string>
|
||||
<string name="uploader_upload_files_behaviour">Upload option:</string>
|
||||
<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>
|
||||
<string name="uploader_upload_files_behaviour_move_to_nextcloud_folder">Move file to %1$s folder</string>
|
||||
<string name="uploader_upload_files_behaviour_only_upload">Keep file in source folder</string>
|
||||
<string name="uploader_upload_files_behaviour_upload_and_delete_from_source">Delete file from source folder</string>
|
||||
|
|
Loading…
Reference in a new issue