Skip to content

Commit

Permalink
handleLocalBehaviour
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Jan 15, 2025
1 parent ab190f5 commit b3981bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class FileUploadWorker(
context
)
) {
uploadFileOperation.handleLocalBehaviour()
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ private void updateMetadataForV2(DecryptedFolderMetadataFile metadata, Encryptio

private void completeE2EUpload(RemoteOperationResult result, E2EFiles e2eFiles, OwnCloudClient client) {
if (result.isSuccess()) {
handleSuccessfulUpload(e2eFiles.getTemporalFile(), e2eFiles.getExpectedFile(), e2eFiles.getOriginalFile(), client);
handleLocalBehaviour(e2eFiles.getTemporalFile(), e2eFiles.getExpectedFile(), e2eFiles.getOriginalFile(), client);
} else if (result.getCode() == ResultCode.SYNC_CONFLICT) {
getStorageManager().saveConflict(mFile, mFile.getEtagInConflict());
}
Expand Down Expand Up @@ -1098,7 +1098,7 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) {
}

if (result.isSuccess()) {
handleSuccessfulUpload(temporalFile, expectedFile, originalFile, client);
handleLocalBehaviour(temporalFile, expectedFile, originalFile, client);
} else if (result.getCode() == ResultCode.SYNC_CONFLICT) {
getStorageManager().saveConflict(mFile, mFile.getEtagInConflict());
}
Expand Down Expand Up @@ -1197,10 +1197,20 @@ private RemoteOperationResult checkNameCollision(OCFile parentFile,
return null;
}

private void handleSuccessfulUpload(File temporalFile,
File expectedFile,
File originalFile,
OwnCloudClient client) {
public void handleLocalBehaviour() {
String expectedPath = FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), mFile);
File expectedFile = new File(expectedPath);
File originalFile = new File(mOriginalStoragePath);
String temporalPath = FileStorageUtils.getInternalTemporalPath(user.getAccountName(), mContext) + mFile.getRemotePath();
File temporalFile = new File(temporalPath);

handleLocalBehaviour(temporalFile, expectedFile, originalFile, getClient());
}

private void handleLocalBehaviour(File temporalFile,
File expectedFile,
File originalFile,
OwnCloudClient client) {
switch (mLocalBehaviour) {
case FileUploadWorker.LOCAL_BEHAVIOUR_FORGET:
default:
Expand Down

0 comments on commit b3981bd

Please sign in to comment.