Removed conflict badge when conflict is solved
authorDavid A. Velasco <dvelasco@solidgear.es>
Fri, 21 Aug 2015 09:35:04 +0000 (11:35 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 25 Sep 2015 13:13:49 +0000 (15:13 +0200)
src/com/owncloud/android/datamodel/FileDataStorageManager.java
src/com/owncloud/android/files/services/FileDownloader.java
src/com/owncloud/android/files/services/FileUploader.java

index 2c513c4..e6c35f7 100644 (file)
@@ -509,6 +509,7 @@ public class FileDataStorageManager {
                         // maybe unnecessary, but should be checked TODO remove if unnecessary
                         file.setStoragePath(null);
                         saveFile(file);
+                        saveConflict(file, false);
                     }
                 }
             }
@@ -1589,6 +1590,9 @@ public class FileDataStorageManager {
     }
 
     public void saveConflict(OCFile file, boolean inConflict) {
+        if (!file.isDown()) {
+            inConflict = false;
+        }
         ContentValues cv = new ContentValues();
         cv.put(ProviderTableMeta.FILE_IN_CONFLICT, inConflict);
         int updated = 0;
index 797053d..3057e5a 100644 (file)
@@ -466,6 +466,8 @@ public class FileDownloader extends Service
 
     /**
      * Updates the OC File after a successful download.
+     *
+     * TODO move to DownloadFileOperation
      */
     private void saveDownloadedFile() {
         OCFile file = mStorageManager.getFileById(mCurrentDownload.getFile().getFileId());
@@ -482,6 +484,7 @@ public class FileDownloader extends Service
         file.setRemoteId(mCurrentDownload.getFile().getRemoteId());
         mStorageManager.saveFile(file);
         mStorageManager.triggerMediaScan(file.getStoragePath());
+        mStorageManager.saveConflict(file, false);
     }
 
     /**
index 2695b77..7c36996 100644 (file)
@@ -670,7 +670,7 @@ public class FileUploader extends Service
      * synchronized with the server, specially the modification time and Etag
      * (where available)
      *
-     * TODO refactor this ugly thing
+     * TODO move into UploadFileOperation
      */
     private void saveUploadedFile() {
         OCFile file = mCurrentUpload.getFile();
@@ -699,6 +699,7 @@ public class FileUploader extends Service
             if (oldFile.fileExists()) {
                 oldFile.setStoragePath(null);
                 mStorageManager.saveFile(oldFile);
+                mStorageManager.saveConflict(oldFile, false);
 
             } // else: it was just an automatic renaming due to a name
             // coincidence; nothing else is needed, the storagePath is right
@@ -706,6 +707,7 @@ public class FileUploader extends Service
         }
         file.setNeedsUpdateThumbnail(true);
         mStorageManager.saveFile(file);
+        mStorageManager.saveConflict(file, false);
     }
 
     private void updateOCFile(OCFile file, RemoteFile remoteFile) {