From eb869028975987600262db30074859fa53b6f457 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 15:38:41 +0100 Subject: [PATCH 1/7] Remove implementation of Parcelable --- .../drive/operations/UploadFileOperation.java | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index f4ec50ae..25996ecf 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -9,8 +9,6 @@ package foundation.e.drive.operations; import android.content.Context; -import android.os.Parcel; -import android.os.Parcelable; import android.util.Log; import androidx.annotation.VisibleForTesting; @@ -34,7 +32,7 @@ import foundation.e.drive.utils.CommonUtils; * @author Vincent Bourgmayer * High level Operation which upload a local file to a remote cloud storage */ -public class UploadFileOperation extends RemoteOperation implements Parcelable { +public class UploadFileOperation extends RemoteOperation { private final static String TAG = UploadFileOperation.class.getSimpleName(); @@ -45,25 +43,6 @@ public class UploadFileOperation extends RemoteOperation implements Parcelable { private long availableQuota = -1; - protected UploadFileOperation(Parcel in) { - restartCounter = in.readInt(); - previousLastModified = in.readLong(); - mSyncedState = in.readParcelable(SyncedFileState.class.getClassLoader()); - availableQuota = in.readLong(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public UploadFileOperation createFromParcel(Parcel in) { - return new UploadFileOperation(in); - } - - @Override - public UploadFileOperation[] newArray(int size) { - return new UploadFileOperation[size]; - } - }; - /** * Construct an upload operation with an already known syncedFileState * @param syncedFileState syncedFileState corresponding to file. @@ -229,17 +208,4 @@ public class UploadFileOperation extends RemoteOperation implements Parcelable { return new RemoteOperationResult(ocsResult.getCode()); } } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(restartCounter); - dest.writeLong(previousLastModified); - dest.writeParcelable(mSyncedState, flags); - dest.writeLong(availableQuota); - } } -- GitLab From 14a605ef1d2f9fe2921a500e05b93ac0425a9541 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 15:41:47 +0100 Subject: [PATCH 2/7] fix coding style for if/else statement & space around bracket --- .../drive/operations/UploadFileOperation.java | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index 25996ecf..ad359bff 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -35,7 +35,6 @@ import foundation.e.drive.utils.CommonUtils; public class UploadFileOperation extends RemoteOperation { private final static String TAG = UploadFileOperation.class.getSimpleName(); - private int restartCounter =0; private long previousLastModified; //get to restore real value if all trials fails private Context mContext; @@ -47,12 +46,12 @@ public class UploadFileOperation extends RemoteOperation { * Construct an upload operation with an already known syncedFileState * @param syncedFileState syncedFileState corresponding to file. */ - public UploadFileOperation (SyncedFileState syncedFileState){ + public UploadFileOperation (SyncedFileState syncedFileState) { this.mSyncedState = syncedFileState; this.previousLastModified = mSyncedState.getLocalLastModified(); } - public void setContext(Context context){ + public void setContext(Context context) { this.mContext = context; } @@ -70,15 +69,15 @@ public class UploadFileOperation extends RemoteOperation { * hasn't change since last update or "forbidden" if no remote path can be fetch. */ @Override - protected RemoteOperationResult run( OwnCloudClient client ) { + protected RemoteOperationResult run(OwnCloudClient client ) { //as operation isn't executed immediatly, file might have been deleted since creation of operation - if(mSyncedState == null ){ + if (mSyncedState == null ) { Log.e(TAG, "run(client): no syncedFileState or target path, can't perform upload operation"); return new RemoteOperationResult(ResultCode.FORBIDDEN); } File file = new File(mSyncedState.getLocalPath()); - if(file == null || !file.exists()){ + if (file == null || !file.exists()) { Log.w(TAG, "Can't get the file. It might have been deleted"); return new RemoteOperationResult(ResultCode.FORBIDDEN); } @@ -92,9 +91,9 @@ public class UploadFileOperation extends RemoteOperation { return new RemoteOperationResult(ResultCode.SYNC_CONFLICT); } - if(this.availableQuota == -1){ + if (this.availableQuota == -1) { RemoteOperationResult checkQuotaResult = checkAvailableSpace(client, file.length()); - if( checkQuotaResult.getCode() != ResultCode.OK ){ + if (checkQuotaResult.getCode() != ResultCode.OK) { return new RemoteOperationResult(checkQuotaResult.getCode()); } } @@ -102,45 +101,45 @@ public class UploadFileOperation extends RemoteOperation { UploadFileRemoteOperation uploadOperation = buildUploadOperation(file, targetPath); // Execute UploadFileOperation - RemoteOperationResult uploadResult = uploadOperation.execute( client ); + RemoteOperationResult uploadResult = uploadOperation.execute(client ); ResultCode mResultCode; boolean mustRestart = true; //if upload is a success - if( uploadResult.isSuccess() ){ + if (uploadResult.isSuccess()) { Object data = uploadResult.getSingleData(); - if(data != null){ + if (data != null) { mSyncedState.setLastETAG((String) data); } mSyncedState.setLocalLastModified(file.lastModified()); mResultCode = uploadResult.getCode(); mustRestart = false; - }else{ + } else { //Si les répértoires ou mettre le fichier n'existe pas, on les ajoutes. - if( uploadResult.getCode() == ResultCode.FILE_NOT_FOUND ){ + if (uploadResult.getCode() == ResultCode.FILE_NOT_FOUND ) { Log.d(TAG, "Catched a File not found result for : "+file.getName()+", create missing remote path then retry"); - String remoteFoldersPath = targetPath.substring( 0, targetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 ); + String remoteFoldersPath = targetPath.substring(0, targetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 ); mResultCode = ResultCode.FILE_NOT_FOUND; - CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation( remoteFoldersPath, true ); + CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation(remoteFoldersPath, true ); try{ - RemoteOperationResult createFolderResult = createFolderOperation.execute( client ); + RemoteOperationResult createFolderResult = createFolderOperation.execute(client ); - if(!createFolderResult.isSuccess() && createFolderResult.getCode() != ResultCode.FOLDER_ALREADY_EXISTS){ + if (!createFolderResult.isSuccess() && createFolderResult.getCode() != ResultCode.FOLDER_ALREADY_EXISTS) { mResultCode = createFolderResult.getCode(); Log.e(TAG, createFolderResult.getLogMessage()); mustRestart = false; - mSyncedState.setLocalLastModified( this.previousLastModified); + mSyncedState.setLocalLastModified(this.previousLastModified); } - }catch(Exception e){ + }catch(Exception e) { Log.e(TAG, e.toString() ); - mSyncedState.setLocalLastModified( this.previousLastModified); + mSyncedState.setLocalLastModified(this.previousLastModified); mustRestart = false; } - }else if(uploadResult.getCode() == ResultCode.QUOTA_EXCEEDED){ + } else if (uploadResult.getCode() == ResultCode.QUOTA_EXCEEDED) { mResultCode = ResultCode.QUOTA_EXCEEDED; mustRestart = false; - }else{ + } else { //Upload failed Log.e(TAG, "UploadFileRemoteOperation for : " + file.getName() + " failed => code: " + uploadResult.getCode()); mResultCode = ResultCode.UNKNOWN_ERROR; @@ -148,13 +147,13 @@ public class UploadFileOperation extends RemoteOperation { } } - if(mustRestart) { + if (mustRestart) { if (this.restartCounter < 1) { this.restartCounter += 1; //if we encounter more than three times same error, stop trying to download. return this.run(client); } else { - mSyncedState.setLocalLastModified( this.previousLastModified); //Revert syncFileState to its previous state + mSyncedState.setLocalLastModified(this.previousLastModified); //Revert syncFileState to its previous state } } // updated syncedFile in DB @@ -171,14 +170,14 @@ public class UploadFileOperation extends RemoteOperation { * Build the operation to put the file on server * @return the operation to execute */ - private UploadFileRemoteOperation buildUploadOperation(File file, String targetPath){ - String timeStamp = ( (Long) ( file.lastModified() / 1000) ).toString() ; + private UploadFileRemoteOperation buildUploadOperation(File file, String targetPath) { + String timeStamp = ((Long) (file.lastModified() / 1000) ).toString() ; //create UploadFileOperation - UploadFileRemoteOperation uploadRemoteFileOperation = new UploadFileRemoteOperation( mSyncedState.getLocalPath(), - ( targetPath != null ) ? targetPath : mSyncedState.getRemotePath(), - CommonUtils.getMimeType( file ), - ( !this.mSyncedState.isMediaType() || mSyncedState.getLastETAG().isEmpty() )? null : mSyncedState.getLastETAG(), //If not null, This can cause error 412; that means remote file has change + UploadFileRemoteOperation uploadRemoteFileOperation = new UploadFileRemoteOperation(mSyncedState.getLocalPath(), + (targetPath != null ) ? targetPath : mSyncedState.getRemotePath(), + CommonUtils.getMimeType(file ), + (!this.mSyncedState.isMediaType() || mSyncedState.getLastETAG().isEmpty() )? null : mSyncedState.getLastETAG(), //If not null, This can cause error 412; that means remote file has change timeStamp ); uploadRemoteFileOperation.askResultEtag(true); return uploadRemoteFileOperation; @@ -190,20 +189,20 @@ public class UploadFileOperation extends RemoteOperation { * @return RemoteOperationResult */ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - public RemoteOperationResult checkAvailableSpace(OwnCloudClient client, long fileSize){ + public RemoteOperationResult checkAvailableSpace(OwnCloudClient client, long fileSize) { GetRemoteUserInfoOperation getRemoteUserInfoOperation = new GetRemoteUserInfoOperation(); RemoteOperationResult ocsResult = getRemoteUserInfoOperation.execute(client); - if(ocsResult.isSuccess() && ocsResult.getData() != null){ + if (ocsResult.isSuccess() && ocsResult.getData() != null) { UserInfo userInfo = (UserInfo) ocsResult.getData().get(0); this.availableQuota = userInfo.getQuota().getFree(); - if( ((UserInfo) ocsResult.getData().get(0)).getQuota().getFree() < fileSize ) { + if (((UserInfo) ocsResult.getData().get(0)).getQuota().getFree() < fileSize ) { Log.w(TAG, "quota exceeded!"); return new RemoteOperationResult(ResultCode.QUOTA_EXCEEDED); - }else{ + } else { Log.d(TAG, "Quota Okay"); return new RemoteOperationResult(ResultCode.OK); } - }else{ + } else { Log.w(TAG, "getRemoteUserInfoOperation failed: "+ocsResult.getHttpCode() ); return new RemoteOperationResult(ocsResult.getCode()); } -- GitLab From 6da189b2698153ab7fd4d743f48e81d5000f0be2 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 15:43:24 +0100 Subject: [PATCH 3/7] Use a single variable naming convention --- .../drive/operations/UploadFileOperation.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index ad359bff..c07c04ed 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -37,8 +37,8 @@ public class UploadFileOperation extends RemoteOperation { private int restartCounter =0; private long previousLastModified; //get to restore real value if all trials fails - private Context mContext; - private SyncedFileState mSyncedState; + private Context context; + private SyncedFileState syncedState; private long availableQuota = -1; @@ -47,12 +47,12 @@ public class UploadFileOperation extends RemoteOperation { * @param syncedFileState syncedFileState corresponding to file. */ public UploadFileOperation (SyncedFileState syncedFileState) { - this.mSyncedState = syncedFileState; - this.previousLastModified = mSyncedState.getLocalLastModified(); + this.syncedState = syncedFileState; + this.previousLastModified = syncedState.getLocalLastModified(); } public void setContext(Context context) { - this.mContext = context; + this.context = context; } @@ -71,23 +71,23 @@ public class UploadFileOperation extends RemoteOperation { @Override protected RemoteOperationResult run(OwnCloudClient client ) { //as operation isn't executed immediatly, file might have been deleted since creation of operation - if (mSyncedState == null ) { + if (syncedState == null ) { Log.e(TAG, "run(client): no syncedFileState or target path, can't perform upload operation"); return new RemoteOperationResult(ResultCode.FORBIDDEN); } - File file = new File(mSyncedState.getLocalPath()); + File file = new File(syncedState.getLocalPath()); if (file == null || !file.exists()) { Log.w(TAG, "Can't get the file. It might have been deleted"); return new RemoteOperationResult(ResultCode.FORBIDDEN); } - String targetPath = mSyncedState.getRemotePath(); + String targetPath = syncedState.getRemotePath(); //If an Etag is already Stored and LastModified from DB is the same as real file - if (mSyncedState.isLastEtagStored() - && mSyncedState.getLocalLastModified() == file.lastModified()) { - Log.d(TAG, "mySyncedState last modified: "+mSyncedState.getLocalLastModified()+" <=> mFile last modified: "+file.lastModified() +": So return sync_conflict"); + if (syncedState.isLastEtagStored() + && syncedState.getLocalLastModified() == file.lastModified()) { + Log.d(TAG, "mySyncedState last modified: "+ syncedState.getLocalLastModified()+" <=> mFile last modified: "+file.lastModified() +": So return sync_conflict"); return new RemoteOperationResult(ResultCode.SYNC_CONFLICT); } @@ -109,9 +109,9 @@ public class UploadFileOperation extends RemoteOperation { if (uploadResult.isSuccess()) { Object data = uploadResult.getSingleData(); if (data != null) { - mSyncedState.setLastETAG((String) data); + syncedState.setLastETAG((String) data); } - mSyncedState.setLocalLastModified(file.lastModified()); + syncedState.setLocalLastModified(file.lastModified()); mResultCode = uploadResult.getCode(); mustRestart = false; } else { @@ -128,11 +128,11 @@ public class UploadFileOperation extends RemoteOperation { mResultCode = createFolderResult.getCode(); Log.e(TAG, createFolderResult.getLogMessage()); mustRestart = false; - mSyncedState.setLocalLastModified(this.previousLastModified); + syncedState.setLocalLastModified(this.previousLastModified); } }catch(Exception e) { Log.e(TAG, e.toString() ); - mSyncedState.setLocalLastModified(this.previousLastModified); + syncedState.setLocalLastModified(this.previousLastModified); mustRestart = false; } @@ -153,14 +153,14 @@ public class UploadFileOperation extends RemoteOperation { //if we encounter more than three times same error, stop trying to download. return this.run(client); } else { - mSyncedState.setLocalLastModified(this.previousLastModified); //Revert syncFileState to its previous state + syncedState.setLocalLastModified(this.previousLastModified); //Revert syncFileState to its previous state } } // updated syncedFile in DB - DbHelper.manageSyncedFileStateDB(mSyncedState, "UPDATE", mContext); + DbHelper.manageSyncedFileStateDB(syncedState, "UPDATE", context); ArrayList datas = new ArrayList<>(); - datas.add(mSyncedState.getSyncedFolderId()); + datas.add(syncedState.getSyncedFolderId()); final RemoteOperationResult finalResult = new RemoteOperationResult(mResultCode); finalResult.setData(datas); return finalResult; @@ -174,10 +174,10 @@ public class UploadFileOperation extends RemoteOperation { String timeStamp = ((Long) (file.lastModified() / 1000) ).toString() ; //create UploadFileOperation - UploadFileRemoteOperation uploadRemoteFileOperation = new UploadFileRemoteOperation(mSyncedState.getLocalPath(), - (targetPath != null ) ? targetPath : mSyncedState.getRemotePath(), + UploadFileRemoteOperation uploadRemoteFileOperation = new UploadFileRemoteOperation(syncedState.getLocalPath(), + (targetPath != null ) ? targetPath : syncedState.getRemotePath(), CommonUtils.getMimeType(file ), - (!this.mSyncedState.isMediaType() || mSyncedState.getLastETAG().isEmpty() )? null : mSyncedState.getLastETAG(), //If not null, This can cause error 412; that means remote file has change + (!this.syncedState.isMediaType() || syncedState.getLastETAG().isEmpty() )? null : syncedState.getLastETAG(), //If not null, This can cause error 412; that means remote file has change timeStamp ); uploadRemoteFileOperation.askResultEtag(true); return uploadRemoteFileOperation; -- GitLab From b40b149cede82970c6e2885ceeec981a97120404 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 15:44:21 +0100 Subject: [PATCH 4/7] fusion setContext(Context context) & constructor --- .../foundation/e/drive/operations/UploadFileOperation.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index c07c04ed..74dd5135 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -46,17 +46,12 @@ public class UploadFileOperation extends RemoteOperation { * Construct an upload operation with an already known syncedFileState * @param syncedFileState syncedFileState corresponding to file. */ - public UploadFileOperation (SyncedFileState syncedFileState) { + public UploadFileOperation (SyncedFileState syncedFileState, Context context) { this.syncedState = syncedFileState; this.previousLastModified = syncedState.getLocalLastModified(); - } - - public void setContext(Context context) { this.context = context; } - - /** * Execute the operation: * -- GitLab From ce1bcca674f616f7e64ddcef3295a1f84ff76a69 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 16:35:05 +0100 Subject: [PATCH 5/7] cleaning of "run(OwncloudClient client)" - Rename variable starting with "m" to remove this character - Set few variables final --- .../drive/operations/UploadFileOperation.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index 74dd5135..de98d639 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -39,7 +39,6 @@ public class UploadFileOperation extends RemoteOperation { private long previousLastModified; //get to restore real value if all trials fails private Context context; private SyncedFileState syncedState; - private long availableQuota = -1; /** @@ -77,12 +76,13 @@ public class UploadFileOperation extends RemoteOperation { return new RemoteOperationResult(ResultCode.FORBIDDEN); } - String targetPath = syncedState.getRemotePath(); + final String targetPath = syncedState.getRemotePath(); //If an Etag is already Stored and LastModified from DB is the same as real file + //@todo check this case if (syncedState.isLastEtagStored() && syncedState.getLocalLastModified() == file.lastModified()) { - Log.d(TAG, "mySyncedState last modified: "+ syncedState.getLocalLastModified()+" <=> mFile last modified: "+file.lastModified() +": So return sync_conflict"); + Log.d(TAG, "syncedState last modified: "+ syncedState.getLocalLastModified()+" <=> file last modified: "+file.lastModified() +": So return sync_conflict"); return new RemoteOperationResult(ResultCode.SYNC_CONFLICT); } @@ -93,11 +93,11 @@ public class UploadFileOperation extends RemoteOperation { } } - UploadFileRemoteOperation uploadOperation = buildUploadOperation(file, targetPath); + final UploadFileRemoteOperation uploadOperation = buildUploadOperation(file, targetPath); // Execute UploadFileOperation RemoteOperationResult uploadResult = uploadOperation.execute(client ); - ResultCode mResultCode; + ResultCode resultCode; boolean mustRestart = true; //if upload is a success @@ -107,20 +107,20 @@ public class UploadFileOperation extends RemoteOperation { syncedState.setLastETAG((String) data); } syncedState.setLocalLastModified(file.lastModified()); - mResultCode = uploadResult.getCode(); + resultCode = uploadResult.getCode(); mustRestart = false; } else { //Si les répértoires ou mettre le fichier n'existe pas, on les ajoutes. if (uploadResult.getCode() == ResultCode.FILE_NOT_FOUND ) { + resultCode = ResultCode.FILE_NOT_FOUND; Log.d(TAG, "Catched a File not found result for : "+file.getName()+", create missing remote path then retry"); - String remoteFoldersPath = targetPath.substring(0, targetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 ); - mResultCode = ResultCode.FILE_NOT_FOUND; - CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation(remoteFoldersPath, true ); + final String remoteFolderPath = targetPath.substring(0, targetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 ); + final CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation(remoteFolderPath, true ); try{ RemoteOperationResult createFolderResult = createFolderOperation.execute(client ); if (!createFolderResult.isSuccess() && createFolderResult.getCode() != ResultCode.FOLDER_ALREADY_EXISTS) { - mResultCode = createFolderResult.getCode(); + resultCode = createFolderResult.getCode(); Log.e(TAG, createFolderResult.getLogMessage()); mustRestart = false; syncedState.setLocalLastModified(this.previousLastModified); @@ -132,12 +132,12 @@ public class UploadFileOperation extends RemoteOperation { } } else if (uploadResult.getCode() == ResultCode.QUOTA_EXCEEDED) { - mResultCode = ResultCode.QUOTA_EXCEEDED; + resultCode = ResultCode.QUOTA_EXCEEDED; mustRestart = false; } else { //Upload failed Log.e(TAG, "UploadFileRemoteOperation for : " + file.getName() + " failed => code: " + uploadResult.getCode()); - mResultCode = ResultCode.UNKNOWN_ERROR; + resultCode = ResultCode.UNKNOWN_ERROR; mustRestart = false; } } @@ -156,7 +156,7 @@ public class UploadFileOperation extends RemoteOperation { ArrayList datas = new ArrayList<>(); datas.add(syncedState.getSyncedFolderId()); - final RemoteOperationResult finalResult = new RemoteOperationResult(mResultCode); + final RemoteOperationResult finalResult = new RemoteOperationResult(resultCode); finalResult.setData(datas); return finalResult; } -- GitLab From 1820f292fda16627c3ade964d21475401febe212 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 16:36:44 +0100 Subject: [PATCH 6/7] use new signature of UploadFileOperation's constructor --- .../foundation/e/drive/services/SynchronizationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java index e03d4a55..cd4de9fe 100644 --- a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java +++ b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java @@ -222,7 +222,7 @@ public class SynchronizationService extends Service implements OnRemoteOperation switch (request.getOperationType()){ case UPLOAD: final SyncedFileState sfs = request.getSyncedFileState(); - operation = new UploadFileOperation(sfs); + operation = new UploadFileOperation(sfs, getApplicationContext()); break; case DOWNLOAD: final DownloadRequest downloadRequest = (DownloadRequest) request; -- GitLab From 3d774461af2903427c111fdba482fd1821f202df Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 22 Mar 2022 16:51:00 +0100 Subject: [PATCH 7/7] remove a todo comment --- .../java/foundation/e/drive/operations/UploadFileOperation.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index de98d639..e0fdfe24 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -79,7 +79,6 @@ public class UploadFileOperation extends RemoteOperation { final String targetPath = syncedState.getRemotePath(); //If an Etag is already Stored and LastModified from DB is the same as real file - //@todo check this case if (syncedState.isLastEtagStored() && syncedState.getLocalLastModified() == file.lastModified()) { Log.d(TAG, "syncedState last modified: "+ syncedState.getLocalLastModified()+" <=> file last modified: "+file.lastModified() +": So return sync_conflict"); -- GitLab