diff --git a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt index 50deb4beb977..bf8e11eb774e 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt @@ -30,7 +30,6 @@ import androidx.work.WorkerFactory import androidx.work.WorkerParameters import com.nextcloud.client.account.UserAccountManager import com.nextcloud.client.core.Clock -import com.nextcloud.client.device.DeviceInfo import com.nextcloud.client.device.PowerManagementService import com.nextcloud.client.documentscan.GeneratePDFUseCase import com.nextcloud.client.documentscan.GeneratePdfFromImagesWork @@ -59,7 +58,6 @@ class BackgroundJobFactory @Inject constructor( private val clock: Clock, private val powerManagementService: PowerManagementService, private val backgroundJobManager: Provider, - private val deviceInfo: DeviceInfo, private val accountManager: UserAccountManager, private val resources: Resources, private val dataProvider: ArbitraryDataProvider, diff --git a/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java index 0aac8b984abe..33d45e85f9c5 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java @@ -204,7 +204,9 @@ private int updateUploadInternal(Cursor c, UploadStatus status, UploadResult res + upload.toFormattedString() + ")"); upload.setUploadStatus(status); - upload.setLastResult(result); + if (result != null) { + upload.setLastResult(result); + } upload.setRemotePath(remotePath); if (localPath != null) { upload.setLocalPath(localPath); @@ -687,7 +689,7 @@ public void updateDatabaseUploadStart(UploadFileOperation upload) { updateUploadStatus( upload.getOCUploadId(), UploadStatus.UPLOAD_IN_PROGRESS, - UploadResult.UNKNOWN, + null, upload.getRemotePath(), localPath ); diff --git a/app/src/main/java/com/owncloud/android/db/OCUpload.java b/app/src/main/java/com/owncloud/android/db/OCUpload.java index cf1917f64dc1..5c867cb8df8a 100644 --- a/app/src/main/java/com/owncloud/android/db/OCUpload.java +++ b/app/src/main/java/com/owncloud/android/db/OCUpload.java @@ -196,7 +196,7 @@ public void setDataFixed(FileUploader.FileUploaderBinder binder) { */ public void setUploadStatus(UploadStatus uploadStatus) { this.uploadStatus = uploadStatus; - setLastResult(UploadResult.UNKNOWN); + // setLastResult(UploadResult.UNKNOWN); } /** diff --git a/app/src/main/java/com/owncloud/android/db/UploadResult.java b/app/src/main/java/com/owncloud/android/db/UploadResult.java index 34a6d99d0289..17533f0413be 100644 --- a/app/src/main/java/com/owncloud/android/db/UploadResult.java +++ b/app/src/main/java/com/owncloud/android/db/UploadResult.java @@ -44,7 +44,8 @@ public enum UploadResult { OLD_ANDROID_API(18), SYNC_CONFLICT(19), CANNOT_CREATE_FILE(20), - LOCAL_STORAGE_NOT_COPIED(21); + LOCAL_STORAGE_NOT_COPIED(21), + QUOTA_EXCEEDED(22); private final int value; @@ -104,6 +105,8 @@ public static UploadResult fromValue(int value) { return CANNOT_CREATE_FILE; case 21: return LOCAL_STORAGE_NOT_COPIED; + case 22: + return QUOTA_EXCEEDED; } return UNKNOWN; } @@ -162,6 +165,8 @@ public static UploadResult fromOperationResult(RemoteOperationResult result) { return VIRUS_DETECTED; case CANNOT_CREATE_FILE: return CANNOT_CREATE_FILE; + case QUOTA_EXCEEDED: + return QUOTA_EXCEEDED; default: return UNKNOWN; } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java index 0298ef49bc0e..b5d5532fe40f 100755 --- a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java @@ -703,6 +703,9 @@ private String getUploadFailedStatusText(UploadResult result) { case LOCAL_STORAGE_NOT_COPIED: status = parentActivity.getString(R.string.upload_local_storage_not_copied); break; + case QUOTA_EXCEEDED: + status = parentActivity.getString(R.string.quota_exceeded); + break; default: status = parentActivity.getString(R.string.upload_unknown_error); break; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d552f8c69bc1..85362b526f74 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1107,4 +1107,5 @@ Year Year/Month Year/Month/Day + Quota exceeded. Free up some space on server. diff --git a/app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt b/app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt index 3bc9c77d665d..ab8efc7ccdd7 100644 --- a/app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt +++ b/app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt @@ -124,7 +124,6 @@ class BackgroundJobFactoryTest { clock, powerManagementService, { backgroundJobManager }, - deviceInfo, accountManager, resources, dataProvider,