Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-06-30 13:52:00 +02:00 committed by AndyScherzinger
parent 32cd15d922
commit a40833b99d
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
4 changed files with 10 additions and 45 deletions

View file

@ -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);

View file

@ -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) {

View file

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

View file

@ -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;