Loading app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +3 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo import java.io.File; import java.util.ArrayList; import foundation.e.drive.database.DbHelper; import foundation.e.drive.models.FileObserver; import foundation.e.drive.models.SyncedFileState; import foundation.e.drive.services.FileObserverService; import foundation.e.drive.services.InitializerService; import foundation.e.drive.utils.CommonUtils; Loading Loading @@ -138,7 +140,7 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp //if upload is a success if( uploadResult.isSuccess() ){ // InitializerService.files.remove(file); FileObserverService.files.remove(file); Object data = uploadResult.getSingleData(); if(data != null){ Loading app/src/main/java/foundation/e/drive/services/ObserverService.java +161 −154 Original line number Diff line number Diff line Loading @@ -22,12 +22,14 @@ import android.os.Parcelable; import android.provider.MediaStore; import android.support.annotation.Nullable; import android.util.Log; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.lib.resources.files.model.RemoteFile; import java.io.File; import java.io.FileFilter; import java.io.FileOutputStream; Loading Loading @@ -159,6 +161,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene } /* Common methods */ /** * Start to bind this service to OperationManagerService or start scan if binding is already set. * Method to factorise code that is called from different place Loading Loading @@ -196,6 +199,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Clear cached file unused: * remove each cached file which isn't in OperationManagerService.lockedSyncedFileState(); * * @TODO rewrite this method! */ private void clearCachedFile() { Loading @@ -219,6 +223,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Start scanning job * Load operation from DB * * @param remote if true looks for remote change. If false, look for local change. **/ Loading Loading @@ -254,7 +259,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene return; } } else { if(isFileObserverService){ if (isFileObserverService && null != fileObserverObject) { Log.e("TAG", "ObserverService..isFileObserverService...." + isFileObserverService); Loading @@ -267,7 +272,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene if (!syncedFileStates.isEmpty() || !fileObserverObject.getFiles().isEmpty()) { handleLocalFiles(fileObserverObject.getFiles(), syncedFileStates); } // handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList()); } else { Loading @@ -280,6 +284,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Get list of synced folder depending of if media and setting sync are enabled. * * @return */ private List<SyncedFolder> loadSyncedFolders() { Loading @@ -298,12 +303,9 @@ public class ObserverService extends Service implements OnRemoteOperationListene } /** * Handle end of remote Operation * * @param operation The RemoteOperation which ends and call this methods * @param result The result of the remote Operation */ Loading Loading @@ -357,6 +359,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Method to get Id of SyncedFolder to scan * * @return List<Long> id of SyncedFolder to scan */ private List<Long> getIdsFromFolderToScan() { Loading @@ -374,6 +377,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * decide what to do with remote files and decide * * @param remoteFiles Remote Files to inspect * @param syncedFileStates SyncedFileState to inspect */ Loading Loading @@ -479,6 +483,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Handle the list of syncedFileState which don't have remoteFile anymore. * * @param syncedFileStates SyncedFileState for which no remote equivalent has been found */ private void handleRemoteRemainingSyncedFileState(List<SyncedFileState> syncedFileStates) { Loading Loading @@ -668,6 +673,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene * If file has already be synced and modified since last synced then update (= upload) * if file has never been synced then upload * if file has already be on server once(=> SyncedFIleState.etag is valid) and not local file exist then remove syncedFile * * @param localFileList list of local file to scan * @param syncedFileStates List of SyncedFileState to scan */ Loading Loading @@ -763,6 +769,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * manage rest of the list of syncedFilesState to look for remote file to delete * * @param syncedFileStates List of SyncedFileState for which no local equivalent has been found */ private void handleLocalRemainingSyncedFileState(List<SyncedFileState> syncedFileStates) { Loading Loading
app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +3 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo import java.io.File; import java.util.ArrayList; import foundation.e.drive.database.DbHelper; import foundation.e.drive.models.FileObserver; import foundation.e.drive.models.SyncedFileState; import foundation.e.drive.services.FileObserverService; import foundation.e.drive.services.InitializerService; import foundation.e.drive.utils.CommonUtils; Loading Loading @@ -138,7 +140,7 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp //if upload is a success if( uploadResult.isSuccess() ){ // InitializerService.files.remove(file); FileObserverService.files.remove(file); Object data = uploadResult.getSingleData(); if(data != null){ Loading
app/src/main/java/foundation/e/drive/services/ObserverService.java +161 −154 Original line number Diff line number Diff line Loading @@ -22,12 +22,14 @@ import android.os.Parcelable; import android.provider.MediaStore; import android.support.annotation.Nullable; import android.util.Log; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.lib.resources.files.model.RemoteFile; import java.io.File; import java.io.FileFilter; import java.io.FileOutputStream; Loading Loading @@ -159,6 +161,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene } /* Common methods */ /** * Start to bind this service to OperationManagerService or start scan if binding is already set. * Method to factorise code that is called from different place Loading Loading @@ -196,6 +199,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Clear cached file unused: * remove each cached file which isn't in OperationManagerService.lockedSyncedFileState(); * * @TODO rewrite this method! */ private void clearCachedFile() { Loading @@ -219,6 +223,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Start scanning job * Load operation from DB * * @param remote if true looks for remote change. If false, look for local change. **/ Loading Loading @@ -254,7 +259,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene return; } } else { if(isFileObserverService){ if (isFileObserverService && null != fileObserverObject) { Log.e("TAG", "ObserverService..isFileObserverService...." + isFileObserverService); Loading @@ -267,7 +272,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene if (!syncedFileStates.isEmpty() || !fileObserverObject.getFiles().isEmpty()) { handleLocalFiles(fileObserverObject.getFiles(), syncedFileStates); } // handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList()); } else { Loading @@ -280,6 +284,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Get list of synced folder depending of if media and setting sync are enabled. * * @return */ private List<SyncedFolder> loadSyncedFolders() { Loading @@ -298,12 +303,9 @@ public class ObserverService extends Service implements OnRemoteOperationListene } /** * Handle end of remote Operation * * @param operation The RemoteOperation which ends and call this methods * @param result The result of the remote Operation */ Loading Loading @@ -357,6 +359,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Method to get Id of SyncedFolder to scan * * @return List<Long> id of SyncedFolder to scan */ private List<Long> getIdsFromFolderToScan() { Loading @@ -374,6 +377,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * decide what to do with remote files and decide * * @param remoteFiles Remote Files to inspect * @param syncedFileStates SyncedFileState to inspect */ Loading Loading @@ -479,6 +483,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * Handle the list of syncedFileState which don't have remoteFile anymore. * * @param syncedFileStates SyncedFileState for which no remote equivalent has been found */ private void handleRemoteRemainingSyncedFileState(List<SyncedFileState> syncedFileStates) { Loading Loading @@ -668,6 +673,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene * If file has already be synced and modified since last synced then update (= upload) * if file has never been synced then upload * if file has already be on server once(=> SyncedFIleState.etag is valid) and not local file exist then remove syncedFile * * @param localFileList list of local file to scan * @param syncedFileStates List of SyncedFileState to scan */ Loading Loading @@ -763,6 +769,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene /** * manage rest of the list of syncedFilesState to look for remote file to delete * * @param syncedFileStates List of SyncedFileState for which no local equivalent has been found */ private void handleLocalRemainingSyncedFileState(List<SyncedFileState> syncedFileStates) { Loading