Эх сурвалжийг харах

Fixes

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 жил өмнө
parent
commit
a40833b99d

+ 6 - 10
src/main/java/com/owncloud/android/MainApp.java

@@ -128,13 +128,11 @@ public class MainApp extends MultiDexApplication {
             PreferenceManager.setAutoUploadSplitEntries(this, true);
         }
 
-        if (JobManager.instance().getAllJobRequestsForTag(FilesSyncJob.TAG).isEmpty()) {
-            new JobRequest.Builder(FilesSyncJob.TAG)
-                    .setPeriodic(900000L, 300000L)
-                    .setUpdateCurrent(true)
-                    .build()
-                    .schedule();
-        }
+        new JobRequest.Builder(FilesSyncJob.TAG)
+                .setPeriodic(900000L, 300000L)
+                .setUpdateCurrent(true)
+                .build()
+                .schedule();
 
         FilesSyncHelper.restartJobsIfNeeded();
 
@@ -357,9 +355,7 @@ public class MainApp extends MultiDexApplication {
                 }
             }
 
-            for (Long idValue : syncedFolders.values()) {
-                ids.add(idValue);
-            }
+            ids.addAll(syncedFolders.values());
 
             if (ids.size() > 0) {
                 syncedFolderProvider.deleteSyncedFoldersNotInList(mContext, ids);

+ 2 - 33
src/main/java/com/owncloud/android/datamodel/FilesystemDataProvider.java

@@ -27,7 +27,6 @@ import android.net.Uri;
 import com.owncloud.android.db.ProviderMeta;
 import com.owncloud.android.lib.common.utils.Log_OC;
 
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -44,21 +43,16 @@ public class FilesystemDataProvider {
         this.contentResolver = contentResolver;
     }
 
-    public void updateFilesInList(Object[] paths, String syncedFolderId) {
+    public void updateFilesystemFileAsSentForUpload(String path, String syncedFolderId) {
         ContentValues cv = new ContentValues();
         cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD, 1);
 
-        String[] stringPaths = new String[paths.length];
-        for (int i = 0; i < paths.length; i++) {
-            stringPaths[i] = (String) paths[i];
-        }
-
         contentResolver.update(
                 ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
                 cv,
                 ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH + " IN (?) and " +
                         ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID + " = ?",
-                new String[]{Arrays.toString(stringPaths), syncedFolderId}
+                new String[]{path, syncedFolderId}
         );
 
     }
@@ -99,31 +93,6 @@ public class FilesystemDataProvider {
 
     }
 
-    public long countFilesThatNeedUploadInFolder(String localPath) {
-        String likeParam = localPath + "%";
-
-        Cursor cursor = contentResolver.query(
-                ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
-                new String[]{"count(*)"},
-                ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH + " LIKE ?",
-                new String[]{likeParam},
-                null);
-
-        if (cursor != null) {
-            if (cursor.getCount() == 0) {
-                cursor.close();
-                return 0;
-            } else {
-                cursor.moveToFirst();
-                int result = cursor.getInt(0);
-                cursor.close();
-                return result;
-            }
-        } else {
-            return 0;
-        }
-    }
-
     public void storeOrUpdateFileValue(String localPath, long modifiedAt, boolean isFolder, SyncedFolder syncedFolder,
                                        boolean dryRun) {
 

+ 1 - 1
src/main/java/com/owncloud/android/jobs/FilesSyncJob.java

@@ -125,7 +125,7 @@ public class FilesSyncJob extends Job {
                                     .build()
                                     .schedule();
 
-                            filesystemDataProvider.updateFilesInList(new Object[]{path},
+                            filesystemDataProvider.updateFilesystemFileAsSentForUpload(path,
                                     Long.toString(syncedFolder.getId()));
                         }
                     }

+ 1 - 1
src/main/java/com/owncloud/android/jobs/NewAutoUploadJob.java

@@ -188,7 +188,7 @@ public class NewAutoUploadJob extends Job {
         }
 
         // set them as sent for upload
-        //filesystemDataProvider.updateFilesInList(pathsToSet.toArray());
+        //filesystemDataProvider.updateFilesystemFileAsSentForUpload(pathsToSet.toArray());
 
         wakeLock.release();*/
         return Result.SUCCESS;