Skip to content

Commit

Permalink
Show quota error
Browse files Browse the repository at this point in the history
Test for quota on server

Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky committed Nov 9, 2023
1 parent 1a8f70e commit d77005e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -59,7 +58,6 @@ class BackgroundJobFactory @Inject constructor(
private val clock: Clock,
private val powerManagementService: PowerManagementService,
private val backgroundJobManager: Provider<BackgroundJobManager>,
private val deviceInfo: DeviceInfo,
private val accountManager: UserAccountManager,
private val resources: Resources,
private val dataProvider: ArbitraryDataProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -687,7 +689,7 @@ public void updateDatabaseUploadStart(UploadFileOperation upload) {
updateUploadStatus(
upload.getOCUploadId(),
UploadStatus.UPLOAD_IN_PROGRESS,
UploadResult.UNKNOWN,
null,
upload.getRemotePath(),
localPath
);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/owncloud/android/db/OCUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void setDataFixed(FileUploader.FileUploaderBinder binder) {
*/
public void setUploadStatus(UploadStatus uploadStatus) {
this.uploadStatus = uploadStatus;
setLastResult(UploadResult.UNKNOWN);
// setLastResult(UploadResult.UNKNOWN);
}

/**
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/owncloud/android/db/UploadResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,4 +1107,5 @@
<string name="sub_folder_rule_year">Year</string>
<string name="sub_folder_rule_month">Year/Month</string>
<string name="sub_folder_rule_day">Year/Month/Day</string>
<string name="quota_exceeded">Quota exceeded. Free up some space on server.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class BackgroundJobFactoryTest {
clock,
powerManagementService,
{ backgroundJobManager },
deviceInfo,
accountManager,
resources,
dataProvider,
Expand Down

0 comments on commit d77005e

Please sign in to comment.