From 1108df71049db619c8349ef9f89d7b6852c97d22 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Mon, 18 Dec 2023 13:23:09 +0100 Subject: [PATCH 1/9] Use only work manager Signed-off-by: alperozturk --- .../android/files/services/FileUploaderIT.kt | 8 - .../documentscan/DocumentScanViewModel.kt | 6 - .../documentscan/GeneratePdfFromImagesWork.kt | 2 - .../nextcloud/client/jobs/FilesSyncWork.kt | 4 +- .../android/files/services/FileUploader.java | 189 ++++-------------- .../ui/activity/FileDisplayActivity.java | 11 +- .../ReceiveExternalFilesActivity.java | 2 - .../CopyAndUploadContentUrisTask.java | 7 +- .../android/ui/helpers/UriUploader.kt | 2 - 9 files changed, 46 insertions(+), 185 deletions(-) diff --git a/app/src/androidTest/java/com/owncloud/android/files/services/FileUploaderIT.kt b/app/src/androidTest/java/com/owncloud/android/files/services/FileUploaderIT.kt index f7fd21b1e075..704dfd9ce2ee 100644 --- a/app/src/androidTest/java/com/owncloud/android/files/services/FileUploaderIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/files/services/FileUploaderIT.kt @@ -139,12 +139,10 @@ abstract class FileUploaderIT : AbstractOnServerIT() { val file = getDummyFile("chunkedFile.txt") FileUploader.uploadNewFile( - targetContext, user, file.absolutePath, "/testFile.txt", FileUploader.LOCAL_BEHAVIOUR_COPY, - null, true, UploadFileOperation.CREATED_BY_USER, false, @@ -258,12 +256,10 @@ abstract class FileUploaderIT : AbstractOnServerIT() { val file = getDummyFile("nonEmpty.txt") FileUploader.uploadNewFile( - targetContext, user, file.absolutePath, "/testFile.txt", FileUploader.LOCAL_BEHAVIOUR_COPY, - null, true, UploadFileOperation.CREATED_BY_USER, false, @@ -369,12 +365,10 @@ abstract class FileUploaderIT : AbstractOnServerIT() { val file = getDummyFile("chunkedFile.txt") FileUploader.uploadNewFile( - targetContext, user, file.absolutePath, "/testFile.txt", FileUploader.LOCAL_BEHAVIOUR_COPY, - null, true, UploadFileOperation.CREATED_BY_USER, false, @@ -476,12 +470,10 @@ abstract class FileUploaderIT : AbstractOnServerIT() { val file = getDummyFile("chunkedFile.txt") FileUploader.uploadNewFile( - targetContext, user, file.absolutePath, "/testFile.txt", FileUploader.LOCAL_BEHAVIOUR_COPY, - null, true, UploadFileOperation.CREATED_BY_USER, false, diff --git a/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt b/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt index 31e5c348194e..224306a97dc9 100644 --- a/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt +++ b/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt @@ -184,16 +184,10 @@ class DocumentScanViewModel @Inject constructor( uploadFolder + OCFile.PATH_SEPARATOR + File(it).name }.toTypedArray() - val mimetypes = pageList.map { - MimeType.JPEG - }.toTypedArray() - FileUploader.uploadNewFile( - getApplication(), currentAccountProvider.user, pageList.toTypedArray(), uploadPaths, - mimetypes, FileUploader.LOCAL_BEHAVIOUR_DELETE, true, UploadFileOperation.CREATED_BY_USER, diff --git a/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt b/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt index 5fd4a640d079..08ad47b60f7e 100644 --- a/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt +++ b/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt @@ -124,12 +124,10 @@ class GeneratePdfFromImagesWork( val uploadPath = uploadFolder + OCFile.PATH_SEPARATOR + File(pdfPath).name FileUploader.uploadNewFile( - appContext, user, pdfPath, uploadPath, FileUploader.LOCAL_BEHAVIOUR_DELETE, // MIME type will be detected from file name - MimeType.PDF, true, UploadFileOperation.CREATED_BY_USER, false, diff --git a/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt b/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt index 9d98b0404bc8..8570240ba2fd 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt @@ -162,7 +162,6 @@ class FilesSyncWork( } val localPaths = pathsAndMimes.map { it.first }.toTypedArray() val remotePaths = pathsAndMimes.map { it.second }.toTypedArray() - val mimetypes = pathsAndMimes.map { it.third }.toTypedArray() if (lightVersion) { needsCharging = resources.getBoolean(R.bool.syncedFolder_light_on_charging) @@ -177,12 +176,11 @@ class FilesSyncWork( needsWifi = syncedFolder.isWifiOnly uploadAction = syncedFolder.uploadAction } + FileUploader.uploadNewFile( - context, user, localPaths, remotePaths, - mimetypes, uploadAction!!, true, // create parent folder if not existent UploadFileOperation.CREATED_AS_INSTANT_PICTURE, diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index 040a844c0691..a3fb2a17b31d 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -902,12 +902,10 @@ private void cancelPendingUploads(String accountName) { * Upload a new file */ public static void uploadNewFile( - Context context, User user, String localPath, String remotePath, int behaviour, - String mimeType, boolean createRemoteFile, int createdBy, boolean requiresWifi, @@ -915,11 +913,9 @@ public static void uploadNewFile( NameCollisionPolicy nameCollisionPolicy ) { uploadNewFile( - context, user, new String[]{localPath}, new String[]{remotePath}, - new String[]{mimeType}, behaviour, createRemoteFile, createdBy, @@ -933,11 +929,9 @@ public static void uploadNewFile( * Upload multiple new files */ public static void uploadNewFile( - Context context, User user, String[] localPaths, String[] remotePaths, - String[] mimeTypes, Integer behaviour, Boolean createRemoteFolder, int createdBy, @@ -945,39 +939,15 @@ public static void uploadNewFile( boolean requiresCharging, NameCollisionPolicy nameCollisionPolicy ) { - - - if (useFilesUploadWorker(context)) { - new FilesUploadHelper().uploadNewFiles(user, - localPaths, - remotePaths, - createRemoteFolder, - createdBy, - requiresWifi, - requiresCharging, - nameCollisionPolicy, - behaviour); - } else { - Intent intent = new Intent(context, FileUploader.class); - - intent.putExtra(FileUploader.KEY_ACCOUNT, user.toPlatformAccount()); - intent.putExtra(FileUploader.KEY_USER, user); - intent.putExtra(FileUploader.KEY_LOCAL_FILE, localPaths); - intent.putExtra(FileUploader.KEY_REMOTE_FILE, remotePaths); - intent.putExtra(FileUploader.KEY_MIME_TYPE, mimeTypes); - intent.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, behaviour); - intent.putExtra(FileUploader.KEY_CREATE_REMOTE_FOLDER, createRemoteFolder); - intent.putExtra(FileUploader.KEY_CREATED_BY, createdBy); - intent.putExtra(FileUploader.KEY_WHILE_ON_WIFI_ONLY, requiresWifi); - intent.putExtra(FileUploader.KEY_WHILE_CHARGING_ONLY, requiresCharging); - intent.putExtra(FileUploader.KEY_NAME_COLLISION_POLICY, nameCollisionPolicy); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(intent); - } else { - context.startService(intent); - } - } + new FilesUploadHelper().uploadNewFiles(user, + localPaths, + remotePaths, + createRemoteFolder, + createdBy, + requiresWifi, + requiresCharging, + nameCollisionPolicy, + behaviour); } /** @@ -1036,13 +1006,7 @@ public static void uploadUpdateFile( intent.putExtra(FileUploader.KEY_NAME_COLLISION_POLICY, nameCollisionPolicy); intent.putExtra(FileUploader.KEY_DISABLE_RETRIES, disableRetries); - if (useFilesUploadWorker(context)) { - new FilesUploadHelper().uploadUpdatedFile(user, existingFiles, behaviour, nameCollisionPolicy); - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(intent); - } else { - context.startService(intent); - } + new FilesUploadHelper().uploadUpdatedFile(user, existingFiles, behaviour, nameCollisionPolicy); } /** @@ -1057,13 +1021,7 @@ public static void retryUpload(@NonNull Context context, i.putExtra(FileUploader.KEY_ACCOUNT, user.toPlatformAccount()); i.putExtra(FileUploader.KEY_RETRY_UPLOAD, upload); - if (useFilesUploadWorker(context)) { - new FilesUploadHelper().retryUpload(upload, user); - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(i); - } else { - context.startService(i); - } + new FilesUploadHelper().retryUpload(upload, user); } /** @@ -1129,16 +1087,6 @@ public static String getUploadFinishMessage() { return FileUploader.class.getName() + UPLOAD_FINISH_MESSAGE; } - - private static boolean useFilesUploadWorker(Context context) { - if (forceNewUploadWorker) { - return true; - } - - // bump min version down with every release until minSDK is reached, at that point get rid of old upload code - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || context.getResources().getBoolean(R.bool.is_beta); - } - @VisibleForTesting public static void setForceNewUploadWorker(final Boolean value) { forceNewUploadWorker = value; @@ -1183,34 +1131,10 @@ public void cancel(OCUpload storedUpload) { * @param resultCode Setting result code will pause rather than cancel the job */ public void cancel(String accountName, String remotePath, @Nullable ResultCode resultCode) { - // Cancel for Android version >= Android 11 - if (useFilesUploadWorker(getApplicationContext())) { - try { - new FilesUploadHelper().cancelFileUpload(remotePath, accountManager.getUser(accountName).get()); - } catch (NoSuchElementException e) { - Log_OC.e(TAG, "Error cancelling current upload because user does not exist!"); - } - } else { - // Cancel for Android version <= Android 10 - Pair removeResult = mPendingUploads.remove(accountName, remotePath); - UploadFileOperation upload = removeResult.first; - if (upload == null && mCurrentUpload != null && mCurrentAccount != null && - mCurrentUpload.getRemotePath().startsWith(remotePath) && accountName.equals(mCurrentAccount.name)) { - - upload = mCurrentUpload; - } - - if (upload != null) { - upload.cancel(resultCode); - // need to update now table in mUploadsStorageManager, - // since the operation will not get to be run by FileUploader#uploadFile - if (resultCode != null) { - mUploadsStorageManager.updateDatabaseUploadResult(new RemoteOperationResult(resultCode), upload); - notifyUploadResult(upload, new RemoteOperationResult(resultCode)); - } else { - mUploadsStorageManager.removeUpload(accountName, remotePath); - } - } + try { + new FilesUploadHelper().cancelFileUpload(remotePath, accountManager.getUser(accountName).get()); + } catch (NoSuchElementException e) { + Log_OC.e(TAG, "Error cancelling current upload because user does not exist!"); } } @@ -1225,14 +1149,7 @@ public void cancel(User user) { public void cancel(String accountName) { cancelPendingUploads(accountName); - if (useFilesUploadWorker(getApplicationContext())) { - new FilesUploadHelper().restartUploadJob(accountManager.getUser(accountName).get()); - } else { - if (mCurrentUpload != null && mCurrentUpload.getUser().nameEquals(accountName)) { - mCurrentUpload.cancel(ResultCode.CANCELLED); - } - } - + new FilesUploadHelper().restartUploadJob(accountManager.getUser(accountName).get()); } public void clearListeners() { @@ -1256,43 +1173,27 @@ public boolean isUploading(User user, OCFile file) { if (user == null || file == null) { return false; } - if (useFilesUploadWorker(getApplicationContext())){ - // Not same as for service because upload list is "created" on the spot in the worker and not available here - OCUpload upload = mUploadsStorageManager.getUploadByRemotePath(file.getRemotePath()); - if (upload == null){ - return false; - } - return upload.getUploadStatus() == UploadStatus.UPLOAD_IN_PROGRESS; + OCUpload upload = mUploadsStorageManager.getUploadByRemotePath(file.getRemotePath()); - }else{ - return mPendingUploads.contains(user.getAccountName(), file.getRemotePath()); + if (upload == null){ + return false; } + + return upload.getUploadStatus() == UploadStatus.UPLOAD_IN_PROGRESS; } @SuppressFBWarnings("NP") public boolean isUploadingNow(OCUpload upload) { - if (useFilesUploadWorker(getApplicationContext())){ - UploadFileOperation currentUploadFileOperation = FilesUploadWorker.Companion.getCurrentUploadFileOperation(); - if (currentUploadFileOperation == null || currentUploadFileOperation.getUser() == null) return false; - if (upload == null || (!upload.getAccountName().equals(currentUploadFileOperation.getUser().getAccountName()))) return false; - if (currentUploadFileOperation.getOldFile() != null){ - // For file conflicts check old file remote path - return upload.getRemotePath().equals(currentUploadFileOperation.getRemotePath()) || - upload.getRemotePath().equals(currentUploadFileOperation.getOldFile().getRemotePath()); - } - return upload.getRemotePath().equals(currentUploadFileOperation.getRemotePath()); - - }else { - - return upload != null && - mCurrentAccount != null && - mCurrentUpload != null && - upload.getAccountName().equals(mCurrentAccount.name) && - (upload.getRemotePath().equals(mCurrentUpload.getRemotePath()) || - (mCurrentUpload.getOldFile() != null && - upload.getRemotePath().equals(mCurrentUpload.getOldFile().getRemotePath()))); + UploadFileOperation currentUploadFileOperation = FilesUploadWorker.Companion.getCurrentUploadFileOperation(); + if (currentUploadFileOperation == null || currentUploadFileOperation.getUser() == null) return false; + if (upload == null || (!upload.getAccountName().equals(currentUploadFileOperation.getUser().getAccountName()))) return false; + if (currentUploadFileOperation.getOldFile() != null){ + // For file conflicts check old file remote path + return upload.getRemotePath().equals(currentUploadFileOperation.getRemotePath()) || + upload.getRemotePath().equals(currentUploadFileOperation.getOldFile().getRemotePath()); } + return upload.getRemotePath().equals(currentUploadFileOperation.getRemotePath()); } /** @@ -1310,13 +1211,9 @@ public void addDatatransferProgressListener( if (user == null || file == null || listener == null) { return; } - String targetKey = buildRemoteName(user.getAccountName(), file.getRemotePath()); - if (useFilesUploadWorker(getApplicationContext())) { - new FilesUploadHelper().addDatatransferProgressListener(listener,targetKey); - }else { - mBoundListeners.put(targetKey, listener); - } + String targetKey = buildRemoteName(user.getAccountName(), file.getRemotePath()); + new FilesUploadHelper().addDatatransferProgressListener(listener,targetKey); } /** @@ -1334,11 +1231,7 @@ public void addDatatransferProgressListener( } String targetKey = buildRemoteName(ocUpload.getAccountName(), ocUpload.getRemotePath()); - if (useFilesUploadWorker(getApplicationContext())) { - new FilesUploadHelper().addDatatransferProgressListener(listener,targetKey); - }else { - mBoundListeners.put(targetKey, listener); - } + new FilesUploadHelper().addDatatransferProgressListener(listener,targetKey); } /** @@ -1358,14 +1251,7 @@ public void removeDatatransferProgressListener( } String targetKey = buildRemoteName(user.getAccountName(), file.getRemotePath()); - - if (useFilesUploadWorker(getApplicationContext())) { - new FilesUploadHelper().removeDatatransferProgressListener(listener,targetKey); - }else { - if (mBoundListeners.get(targetKey) == listener) { - mBoundListeners.remove(targetKey); - } - } + new FilesUploadHelper().removeDatatransferProgressListener(listener,targetKey); } /** @@ -1383,14 +1269,7 @@ public void removeDatatransferProgressListener( } String targetKey = buildRemoteName(ocUpload.getAccountName(), ocUpload.getRemotePath()); - - if (useFilesUploadWorker(getApplicationContext())) { - new FilesUploadHelper().removeDatatransferProgressListener(listener,targetKey); - }else { - if (mBoundListeners.get(targetKey) == listener) { - mBoundListeners.remove(targetKey); - } - } + new FilesUploadHelper().removeDatatransferProgressListener(listener,targetKey); } @Override diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index 6ca6aaa6f062..61f57d67e23a 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -906,8 +906,15 @@ private void requestUploadOfFilesFromFileSystem(String localBasePath, String[] f default -> FileUploader.LOCAL_BEHAVIOUR_FORGET; }; - FileUploader.uploadNewFile(this, getUser().orElseThrow(RuntimeException::new), filePaths, remotePaths, null, // MIME type will be detected from file name - behaviour, true, UploadFileOperation.CREATED_BY_USER, false, false, NameCollisionPolicy.ASK_USER); + FileUploader.uploadNewFile(getUser().orElseThrow(RuntimeException::new), + filePaths, + remotePaths, + behaviour, + true, + UploadFileOperation.CREATED_BY_USER, + false, + false, + NameCollisionPolicy.ASK_USER); } else { Log_OC.d(TAG, "User clicked on 'Update' with no selection"); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java index fe22c560c204..29dc339c5401 100755 --- a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java @@ -885,12 +885,10 @@ private boolean somethingToUpload() { public void uploadFile(String tmpName, String filename) { FileUploader.uploadNewFile( - getBaseContext(), getUser().orElseThrow(RuntimeException::new), tmpName, mFile.getRemotePath() + filename, FileUploader.LOCAL_BEHAVIOUR_COPY, - null, true, UploadFileOperation.CREATED_BY_USER, false, diff --git a/app/src/main/java/com/owncloud/android/ui/asynctasks/CopyAndUploadContentUrisTask.java b/app/src/main/java/com/owncloud/android/ui/asynctasks/CopyAndUploadContentUrisTask.java index 63efab826094..20af7dc2ecfc 100644 --- a/app/src/main/java/com/owncloud/android/ui/asynctasks/CopyAndUploadContentUrisTask.java +++ b/app/src/main/java/com/owncloud/android/ui/asynctasks/CopyAndUploadContentUrisTask.java @@ -192,8 +192,7 @@ protected ResultCode doInBackground(Object[] params) { user, fullTempPath, currentRemotePath, - behaviour, - leakedContentResolver.getType(currentUri) + behaviour ); fullTempPath = null; } @@ -247,14 +246,12 @@ protected ResultCode doInBackground(Object[] params) { return result; } - private void requestUpload(User user, String localPath, String remotePath, int behaviour, String mimeType) { + private void requestUpload(User user, String localPath, String remotePath, int behaviour) { FileUploader.uploadNewFile( - mAppContext, user, localPath, remotePath, behaviour, - mimeType, false, // do not create parent folder if not existent UploadFileOperation.CREATED_BY_USER, false, diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt b/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt index 69aec9b24af5..263530fc8dd6 100644 --- a/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt +++ b/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt @@ -126,12 +126,10 @@ class UriUploader( */ private fun requestUpload(localPath: String?, remotePath: String) { FileUploader.uploadNewFile( - mActivity, user, localPath, remotePath, mBehaviour, - null, // MIME type will be detected from file name false, // do not create parent folder if not existent UploadFileOperation.CREATED_BY_USER, false, From 2ac0267bd9b11a9d01189704c091dbb6065776d7 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Mon, 18 Dec 2023 13:44:54 +0100 Subject: [PATCH 2/9] Fix code analytics Signed-off-by: alperozturk --- .../com/nextcloud/client/documentscan/DocumentScanViewModel.kt | 1 - .../nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt b/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt index 224306a97dc9..b7dda52d4254 100644 --- a/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt +++ b/app/src/main/java/com/nextcloud/client/documentscan/DocumentScanViewModel.kt @@ -36,7 +36,6 @@ import com.owncloud.android.files.services.FileUploader import com.owncloud.android.files.services.NameCollisionPolicy import com.owncloud.android.operations.UploadFileOperation import com.owncloud.android.ui.helpers.FileOperationsHelper -import com.owncloud.android.utils.MimeType import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt b/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt index 08ad47b60f7e..ffbd5b5caf53 100644 --- a/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt +++ b/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt @@ -39,7 +39,6 @@ import com.owncloud.android.files.services.FileUploader import com.owncloud.android.files.services.NameCollisionPolicy import com.owncloud.android.operations.UploadFileOperation import com.owncloud.android.ui.notifications.NotificationUtils -import com.owncloud.android.utils.MimeType import com.owncloud.android.utils.theme.ViewThemeUtils import java.io.File import java.security.SecureRandom From f6e1b57b2a223b0b00440702da407a1a76067857 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Mon, 18 Dec 2023 13:50:37 +0100 Subject: [PATCH 3/9] Reduce spotbugs Signed-off-by: alperozturk --- .../com/owncloud/android/files/services/FileUploader.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index a3fb2a17b31d..78bbcfdd4c05 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -79,6 +79,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.files.FileUtils; +import com.owncloud.android.lib.resources.files.model.ServerFileInterface; import com.owncloud.android.operations.UploadFileOperation; import com.owncloud.android.ui.activity.ConflictsResolveActivity; import com.owncloud.android.ui.activity.UploadListActivity; @@ -1110,7 +1111,7 @@ public class FileUploaderBinder extends Binder implements OnDatatransferProgress * @param account ownCloud account where the remote file will be stored. * @param file A file in the queue of pending uploads */ - public void cancel(Account account, OCFile file) { + public void cancel(Account account, ServerFileInterface file) { cancel(account.name, file.getRemotePath(), null); } @@ -1206,7 +1207,7 @@ public boolean isUploadingNow(OCUpload upload) { public void addDatatransferProgressListener( OnDatatransferProgressListener listener, User user, - OCFile file + ServerFileInterface file ) { if (user == null || file == null || listener == null) { return; @@ -1244,7 +1245,7 @@ public void addDatatransferProgressListener( public void removeDatatransferProgressListener( OnDatatransferProgressListener listener, User user, - OCFile file + ServerFileInterface file ) { if (user == null || file == null || listener == null) { return; From 535446192f2a71cb397d52344e4df0bb1312b7cb Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 19 Dec 2023 08:44:44 +0100 Subject: [PATCH 4/9] Create download worker Signed-off-by: alperozturk --- .../java/com/owncloud/android/files/services/FileUploader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index 78bbcfdd4c05..ad806d00f346 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -1099,7 +1099,6 @@ public static void setForceNewUploadWorker(final Boolean value) { * It provides by itself the available operations. */ public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener { - /** * Map of listeners that will be reported about progress of uploads from a {@link FileUploaderBinder} instance */ From e7190b522e2000fba68dcd64dc76b5c4893a06f1 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 19 Dec 2023 08:48:03 +0100 Subject: [PATCH 5/9] Rebase master Signed-off-by: alperozturk --- .../java/com/owncloud/android/files/services/FileUploader.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index ad806d00f346..78bbcfdd4c05 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -1099,6 +1099,7 @@ public static void setForceNewUploadWorker(final Boolean value) { * It provides by itself the available operations. */ public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener { + /** * Map of listeners that will be reported about progress of uploads from a {@link FileUploaderBinder} instance */ From c43583d4d35f86f01e8d63acf1e65b91091e820f Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 19 Dec 2023 08:44:44 +0100 Subject: [PATCH 6/9] Create download worker Signed-off-by: alperozturk --- .../java/com/owncloud/android/files/services/FileUploader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index 78bbcfdd4c05..ad806d00f346 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -1099,7 +1099,6 @@ public static void setForceNewUploadWorker(final Boolean value) { * It provides by itself the available operations. */ public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener { - /** * Map of listeners that will be reported about progress of uploads from a {@link FileUploaderBinder} instance */ From c0e694537d5ffcaf9f1b51b91a92229e80375bf6 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 19 Dec 2023 08:48:43 +0100 Subject: [PATCH 7/9] Rebase master Signed-off-by: alperozturk --- .../java/com/owncloud/android/files/services/FileUploader.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index ad806d00f346..78bbcfdd4c05 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -1099,6 +1099,7 @@ public static void setForceNewUploadWorker(final Boolean value) { * It provides by itself the available operations. */ public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener { + /** * Map of listeners that will be reported about progress of uploads from a {@link FileUploaderBinder} instance */ From 1c569fbd73f2aae826231e7bb213d2486c83846d Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 19 Dec 2023 08:44:44 +0100 Subject: [PATCH 8/9] Create download worker Signed-off-by: alperozturk --- .../java/com/owncloud/android/files/services/FileUploader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index 78bbcfdd4c05..ad806d00f346 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -1099,7 +1099,6 @@ public static void setForceNewUploadWorker(final Boolean value) { * It provides by itself the available operations. */ public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener { - /** * Map of listeners that will be reported about progress of uploads from a {@link FileUploaderBinder} instance */ From f1bd5f1b902378f3a6b2f9b25b75738737c8ee7f Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 19 Dec 2023 08:55:03 +0100 Subject: [PATCH 9/9] Rebase master Signed-off-by: alperozturk --- .../java/com/owncloud/android/files/services/FileUploader.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index ad806d00f346..b49d24093f63 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -977,8 +977,7 @@ public static void uploadUpdateFile( OCFile existingFile, Integer behaviour, NameCollisionPolicy nameCollisionPolicy, - boolean disableRetries - ) { + boolean disableRetries) { uploadUpdateFile(context, user, new OCFile[]{existingFile},