From 54d71126d9a25ff90198f636e95b761c9774645b Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 8 Sep 2020 13:35:17 -0400 Subject: [PATCH] Fix currentApiClient references --- src/components/multiSelect/multiSelect.js | 2 +- src/components/playback/playbackmanager.js | 8 ++++---- src/components/syncPlay/groupSelectionMenu.js | 2 +- src/components/syncPlay/syncPlayManager.js | 2 +- src/components/syncPlay/timeSyncManager.js | 2 +- src/controllers/favorites.js | 2 +- src/libraries/screensavermanager.js | 2 +- src/plugins/backdropScreensaver/plugin.js | 2 +- src/plugins/chromecastPlayer/plugin.js | 2 +- src/plugins/photoPlayer/plugin.js | 2 +- src/plugins/sessionPlayer/plugin.js | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/multiSelect/multiSelect.js b/src/components/multiSelect/multiSelect.js index e37deb2d36..fc66120c5d 100644 --- a/src/components/multiSelect/multiSelect.js +++ b/src/components/multiSelect/multiSelect.js @@ -170,7 +170,7 @@ import './multiSelect.css'; } function showMenuForSelectedItems(e) { - const apiClient = ConnectionManager.currentApiClient(); + const apiClient = window.ConnectionManager.currentApiClient(); apiClient.getCurrentUser().then(user => { const menuItems = []; diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index fcbb2005a8..b69f305a25 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -869,7 +869,7 @@ class PlaybackManager { const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets); return Promise.all(promises).then(function (responses) { - return ConnectionManager.currentApiClient().getCurrentUser().then(function (user) { + return window.ConnectionManager.currentApiClient().getCurrentUser().then(function (user) { const targets = []; targets.push({ @@ -1367,7 +1367,7 @@ class PlaybackManager { function getSavedMaxStreamingBitrate(apiClient, mediaType) { if (!apiClient) { // This should hopefully never happen - apiClient = ConnectionManager.currentApiClient(); + apiClient = window.ConnectionManager.currentApiClient(); } const endpointInfo = apiClient.getSavedEndpointInfo() || {}; @@ -1390,7 +1390,7 @@ class PlaybackManager { const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null; const currentItem = self.currentItem(player); - const apiClient = currentItem ? ConnectionManager.getApiClient(currentItem.ServerId) : ConnectionManager.currentApiClient(); + const apiClient = currentItem ? ConnectionManager.getApiClient(currentItem.ServerId) : window.ConnectionManager.currentApiClient(); return getSavedMaxStreamingBitrate(apiClient, mediaType); }; @@ -1404,7 +1404,7 @@ class PlaybackManager { const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null; const currentItem = self.currentItem(player); - const apiClient = currentItem ? ConnectionManager.getApiClient(currentItem.ServerId) : ConnectionManager.currentApiClient(); + const apiClient = currentItem ? ConnectionManager.getApiClient(currentItem.ServerId) : window.ConnectionManager.currentApiClient(); const endpointInfo = apiClient.getSavedEndpointInfo() || {}; return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType); diff --git a/src/components/syncPlay/groupSelectionMenu.js b/src/components/syncPlay/groupSelectionMenu.js index 1a54f7ff9c..b8a5ff80d0 100644 --- a/src/components/syncPlay/groupSelectionMenu.js +++ b/src/components/syncPlay/groupSelectionMenu.js @@ -171,7 +171,7 @@ export default function show (button) { }); }); - const apiClient = ConnectionManager.currentApiClient(); + const apiClient = window.ConnectionManager.currentApiClient(); ConnectionManager.user(apiClient).then((user) => { if (syncPlayEnabled) { showLeaveGroupSelection(button, user, apiClient); diff --git a/src/components/syncPlay/syncPlayManager.js b/src/components/syncPlay/syncPlayManager.js index 2540e97c9c..59c86fd366 100644 --- a/src/components/syncPlay/syncPlayManager.js +++ b/src/components/syncPlay/syncPlayManager.js @@ -127,7 +127,7 @@ class SyncPlayManager { // Report ping if (this.syncEnabled) { - const apiClient = ConnectionManager.currentApiClient(); + const apiClient = window.ConnectionManager.currentApiClient(); const sessionId = getActivePlayerId(); if (!sessionId) { diff --git a/src/components/syncPlay/timeSyncManager.js b/src/components/syncPlay/timeSyncManager.js index b2ad5809f9..844831f35b 100644 --- a/src/components/syncPlay/timeSyncManager.js +++ b/src/components/syncPlay/timeSyncManager.js @@ -113,7 +113,7 @@ class TimeSyncManager { if (!this.poller) { this.poller = setTimeout(() => { this.poller = null; - const apiClient = ConnectionManager.currentApiClient(); + const apiClient = window.ConnectionManager.currentApiClient(); const requestSent = new Date(); apiClient.getServerTime().then((response) => { const responseReceived = new Date(); diff --git a/src/controllers/favorites.js b/src/controllers/favorites.js index 41372aa213..b3c2650506 100644 --- a/src/controllers/favorites.js +++ b/src/controllers/favorites.js @@ -270,7 +270,7 @@ class FavoritesTab { constructor(view, params) { this.view = view; this.params = params; - this.apiClient = ConnectionManager.currentApiClient(); + this.apiClient = window.ConnectionManager.currentApiClient(); this.sectionsContainer = view.querySelector('.sections'); createSections(this, this.sectionsContainer, this.apiClient); } diff --git a/src/libraries/screensavermanager.js b/src/libraries/screensavermanager.js index a2326b333c..29ecceaf0f 100644 --- a/src/libraries/screensavermanager.js +++ b/src/libraries/screensavermanager.js @@ -84,7 +84,7 @@ function ScreenSaverManager() { this.show = function () { let isLoggedIn; - const apiClient = ConnectionManager.currentApiClient(); + const apiClient = window.ConnectionManager.currentApiClient(); if (apiClient && apiClient.isLoggedIn()) { isLoggedIn = true; diff --git a/src/plugins/backdropScreensaver/plugin.js b/src/plugins/backdropScreensaver/plugin.js index 0def71878a..91cc444a6b 100644 --- a/src/plugins/backdropScreensaver/plugin.js +++ b/src/plugins/backdropScreensaver/plugin.js @@ -21,7 +21,7 @@ class BackdropScreensaver { Limit: 200 }; - const apiClient = ConnectionManager.currentApiClient(); + const apiClient = window.ConnectionManager.currentApiClient(); apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => { if (result.Items.length) { import('../../components/slideshow/slideshow').then(({default: Slideshow}) => { diff --git a/src/plugins/chromecastPlayer/plugin.js b/src/plugins/chromecastPlayer/plugin.js index 64a3dba3e1..f1064f2050 100644 --- a/src/plugins/chromecastPlayer/plugin.js +++ b/src/plugins/chromecastPlayer/plugin.js @@ -328,7 +328,7 @@ class CastPlayer { } else if (message.options && message.options.items && message.options.items.length) { apiClient = ConnectionManager.getApiClient(message.options.items[0].ServerId); } else { - apiClient = ConnectionManager.currentApiClient(); + apiClient = window.ConnectionManager.currentApiClient(); } message = Object.assign(message, { diff --git a/src/plugins/photoPlayer/plugin.js b/src/plugins/photoPlayer/plugin.js index 9ea48a11af..aa7dd493f1 100644 --- a/src/plugins/photoPlayer/plugin.js +++ b/src/plugins/photoPlayer/plugin.js @@ -13,7 +13,7 @@ export default class PhotoPlayer { import('../../components/slideshow/slideshow').then(({default: Slideshow}) => { var index = options.startIndex || 0; - var apiClient = ConnectionManager.currentApiClient(); + var apiClient = window.ConnectionManager.currentApiClient(); apiClient.getCurrentUser().then(function(result) { var newSlideShow = new Slideshow({ showTitle: false, diff --git a/src/plugins/sessionPlayer/plugin.js b/src/plugins/sessionPlayer/plugin.js index 6240839eae..3fa498d623 100644 --- a/src/plugins/sessionPlayer/plugin.js +++ b/src/plugins/sessionPlayer/plugin.js @@ -56,7 +56,7 @@ function getCurrentApiClient(instance) { return ConnectionManager.getApiClient(currentServerId); } - return ConnectionManager.currentApiClient(); + return window.ConnectionManager.currentApiClient(); } function sendCommandByName(instance, name, options) {