diff --git a/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt b/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt index 9abebefe54..9d0a9c4e9e 100644 --- a/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt +++ b/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt @@ -142,8 +142,7 @@ class BackgroundJobFactory @Inject constructor( uploadsStorageManager = uploadsStorageManager, connectivityService = connectivityService, powerManagementService = powerManagementService, - clock = clock, - backgroundJobManager = backgroundJobManager.get() + clock = clock ) } diff --git a/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt b/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt index a55027e830..5dd75d3851 100644 --- a/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt +++ b/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt @@ -70,8 +70,7 @@ class FilesSyncWork( private val uploadsStorageManager: UploadsStorageManager, private val connectivityService: ConnectivityService, private val powerManagementService: PowerManagementService, - private val clock: Clock, - private val backgroundJobManager: BackgroundJobManager + private val clock: Clock ) : Worker(context, params) { companion object { @@ -197,7 +196,7 @@ class FilesSyncWork( UploadFileOperation.CREATED_AS_INSTANT_PICTURE, needsWifi, needsCharging, - FileUploader.NameCollisionPolicy.ASK_USER + syncedFolder.nameCollisionPolicy ) filesystemDataProvider.updateFilesystemFileAsSentForUpload( path, diff --git a/src/main/java/com/owncloud/android/datamodel/SyncedFolder.java b/src/main/java/com/owncloud/android/datamodel/SyncedFolder.java index c973537055..668018dc3c 100644 --- a/src/main/java/com/owncloud/android/datamodel/SyncedFolder.java +++ b/src/main/java/com/owncloud/android/datamodel/SyncedFolder.java @@ -21,6 +21,8 @@ package com.owncloud.android.datamodel; +import com.owncloud.android.files.services.FileUploader; + import java.io.Serializable; /** @@ -178,10 +180,14 @@ public class SyncedFolder implements Serializable, Cloneable { return this.uploadAction; } - public int getNameCollisionPolicy() { + public int getNameCollisionPolicyInt() { return this.nameCollisionPolicy; } + public FileUploader.NameCollisionPolicy getNameCollisionPolicy() { + return FileUploader.NameCollisionPolicy.deserialize(nameCollisionPolicy); + } + public boolean isEnabled() { return this.enabled; } diff --git a/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java b/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java index 4e3c4f7983..b163aa300a 100644 --- a/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java +++ b/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java @@ -399,7 +399,7 @@ public class SyncedFolderProvider extends Observable { cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT, syncedFolder.getAccount()); cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_UPLOAD_ACTION, syncedFolder.getUploadAction()); cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_NAME_COLLISION_POLICY, - syncedFolder.getNameCollisionPolicy()); + syncedFolder.getNameCollisionPolicyInt()); cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_TYPE, syncedFolder.getType().getId()); cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_HIDDEN, syncedFolder.isHidden()); diff --git a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java index 98a7bbbddb..d707e9ccee 100644 --- a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java @@ -903,7 +903,9 @@ public class UploadFileOperation extends SyncOperation { } @CheckResult - private RemoteOperationResult checkNameCollision(OwnCloudClient client, DecryptedFolderMetadata metadata, boolean encrypted) + private RemoteOperationResult checkNameCollision(OwnCloudClient client, + DecryptedFolderMetadata metadata, + boolean encrypted) throws OperationCancelledException { Log_OC.d(TAG, "Checking name collision in server"); diff --git a/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java b/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java index 03f6b9d8c1..72afbb9d7b 100644 --- a/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java @@ -403,23 +403,23 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA List filePaths = getDisplayFilePathList(files); return new SyncedFolderDisplayItem( - syncedFolder.getId(), - syncedFolder.getLocalPath(), - syncedFolder.getRemotePath(), - syncedFolder.isWifiOnly(), - syncedFolder.isChargingOnly(), - syncedFolder.isExisting(), - syncedFolder.isSubfolderByDate(), - syncedFolder.getAccount(), - syncedFolder.getUploadAction(), - syncedFolder.getNameCollisionPolicy(), - syncedFolder.isEnabled(), - clock.getCurrentTime(), - filePaths, - localFolder.getName(), - files.length, - syncedFolder.getType(), - syncedFolder.isHidden()); + syncedFolder.getId(), + syncedFolder.getLocalPath(), + syncedFolder.getRemotePath(), + syncedFolder.isWifiOnly(), + syncedFolder.isChargingOnly(), + syncedFolder.isExisting(), + syncedFolder.isSubfolderByDate(), + syncedFolder.getAccount(), + syncedFolder.getUploadAction(), + syncedFolder.getNameCollisionPolicyInt(), + syncedFolder.isEnabled(), + clock.getCurrentTime(), + filePaths, + localFolder.getName(), + files.length, + syncedFolder.getType(), + syncedFolder.isHidden()); } /** @@ -432,23 +432,23 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA @NonNull private SyncedFolderDisplayItem createSyncedFolder(@NonNull SyncedFolder syncedFolder, @NonNull MediaFolder mediaFolder) { return new SyncedFolderDisplayItem( - syncedFolder.getId(), - syncedFolder.getLocalPath(), - syncedFolder.getRemotePath(), - syncedFolder.isWifiOnly(), - syncedFolder.isChargingOnly(), - syncedFolder.isExisting(), - syncedFolder.isSubfolderByDate(), - syncedFolder.getAccount(), - syncedFolder.getUploadAction(), - syncedFolder.getNameCollisionPolicy(), - syncedFolder.isEnabled(), - clock.getCurrentTime(), - mediaFolder.filePaths, - mediaFolder.folderName, - mediaFolder.numberOfFiles, - mediaFolder.type, - syncedFolder.isHidden()); + syncedFolder.getId(), + syncedFolder.getLocalPath(), + syncedFolder.getRemotePath(), + syncedFolder.isWifiOnly(), + syncedFolder.isChargingOnly(), + syncedFolder.isExisting(), + syncedFolder.isSubfolderByDate(), + syncedFolder.getAccount(), + syncedFolder.getUploadAction(), + syncedFolder.getNameCollisionPolicyInt(), + syncedFolder.isEnabled(), + clock.getCurrentTime(), + mediaFolder.filePaths, + mediaFolder.folderName, + mediaFolder.numberOfFiles, + mediaFolder.type, + syncedFolder.isHidden()); } /** diff --git a/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java b/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java index 608f4c8063..3428e952b6 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java +++ b/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java @@ -61,7 +61,7 @@ public class SyncedFolderParcelable implements Parcelable { account = syncedFolderDisplayItem.getAccount(); uploadAction = syncedFolderDisplayItem.getUploadAction(); nameCollisionPolicy = FileUploader.NameCollisionPolicy.deserialize( - syncedFolderDisplayItem.getNameCollisionPolicy()); + syncedFolderDisplayItem.getNameCollisionPolicyInt()); this.section = section; hidden = syncedFolderDisplayItem.isHidden(); }