Enforced check of local modification date when synchronizing file contents to avoid...
authorDavid A. Velasco <dvelasco@solidgear.es>
Fri, 18 Oct 2013 11:24:56 +0000 (13:24 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 18 Oct 2013 11:24:56 +0000 (13:24 +0200)
src/com/owncloud/android/files/OwnCloudFileObserver.java
src/com/owncloud/android/operations/SynchronizeFileOperation.java
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

index 2ea90c9..5383520 100644 (file)
@@ -83,7 +83,6 @@ public class OwnCloudFileObserver extends FileObserver {
                                                                     storageManager, 
                                                                     mOCAccount, 
                                                                     true, 
                                                                     storageManager, 
                                                                     mOCAccount, 
                                                                     true, 
-                                                                    true, 
                                                                     mContext);
         RemoteOperationResult result = sfo.execute(mOCAccount, mContext);
         if (result.getCode() == ResultCode.SYNC_CONFLICT) {
                                                                     mContext);
         RemoteOperationResult result = sfo.execute(mOCAccount, mContext);
         if (result.getCode() == ResultCode.SYNC_CONFLICT) {
index f02241e..b5f6575 100644 (file)
@@ -49,7 +49,6 @@ public class SynchronizeFileOperation extends RemoteOperation {
     private FileDataStorageManager mStorageManager;
     private Account mAccount;
     private boolean mSyncFileContents;
     private FileDataStorageManager mStorageManager;
     private Account mAccount;
     private boolean mSyncFileContents;
-    private boolean mLocalChangeAlreadyKnown;
     private Context mContext;
     
     private boolean mTransferWasRequested = false;
     private Context mContext;
     
     private boolean mTransferWasRequested = false;
@@ -60,7 +59,6 @@ public class SynchronizeFileOperation extends RemoteOperation {
             FileDataStorageManager storageManager, 
             Account account, 
             boolean syncFileContents,
             FileDataStorageManager storageManager, 
             Account account, 
             boolean syncFileContents,
-            boolean localChangeAlreadyKnown, 
             Context context) {
         
         mLocalFile = localFile;
             Context context) {
         
         mLocalFile = localFile;
@@ -68,7 +66,6 @@ public class SynchronizeFileOperation extends RemoteOperation {
         mStorageManager = storageManager;
         mAccount = account;
         mSyncFileContents = syncFileContents;
         mStorageManager = storageManager;
         mAccount = account;
         mSyncFileContents = syncFileContents;
-        mLocalChangeAlreadyKnown = localChangeAlreadyKnown;
         mContext = context;
     }
 
         mContext = context;
     }
 
@@ -119,7 +116,7 @@ public class SynchronizeFileOperation extends RemoteOperation {
                         // server without etags
                         serverChanged = (mServerFile.getModificationTimestamp() > mLocalFile.getModificationTimestampAtLastSyncForData());
                     //}
                         // server without etags
                         serverChanged = (mServerFile.getModificationTimestamp() > mLocalFile.getModificationTimestampAtLastSyncForData());
                     //}
-                    boolean localChanged = (mLocalChangeAlreadyKnown || mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
+                    boolean localChanged = (mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
                         // TODO this will be always true after the app is upgraded to database version 2; will result in unnecessary uploads
               
                     /// decide action to perform depending upon changes
                         // TODO this will be always true after the app is upgraded to database version 2; will result in unnecessary uploads
               
                     /// decide action to perform depending upon changes
index 91047ce..d1dd3c4 100644 (file)
@@ -307,7 +307,6 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                                                                                         mStorageManager,
                                                                                         mAccount,       
                                                                                         true, 
                                                                                         mStorageManager,
                                                                                         mAccount,       
                                                                                         true, 
-                                                                                        false,          
                                                                                         mContext
                                                                                         );
                     filesToSyncContents.add(operation);
                                                                                         mContext
                                                                                         );
                     filesToSyncContents.add(operation);
index 1c076da..9de098b 100644 (file)
@@ -446,7 +446,7 @@ public class FileDetailFragment extends FileFragment implements
             }
             
         } else {
             }
             
         } else {
-            mLastRemoteOperation = new SynchronizeFileOperation(file, null, mStorageManager, mAccount, true, false, getActivity());
+            mLastRemoteOperation = new SynchronizeFileOperation(file, null, mStorageManager, mAccount, true, getActivity());
             mLastRemoteOperation.execute(mAccount, getSherlockActivity(), this, mHandler, getSherlockActivity());
             
             // update ui 
             mLastRemoteOperation.execute(mAccount, getSherlockActivity(), this, mHandler, getSherlockActivity());
             
             // update ui 
index 06b6464..2627f93 100644 (file)
@@ -315,7 +315,7 @@ public class OCFileListFragment extends ExtendedListFragment implements EditName
             }
             case R.id.action_sync_file: {
                 Account account = AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity());
             }
             case R.id.action_sync_file: {
                 Account account = AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity());
-                RemoteOperation operation = new SynchronizeFileOperation(mTargetFile, null, mContainerActivity.getStorageManager(), account, true, false, getSherlockActivity());
+                RemoteOperation operation = new SynchronizeFileOperation(mTargetFile, null, mContainerActivity.getStorageManager(), account, true, getSherlockActivity());
                 operation.execute(account, getSherlockActivity(), mContainerActivity, mHandler, getSherlockActivity());
                 ((FileDisplayActivity) getSherlockActivity()).showLoadingDialog();
                 return true;
                 operation.execute(account, getSherlockActivity(), mContainerActivity, mHandler, getSherlockActivity());
                 ((FileDisplayActivity) getSherlockActivity()).showLoadingDialog();
                 return true;