mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update schedules direct
This commit is contained in:
parent
4acfe20470
commit
a07e6b59a3
35 changed files with 215 additions and 314 deletions
50
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
50
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
|
@ -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();
|
||||
})();
|
35
dashboard-ui/cordova/ios/tabbar.js
vendored
35
dashboard-ui/cordova/ios/tabbar.js
vendored
|
@ -97,24 +97,30 @@
|
|||
TabBar.show();
|
||||
}
|
||||
|
||||
function showUserTabs() {
|
||||
function showUserTabs(user) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
var tabs = ['Library', 'Favorites', 'Search', 'NowPlaying'];
|
||||
|
||||
var tabs = ['Library', 'Favorites', 'Search', 'NowPlaying'];
|
||||
if (user.Policy.EnableSync) {
|
||||
|
||||
if (user.Policy.EnableSync) {
|
||||
tabs.push('Sync');
|
||||
}
|
||||
|
||||
tabs.push('Sync');
|
||||
}
|
||||
tabs.push('Settings');
|
||||
|
||||
tabs.push('Settings');
|
||||
TabBar.showNamedItems(tabs);
|
||||
|
||||
TabBar.showNamedItems(tabs);
|
||||
// We need to make sure the above completes first
|
||||
setTimeout(showTabs, 500);
|
||||
}
|
||||
|
||||
// We need to make sure the above completes first
|
||||
setTimeout(showTabs, 500);
|
||||
});
|
||||
function showCurrentUserTabs() {
|
||||
|
||||
if (!Dashboard.getCurrentUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(showUserTabs);
|
||||
}
|
||||
|
||||
var isFirstHide = true;
|
||||
|
@ -137,12 +143,15 @@
|
|||
|
||||
init();
|
||||
|
||||
showUserTabs();
|
||||
Events.on(ConnectionManager, 'localusersignedin', function (e, user) {
|
||||
showUserTabs(user);
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedin', showUserTabs);
|
||||
Events.on(ConnectionManager, 'localusersignedout', hideTabs);
|
||||
Events.on(MediaController, 'beforeplaybackstart', onPlaybackStart);
|
||||
Events.on(MediaController, 'playbackstop', onPlaybackStop);
|
||||
|
||||
showCurrentUserTabs();
|
||||
});
|
||||
|
||||
function onPlaybackStart(e, state, player) {
|
||||
|
|
56
dashboard-ui/cordova/localassetmanager.js
vendored
56
dashboard-ui/cordova/localassetmanager.js
vendored
|
@ -246,6 +246,54 @@
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
function getUserIdsWithAccess(itemId, serverId) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
getOfflineItemsDb(function (db) {
|
||||
|
||||
db.transaction(function (tx) {
|
||||
|
||||
tx.executeSql("SELECT UserIdsWithAccess from Items where ItemId=? AND ServerId=?", [itemId, serverId], function (tx, res) {
|
||||
|
||||
var itemIds = [];
|
||||
|
||||
if (res.rows.length) {
|
||||
itemIds = res.rows.item(0).UserIdsWithAccess;
|
||||
itemIds = itemIds ? itemIds.split(',') : [];
|
||||
}
|
||||
|
||||
deferred.resolveWith(null, [itemIds]);
|
||||
|
||||
}, function (e) {
|
||||
deferred.reject();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function saveUserIdsWithAccess(itemId, serverId, userIds) {
|
||||
|
||||
Logger.log('saveUserIdsWithAccess');
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
getOfflineItemsDb(function (db) {
|
||||
|
||||
db.transaction(function (tx) {
|
||||
|
||||
var values = [userIds.join(','), itemId, serverId];
|
||||
|
||||
tx.executeSql("Update Items set UserIdsWithAccess=? where ItemId=? and ServerId=?", values);
|
||||
deferred.resolve();
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function getLocalItem(itemId, serverId) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
@ -509,7 +557,7 @@
|
|||
isResolved = true;
|
||||
// true indicates that it's queued
|
||||
deferred.resolveWith(null, [localPath, true]);
|
||||
}, 700);
|
||||
}, 500);
|
||||
|
||||
// Start the download and persist the promise to be able to cancel the download.
|
||||
download.startAsync().then(function () {
|
||||
|
@ -622,7 +670,7 @@
|
|||
// true indicates that it's queued
|
||||
deferred.resolveWith(null, [localPath, isQueued]);
|
||||
}
|
||||
}, 3000);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
}, function () {
|
||||
|
@ -871,7 +919,9 @@
|
|||
hasImage: hasImage,
|
||||
downloadImage: downloadImage,
|
||||
fileExists: fileExists,
|
||||
translateFilePath: translateFilePath
|
||||
translateFilePath: translateFilePath,
|
||||
getUserIdsWithAccess: getUserIdsWithAccess,
|
||||
saveUserIdsWithAccess: saveUserIdsWithAccess
|
||||
};
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue