fix album save in metadata manager
This commit is contained in:
parent
9336922f29
commit
adacfbbab3
15 changed files with 353 additions and 90 deletions
|
@ -66,7 +66,7 @@
|
|||
|
||||
function showBackdrop(type, parentId) {
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
var PlayerName = 'Chromecast';
|
||||
|
||||
var messageNamespace = 'urn:x-cast:com.google.cast.mediabrowser.v3';
|
||||
var messageNamespace = 'urn:x-cast:com.connectsdk';
|
||||
|
||||
var CastPlayer = function () {
|
||||
|
||||
|
@ -852,9 +852,8 @@
|
|||
|
||||
MediaController.registerPlayer(new chromecastPlayer());
|
||||
|
||||
$(MediaController).on('playerchange', function () {
|
||||
|
||||
if (MediaController.getPlayerInfo().name == PlayerName) {
|
||||
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||
if (newPlayer.name == PlayerName) {
|
||||
if (castPlayer.deviceState != DEVICE_STATE.ACTIVE && castPlayer.isInitialized) {
|
||||
castPlayer.launchApp();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{
|
||||
var apiClient = result.ApiClient;
|
||||
|
||||
Dashboard.onLoggedIn(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.navigate('index.html');
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
var page = $.mobile.activePage;
|
||||
var panel;
|
||||
|
||||
ConnectionManager.user().done(function (user) {
|
||||
ConnectionManager.user(window.ApiClient).done(function (user) {
|
||||
|
||||
panel = getLibraryMenu(user);
|
||||
updateLibraryNavLinks(page);
|
||||
|
@ -165,7 +165,7 @@
|
|||
|
||||
function updateLibraryMenu(panel) {
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
|
||||
|
@ -302,7 +302,7 @@
|
|||
html += '<div class="libraryMenuDivider" style="margin-top:0;"></div>';
|
||||
}
|
||||
|
||||
var homeHref = ConnectionManager.currentApiClient() ? 'index.html' : 'selectserver.html';
|
||||
var homeHref = window.ApiClient ? 'index.html' : 'selectserver.html';
|
||||
|
||||
if (showUserAtTop) {
|
||||
html += '<a class="lnkMediaFolder sidebarLink" href="' + homeHref + '"><span class="fa fa-home sidebarLinkIcon"></span><span>' + Globalize.translate('ButtonHome') + '</span></a>';
|
||||
|
@ -508,7 +508,7 @@
|
|||
var viewMenuBar = $('.viewMenuBar');
|
||||
if (!$('.viewMenuBar').length) {
|
||||
|
||||
ConnectionManager.user().done(function (user) {
|
||||
ConnectionManager.user(window.ApiClient).done(function (user) {
|
||||
|
||||
renderHeader(user);
|
||||
updateViewMenuBarHeadroom(page, $('.viewMenuBar'));
|
||||
|
@ -592,7 +592,12 @@
|
|||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
initializeApiClient(apiClient);
|
||||
|
||||
}).on('localusersignedin localusersignedout', function () {
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
newUrl = "index.html?u=" + user.Id + '&t=' + result.AccessToken;
|
||||
}
|
||||
|
||||
Dashboard.onLoggedIn(apiClient.serverAddress(), user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
|
||||
}).fail(function () {
|
||||
|
|
|
@ -105,6 +105,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
function triggerPlayerChange(newPlayer, newTarget) {
|
||||
|
||||
$(self).trigger('playerchange', [newPlayer, newTarget]);
|
||||
}
|
||||
|
||||
self.setActivePlayer = function (player, targetInfo) {
|
||||
|
||||
if (typeof (player) === 'string') {
|
||||
|
@ -122,7 +127,7 @@
|
|||
|
||||
console.log('Active player: ' + JSON.stringify(currentTargetInfo));
|
||||
|
||||
$(self).trigger('playerchange');
|
||||
triggerPlayerChange(player, targetInfo);
|
||||
};
|
||||
|
||||
self.trySetActivePlayer = function (player, targetInfo) {
|
||||
|
@ -144,7 +149,7 @@
|
|||
|
||||
console.log('Active player: ' + JSON.stringify(currentTargetInfo));
|
||||
|
||||
$(self).trigger('playerchange');
|
||||
triggerPlayerChange(player, targetInfo);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -599,7 +604,7 @@
|
|||
|
||||
});
|
||||
|
||||
$('.radioSelectPlayerTarget', elem).on('change', function () {
|
||||
$('.radioSelectPlayerTarget', elem).off('change').on('change', function () {
|
||||
|
||||
var supportsMirror = this.getAttribute('data-mirror') == 'true';
|
||||
|
||||
|
@ -609,14 +614,6 @@
|
|||
$('.fldMirrorMode', elem).hide();
|
||||
}
|
||||
|
||||
}).each(function () {
|
||||
|
||||
if (this.checked) {
|
||||
$(this).trigger('change');
|
||||
}
|
||||
|
||||
}).on('change', function () {
|
||||
|
||||
var playerName = this.getAttribute('data-playername');
|
||||
var targetId = this.getAttribute('data-targetid');
|
||||
var targetName = this.getAttribute('data-targetname');
|
||||
|
@ -639,6 +636,12 @@
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
if ($('.radioSelectPlayerTarget:checked', elem).attr('data-mirror') == 'true') {
|
||||
$('.fldMirrorMode', elem).show();
|
||||
} else {
|
||||
$('.fldMirrorMode', elem).hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
self.getNotificationsSummary = function () {
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
|
@ -107,7 +107,7 @@
|
|||
|
||||
function refreshNotifications(startIndex, limit, elem, btn, showPaging) {
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
return apiClient.getNotifications(Dashboard.getCurrentUserId(), { StartIndex: startIndex, Limit: limit }).done(function (result) {
|
||||
|
@ -219,7 +219,7 @@
|
|||
|
||||
$(document).on('headercreated', function (e) {
|
||||
|
||||
if (ConnectionManager.currentApiClient()) {
|
||||
if (window.ApiClient) {
|
||||
$('<button class="headerButton headerButtonRight btnNotifications" data-role="none" type="button" title="Notifications"><div class="btnNotificationsInner">0</div></button>').insertAfter($('.headerSearchButton')).on('click', Notifications.showNotificationsFlyout);
|
||||
|
||||
Notifications.updateNotificationCount();
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
apiClient.getSessions().done(function (sessions) {
|
||||
|
@ -242,7 +242,7 @@
|
|||
ControllableByUserId: Dashboard.getCurrentUserId()
|
||||
};
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
apiClient.getSessions(sessionQuery).done(function (sessions) {
|
||||
|
|
|
@ -8,20 +8,22 @@
|
|||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
var apiClient = result.ApiClient;
|
||||
|
||||
switch (result.State) {
|
||||
|
||||
case MediaBrowser.ConnectionState.SignedIn:
|
||||
{
|
||||
var apiClient = result.ApiClient;
|
||||
|
||||
Dashboard.onLoggedIn(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.navigate('index.html');
|
||||
}
|
||||
break;
|
||||
case MediaBrowser.ConnectionState.ServerSignIn:
|
||||
{
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
window.location.href = 'login.html?serverid=' + result.Servers[0].Id;
|
||||
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), null, null, apiClient);
|
||||
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id);
|
||||
} else {
|
||||
showServerConnectionFailure();
|
||||
}
|
||||
|
@ -401,15 +403,19 @@
|
|||
loadInvitations(page);
|
||||
}
|
||||
|
||||
$(document).on('pagebeforecreate', "#selectServerPage", function () {
|
||||
function updatePageStyle(page) {
|
||||
|
||||
if (ConnectionManager.isLoggedIntoConnect()) {
|
||||
$(page).addClass('libraryPage').addClass('noSecondaryNavPage').removeClass('standalonePage');
|
||||
} else {
|
||||
$(page).removeClass('libraryPage').removeClass('noSecondaryNavPage').addClass('standalonePage');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforecreate pageinit pagebeforeshow', "#selectServerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
if (ConnectionManager.isLoggedIntoConnect()) {
|
||||
$(page).addClass('libraryPage').addClass(' noSecondaryNavPage').removeClass('standalonePage');
|
||||
} else {
|
||||
$(page).removeClass('libraryPage').removeClass(' noSecondaryNavPage').addClass('standalonePage');
|
||||
}
|
||||
updatePageStyle(page);
|
||||
|
||||
}).on('pagebeforeshow', "#selectServerPage", function () {
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ var Dashboard = {
|
|||
|
||||
if (!Dashboard.getUserPromise) {
|
||||
|
||||
Dashboard.getUserPromise = ConnectionManager.currentApiClient().getCurrentUser().fail(Dashboard.logout);
|
||||
Dashboard.getUserPromise = window.ApiClient.getCurrentUser().fail(Dashboard.logout);
|
||||
}
|
||||
|
||||
return Dashboard.getUserPromise;
|
||||
|
@ -192,7 +192,7 @@ var Dashboard = {
|
|||
store.setItem("userId", userId);
|
||||
store.setItem("token", token);
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
apiClient.setCurrentUserId(userId, token);
|
||||
|
@ -644,7 +644,7 @@ var Dashboard = {
|
|||
|
||||
showUserFlyout: function (context) {
|
||||
|
||||
ConnectionManager.user().done(function (user) {
|
||||
ConnectionManager.user(window.ApiClient).done(function (user) {
|
||||
|
||||
var html = '<div data-role="panel" data-position="right" data-display="overlay" id="userFlyout" data-position-fixed="true" data-theme="a">';
|
||||
|
||||
|
@ -1488,14 +1488,14 @@ var Dashboard = {
|
|||
return deferred.promise();
|
||||
},
|
||||
|
||||
onLoggedIn: function (serverAddress, userId, accessToken, apiClient) {
|
||||
onServerChanged: function (serverAddress, userId, accessToken, apiClient) {
|
||||
|
||||
window.ApiClient = apiClient;
|
||||
if (Dashboard.isConnectMode()) {
|
||||
Dashboard.serverAddress(serverAddress);
|
||||
}
|
||||
|
||||
Dashboard.setCurrentUser(userId, accessToken);
|
||||
window.ApiClient = apiClient;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1787,7 +1787,7 @@ var AppInfo = {};
|
|||
|
||||
$(window).on("beforeunload", function () {
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
// Close the connection gracefully when possible
|
||||
if (apiClient && apiClient.isWebSocketOpen()) {
|
||||
|
@ -1925,7 +1925,7 @@ $(document).on('pagecreate', ".page", function () {
|
|||
|
||||
var page = $(this);
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (Dashboard.getAccessToken() && Dashboard.getCurrentUserId()) {
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@
|
|||
|
||||
function showSyncButtonsPerUser(page) {
|
||||
|
||||
var apiClient = ConnectionManager.currentApiClient();
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue