Skip to content

Commit

Permalink
Merge pull request #3694 from owncloud/new_arch/polish_legacy
Browse files Browse the repository at this point in the history
[New arch] Polish some legacy code
  • Loading branch information
abelgardep authored Jun 10, 2022
2 parents 8f87e35 + 738d074 commit f0c0584
Show file tree
Hide file tree
Showing 27 changed files with 67 additions and 4,342 deletions.
1 change: 0 additions & 1 deletion owncloudApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
</provider>

<service android:name=".services.OperationsService" />
<service android:name=".files.services.FileUploader" />
<service android:name=".media.MediaService" />

<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.owncloud.android.db.UploadResult;
import com.owncloud.android.domain.camerauploads.model.UploadBehavior;
import com.owncloud.android.domain.files.model.OCFile;
import com.owncloud.android.operations.UploadFileOperation;
import com.owncloud.android.usecases.UploadEnqueuedBy;
import com.owncloud.android.utils.MimetypeIconUtil;
import timber.log.Timber;

Expand Down Expand Up @@ -91,7 +91,7 @@ public class OCUpload implements Parcelable {
private UploadResult mLastResult;

/**
* Defines the origin of the upload; see constants CREATED_ in {@link UploadFileOperation}
* Defines the origin of the upload; see constants in {@link UploadEnqueuedBy}
*/
private int mCreatedBy;

Expand Down Expand Up @@ -152,7 +152,7 @@ private void resetData() {
mCreatesRemoteFolder = false;
mUploadStatus = UploadStatus.UPLOAD_IN_PROGRESS;
mLastResult = UploadResult.UNKNOWN;
mCreatedBy = UploadFileOperation.CREATED_BY_USER;
mCreatedBy = UploadEnqueuedBy.ENQUEUED_BY_USER.ordinal();
mTransferId = "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@

import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.db.UploadResult;
import com.owncloud.android.domain.camerauploads.model.UploadBehavior;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.operations.UploadFileOperation;
import timber.log.Timber;
import com.owncloud.android.domain.files.model.OCFile;

Expand Down Expand Up @@ -446,59 +443,6 @@ public long clearSuccessfulUploads() {
return result;
}

/**
* Updates the persistent upload database with upload result.
*/
public void updateDatabaseUploadResult(RemoteOperationResult uploadResult,
UploadFileOperation uploadFileOperation) {
// result: success or fail notification
Timber.d("updateDatabaseUploadResult uploadResult: " + uploadResult + " upload: " + uploadFileOperation);

if (uploadResult.isCancelled()) {
removeUpload(
uploadFileOperation.getAccount().name,
uploadFileOperation.getRemotePath()
);
} else {
String localPath = (UploadBehavior.MOVE.toLegacyLocalBehavior() == uploadFileOperation.getLocalBehaviour())
? uploadFileOperation.getStoragePath() : null;

if (uploadResult.isSuccess()) {
updateUploadStatus(
uploadFileOperation.getOCUploadId(),
UploadStatus.UPLOAD_SUCCEEDED,
UploadResult.UPLOADED,
uploadFileOperation.getRemotePath(),
localPath
);
} else {
updateUploadStatus(
uploadFileOperation.getOCUploadId(),
UploadStatus.UPLOAD_FAILED,
UploadResult.fromOperationResult(uploadResult),
uploadFileOperation.getRemotePath(),
localPath
);
}
}
}

/**
* Updates the persistent upload database with an upload now in progress.
*/
public void updateDatabaseUploadStart(UploadFileOperation uploadFileOperation) {
String localPath = (UploadBehavior.MOVE.toLegacyLocalBehavior() == uploadFileOperation.getLocalBehaviour())
? uploadFileOperation.getStoragePath() : null;

updateUploadStatus(
uploadFileOperation.getOCUploadId(),
UploadStatus.UPLOAD_IN_PROGRESS,
UploadResult.UNKNOWN,
uploadFileOperation.getRemotePath(),
localPath
);
}

/**
* Changes the status of any in progress upload from UploadStatus.UPLOAD_IN_PROGRESS
* to UploadStatus.UPLOAD_FAILED
Expand Down
Loading

0 comments on commit f0c0584

Please sign in to comment.