mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update media sync
This commit is contained in:
parent
6ef418cf8d
commit
09c7da7d48
19 changed files with 138 additions and 95 deletions
43
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
43
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
|
@ -27,7 +27,7 @@
|
|||
fetcher.finish(); // <-- N.B. You MUST called #finish so that native-side can signal completion of the background-thread to the os.
|
||||
}
|
||||
|
||||
function startSync(reportToFetcher) {
|
||||
function startSync(reportToFetcher, syncOptions) {
|
||||
lastStart = new Date().getTime();
|
||||
|
||||
require(['localsync'], function () {
|
||||
|
@ -37,7 +37,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var promise = LocalSync.sync();
|
||||
var promise = LocalSync.sync(syncOptions);
|
||||
|
||||
if (reportToFetcher) {
|
||||
promise.done(onSyncFinish).fail(onSyncFail);
|
||||
|
@ -48,7 +48,12 @@
|
|||
function onBackgroundFetch() {
|
||||
|
||||
Logger.log('BackgroundFetch initiated');
|
||||
startSync(true);
|
||||
|
||||
startSync(true, {
|
||||
uploadPhotos: false,
|
||||
enableBackgroundTransfer: true,
|
||||
enableNewDownloads: true
|
||||
});
|
||||
}
|
||||
|
||||
function onBackgroundFetchFailed() {
|
||||
|
@ -61,20 +66,46 @@
|
|||
|
||||
setInterval(function () {
|
||||
|
||||
//startSync();
|
||||
startIntervalSync();
|
||||
|
||||
}, syncInterval);
|
||||
|
||||
if (lastStart > 0 && (new Date().getTime() - lastStart) >= syncInterval) {
|
||||
|
||||
setTimeout(function () {
|
||||
//startSync();
|
||||
startIntervalSync();
|
||||
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
Dashboard.ready(restartInterval);
|
||||
function startIntervalSync() {
|
||||
|
||||
startSync(false, {
|
||||
uploadPhotos: true,
|
||||
enableNewDownloads: false,
|
||||
enableBackgroundTransfer: true
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeSyncOptions(options) {
|
||||
|
||||
options.enableBackgroundTransfer = true;
|
||||
|
||||
if (options.enableNewDownloads == null) {
|
||||
options.enableNewDownloads = false;
|
||||
}
|
||||
}
|
||||
|
||||
Dashboard.ready(function () {
|
||||
|
||||
require(['localsync'], function () {
|
||||
|
||||
LocalSync.normalizeSyncOptions = normalizeSyncOptions;
|
||||
});
|
||||
|
||||
restartInterval();
|
||||
});
|
||||
document.addEventListener("resume", restartInterval, false);
|
||||
|
||||
onDeviceReady();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue