update schedules direct

This commit is contained in:
Luke Pulverenti 2015-10-01 12:28:24 -04:00
parent 4acfe20470
commit a07e6b59a3
35 changed files with 215 additions and 314 deletions

View file

@ -51,7 +51,6 @@
startSync(true, {
uploadPhotos: false,
enableBackgroundTransfer: true,
enableNewDownloads: true
});
}
@ -60,31 +59,14 @@
Logger.log('- BackgroundFetch failed');
}
var syncInterval = 1800000;
function restartInterval() {
setInterval(function () {
startIntervalSync();
}, syncInterval);
if (lastStart > 0 && (new Date().getTime() - lastStart) >= syncInterval) {
setTimeout(function () {
startIntervalSync();
}, 5000);
}
}
var syncInterval = 900000;
var photoUploadInterval = 21600000;
var offlineUserSyncInterval = 43200000;
function startIntervalSync() {
startSync(false, {
uploadPhotos: true,
enableNewDownloads: false,
enableBackgroundTransfer: true
enableNewDownloads: true
});
}
@ -92,9 +74,8 @@
options.enableBackgroundTransfer = true;
if (options.enableNewDownloads == null) {
options.enableNewDownloads = false;
}
options.uploadPhotos = (new Date().getTime() - lastStart) >= photoUploadInterval;
options.syncOfflineUsers = (new Date().getTime() - lastStart) >= offlineUserSyncInterval;
}
Dashboard.ready(function () {
@ -103,10 +84,23 @@
LocalSync.normalizeSyncOptions = normalizeSyncOptions;
});
restartInterval();
});
document.addEventListener("resume", restartInterval, false);
pageClassOn('pageshow', "page", function () {
if (!Dashboard.getCurrentUserId()) {
return;
}
if ((new Date().getTime() - lastStart) >= syncInterval) {
setTimeout(function () {
startIntervalSync();
}, 10000);
}
});
onDeviceReady();
})();