Loading app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +7 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import java.io.File; import java.util.ArrayList; import java.util.Iterator; import foundation.e.drive.database.DbHelper; import foundation.e.drive.models.FileObserver; import foundation.e.drive.models.SyncedFileState; Loading Loading @@ -140,7 +142,11 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp //if upload is a success if( uploadResult.isSuccess() ){ try { FileObserverService.files.remove(file); }catch (Exception ex){ ex.printStackTrace(); } Object data = uploadResult.getSingleData(); if(data != null){ Loading app/src/main/java/foundation/e/drive/services/FileObserverService.java +6 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.util.Log; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import foundation.e.drive.receivers.ConnectivityReceiver; import foundation.e.drive.utils.CommonUtils; Loading @@ -31,7 +32,7 @@ public class FileObserverService extends Service { private final static String TAG = FileObserverService.class.getSimpleName(); RecursiveFileObserver mFileObserver = null; private int observerFlag=-1; public static List<File> files=new ArrayList<>(); public static List<File> files=new CopyOnWriteArrayList<>(); private boolean remoteFileFlag; Loading Loading @@ -144,7 +145,10 @@ public class FileObserverService extends Service { Intent observersServiceIntent = new Intent(getApplicationContext(), foundation.e.drive.services.ObserverService.class); Bundle mBundle = new Bundle(); mBundle.putBoolean("isFileObserverService", true); if(files.size()!=0) { mBundle.putByteArray("fileObserverObject", CommonUtils.convertToBytes(new foundation.e.drive.models.FileObserver(files))); } observersServiceIntent.putExtras(mBundle); startService(observersServiceIntent); }catch (Exception exception){ Loading app/src/main/java/foundation/e/drive/services/ObserverService.java +6 −3 Original line number Diff line number Diff line Loading @@ -259,10 +259,9 @@ public class ObserverService extends Service implements OnRemoteOperationListene return; } } else { if (isFileObserverService && null != fileObserverObject) { Log.e("TAG", "ObserverService..isFileObserverService...." + isFileObserverService); if (isFileObserverService && null != fileObserverObject) { Log.i(TAG, "calling observer service from event event with true and files list data"); // List<File> files = fileObserverObject.getFiles(); DbHelper.updateSyncedFolders(mSyncedFolders, this); //@ToDo: maybe do this when all contents will be synced. Loading @@ -275,6 +274,10 @@ public class ObserverService extends Service implements OnRemoteOperationListene // handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList()); } else { Log.i(TAG, "calling observer service with false or files list data null "); if(null!=FileObserverService.files){ FileObserverService.files.removeAll(FileObserverService.files); } scanLocalFiles(); } Loading Loading
app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +7 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import java.io.File; import java.util.ArrayList; import java.util.Iterator; import foundation.e.drive.database.DbHelper; import foundation.e.drive.models.FileObserver; import foundation.e.drive.models.SyncedFileState; Loading Loading @@ -140,7 +142,11 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp //if upload is a success if( uploadResult.isSuccess() ){ try { FileObserverService.files.remove(file); }catch (Exception ex){ ex.printStackTrace(); } Object data = uploadResult.getSingleData(); if(data != null){ Loading
app/src/main/java/foundation/e/drive/services/FileObserverService.java +6 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.util.Log; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import foundation.e.drive.receivers.ConnectivityReceiver; import foundation.e.drive.utils.CommonUtils; Loading @@ -31,7 +32,7 @@ public class FileObserverService extends Service { private final static String TAG = FileObserverService.class.getSimpleName(); RecursiveFileObserver mFileObserver = null; private int observerFlag=-1; public static List<File> files=new ArrayList<>(); public static List<File> files=new CopyOnWriteArrayList<>(); private boolean remoteFileFlag; Loading Loading @@ -144,7 +145,10 @@ public class FileObserverService extends Service { Intent observersServiceIntent = new Intent(getApplicationContext(), foundation.e.drive.services.ObserverService.class); Bundle mBundle = new Bundle(); mBundle.putBoolean("isFileObserverService", true); if(files.size()!=0) { mBundle.putByteArray("fileObserverObject", CommonUtils.convertToBytes(new foundation.e.drive.models.FileObserver(files))); } observersServiceIntent.putExtras(mBundle); startService(observersServiceIntent); }catch (Exception exception){ Loading
app/src/main/java/foundation/e/drive/services/ObserverService.java +6 −3 Original line number Diff line number Diff line Loading @@ -259,10 +259,9 @@ public class ObserverService extends Service implements OnRemoteOperationListene return; } } else { if (isFileObserverService && null != fileObserverObject) { Log.e("TAG", "ObserverService..isFileObserverService...." + isFileObserverService); if (isFileObserverService && null != fileObserverObject) { Log.i(TAG, "calling observer service from event event with true and files list data"); // List<File> files = fileObserverObject.getFiles(); DbHelper.updateSyncedFolders(mSyncedFolders, this); //@ToDo: maybe do this when all contents will be synced. Loading @@ -275,6 +274,10 @@ public class ObserverService extends Service implements OnRemoteOperationListene // handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList()); } else { Log.i(TAG, "calling observer service with false or files list data null "); if(null!=FileObserverService.files){ FileObserverService.files.removeAll(FileObserverService.files); } scanLocalFiles(); } Loading