1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

connectivity fixes

This commit is contained in:
Luke Pulverenti 2015-12-11 15:25:04 -05:00
parent 705a817b12
commit 79fa61fa33
6 changed files with 116 additions and 90 deletions

View file

@ -238,11 +238,13 @@
setPeopleHeader(page, item);
$(page).trigger('displayingitem', [{
item: item,
context: context
}]);
page.dispatchEvent(new CustomEvent("displayingitem", {
detail: {
item: item,
context: context
},
bubbles: true
}));
Dashboard.hideLoadingMsg();
}

View file

@ -196,10 +196,12 @@
LibraryMenu.setTitle(name);
$(page).trigger('displayingitem', [{
item: item
}]);
page.dispatchEvent(new CustomEvent("displayingitem", {
detail: {
item: item
},
bubbles: true
}));
LibraryBrowser.setLastRefreshed(page);
Dashboard.hideLoadingMsg();

View file

@ -1008,8 +1008,7 @@
$(apiClient).off("websocketmessage", onWebSocketMessageReceived).on("websocketmessage", onWebSocketMessageReceived);
}
Dashboard.ready(function () {
MediaController.init = function () {
if (window.ApiClient) {
initializeApiClient(window.ApiClient);
}
@ -1017,7 +1016,7 @@
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
initializeApiClient(apiClient);
});
});
};
function onCastButtonClicked() {
@ -1027,7 +1026,6 @@
document.addEventListener('headercreated', function () {
$('.btnCast').off('click', onCastButtonClicked).on('click', onCastButtonClicked);
});
pageClassOn('pagebeforeshow', "page", function () {
@ -1035,11 +1033,11 @@
var page = this;
currentDisplayInfo = null;
});
pageClassOn('displayingitem', "libraryPage", function (e, info) {
pageClassOn('displayingitem', "libraryPage", function (e) {
var info = e.detail.info;
currentDisplayInfo = info;
mirrorIfEnabled(info);

View file

@ -767,32 +767,31 @@ var Dashboard = {
});
}
if (!Dashboard.getPluginSecurityInfoPromise) {
var cachedInfo = Dashboard.pluginSecurityInfo;
if (cachedInfo) {
return new Promise(function (resolve, reject) {
var deferred = $.Deferred();
// Don't let this blow up the dashboard when it fails
apiClient.ajax({
type: "GET",
url: apiClient.getUrl("Plugins/SecurityInfo"),
dataType: 'json',
error: function () {
// Don't show normal dashboard errors
}
}).then(function (result) {
deferred.resolveWith(null, [result]);
resolve(cachedInfo);
});
Dashboard.getPluginSecurityInfoPromise = deferred;
}
return Dashboard.getPluginSecurityInfoPromise;
return apiClient.ajax({
type: "GET",
url: apiClient.getUrl("Plugins/SecurityInfo"),
dataType: 'json',
error: function () {
// Don't show normal dashboard errors
}
}).then(function (result) {
Dashboard.pluginSecurityInfo = result;
return result;
});
},
resetPluginSecurityInfo: function () {
Dashboard.getPluginSecurityInfoPromise = null;
Dashboard.pluginSecurityInfo = null;
},
ensureHeader: function (page) {
@ -1466,11 +1465,6 @@ var Dashboard = {
}
},
ready: function (fn) {
Dashboard.initPromise.then(fn);
},
loadExternalPlayer: function () {
var deferred = DeferredBuilder.Deferred();
@ -1648,7 +1642,11 @@ var AppInfo = {};
if (!Dashboard.isServerlessPage()) {
if (server && server.UserId && server.AccessToken) {
Dashboard.showLoadingMsg();
ConnectionManager.connectToServer(server).then(function (result) {
Dashboard.showLoadingMsg();
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
window.ApiClient = result.ApiClient;
}
@ -1871,7 +1869,7 @@ var AppInfo = {};
define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']);
}
function init(promiseResolve, hostingAppInfo) {
function init(hostingAppInfo) {
if (Dashboard.isRunningInCordova() && browserInfo.android) {
define("appstorage", ["cordova/android/appstorage"]);
@ -1978,7 +1976,7 @@ var AppInfo = {};
AppInfo[i] = hostingAppInfo[i];
}
initAfterDependencies(promiseResolve);
initAfterDependencies();
});
}
@ -1990,7 +1988,7 @@ var AppInfo = {};
});
}
function initAfterDependencies(promiseResolve) {
function initAfterDependencies() {
var drawer = document.querySelector('.mainDrawerPanel');
drawer.classList.remove('mainDrawerPanelPreInit');
@ -2075,6 +2073,8 @@ var AppInfo = {};
Promise.all(promises).then(function () {
MediaController.init();
document.title = Globalize.translateDocument(document.title, 'html');
var mainDrawerPanelContent = document.querySelector('.mainDrawerPanelContent');
@ -2111,17 +2111,17 @@ var AppInfo = {};
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
onAppReady(promiseResolve);
onAppReady();
});
return;
}
onAppReady(promiseResolve);
onAppReady();
});
});
}
function onAppReady(promiseResolve) {
function onAppReady() {
var deps = [];
@ -2178,7 +2178,6 @@ var AppInfo = {};
$.mobile.filterHtml = Dashboard.filterHtml;
$.mobile.initializePage();
promiseResolve();
var postInitDependencies = [];
@ -2407,30 +2406,27 @@ var AppInfo = {};
require(initialDependencies, function (isMobile) {
Dashboard.initPromise = new Promise(function (resolve, reject) {
function onWebComponentsReady() {
function onWebComponentsReady() {
var polymerDependencies = [];
var polymerDependencies = [];
require(polymerDependencies, function () {
require(polymerDependencies, function () {
getHostingAppInfo().then(function (hostingAppInfo) {
init(resolve, hostingAppInfo);
});
getHostingAppInfo().then(function (hostingAppInfo) {
init(hostingAppInfo);
});
}
});
}
setBrowserInfo(isMobile);
setAppInfo();
setDocumentClasses();
setBrowserInfo(isMobile);
setAppInfo();
setDocumentClasses();
if (supportsNativeWebComponents) {
onWebComponentsReady();
} else {
document.addEventListener('WebComponentsReady', onWebComponentsReady);
}
});
if (supportsNativeWebComponents) {
onWebComponentsReady();
} else {
document.addEventListener('WebComponentsReady', onWebComponentsReady);
}
});
})();