Fix currentApiClient references

This commit is contained in:
Bill Thornton 2020-09-08 13:35:17 -04:00 committed by vitorsemeano
parent 8bc8255a3e
commit 54d71126d9
11 changed files with 14 additions and 14 deletions

View File

@ -170,7 +170,7 @@ import './multiSelect.css';
} }
function showMenuForSelectedItems(e) { function showMenuForSelectedItems(e) {
const apiClient = ConnectionManager.currentApiClient(); const apiClient = window.ConnectionManager.currentApiClient();
apiClient.getCurrentUser().then(user => { apiClient.getCurrentUser().then(user => {
const menuItems = []; const menuItems = [];

View File

@ -869,7 +869,7 @@ class PlaybackManager {
const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets); const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets);
return Promise.all(promises).then(function (responses) { return Promise.all(promises).then(function (responses) {
return ConnectionManager.currentApiClient().getCurrentUser().then(function (user) { return window.ConnectionManager.currentApiClient().getCurrentUser().then(function (user) {
const targets = []; const targets = [];
targets.push({ targets.push({
@ -1367,7 +1367,7 @@ class PlaybackManager {
function getSavedMaxStreamingBitrate(apiClient, mediaType) { function getSavedMaxStreamingBitrate(apiClient, mediaType) {
if (!apiClient) { if (!apiClient) {
// This should hopefully never happen // This should hopefully never happen
apiClient = ConnectionManager.currentApiClient(); apiClient = window.ConnectionManager.currentApiClient();
} }
const endpointInfo = apiClient.getSavedEndpointInfo() || {}; const endpointInfo = apiClient.getSavedEndpointInfo() || {};
@ -1390,7 +1390,7 @@ class PlaybackManager {
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null; const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
const currentItem = self.currentItem(player); 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); return getSavedMaxStreamingBitrate(apiClient, mediaType);
}; };
@ -1404,7 +1404,7 @@ class PlaybackManager {
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null; const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
const currentItem = self.currentItem(player); 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() || {}; const endpointInfo = apiClient.getSavedEndpointInfo() || {};
return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType); return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType);

View File

@ -171,7 +171,7 @@ export default function show (button) {
}); });
}); });
const apiClient = ConnectionManager.currentApiClient(); const apiClient = window.ConnectionManager.currentApiClient();
ConnectionManager.user(apiClient).then((user) => { ConnectionManager.user(apiClient).then((user) => {
if (syncPlayEnabled) { if (syncPlayEnabled) {
showLeaveGroupSelection(button, user, apiClient); showLeaveGroupSelection(button, user, apiClient);

View File

@ -127,7 +127,7 @@ class SyncPlayManager {
// Report ping // Report ping
if (this.syncEnabled) { if (this.syncEnabled) {
const apiClient = ConnectionManager.currentApiClient(); const apiClient = window.ConnectionManager.currentApiClient();
const sessionId = getActivePlayerId(); const sessionId = getActivePlayerId();
if (!sessionId) { if (!sessionId) {

View File

@ -113,7 +113,7 @@ class TimeSyncManager {
if (!this.poller) { if (!this.poller) {
this.poller = setTimeout(() => { this.poller = setTimeout(() => {
this.poller = null; this.poller = null;
const apiClient = ConnectionManager.currentApiClient(); const apiClient = window.ConnectionManager.currentApiClient();
const requestSent = new Date(); const requestSent = new Date();
apiClient.getServerTime().then((response) => { apiClient.getServerTime().then((response) => {
const responseReceived = new Date(); const responseReceived = new Date();

View File

@ -270,7 +270,7 @@ class FavoritesTab {
constructor(view, params) { constructor(view, params) {
this.view = view; this.view = view;
this.params = params; this.params = params;
this.apiClient = ConnectionManager.currentApiClient(); this.apiClient = window.ConnectionManager.currentApiClient();
this.sectionsContainer = view.querySelector('.sections'); this.sectionsContainer = view.querySelector('.sections');
createSections(this, this.sectionsContainer, this.apiClient); createSections(this, this.sectionsContainer, this.apiClient);
} }

View File

@ -84,7 +84,7 @@ function ScreenSaverManager() {
this.show = function () { this.show = function () {
let isLoggedIn; let isLoggedIn;
const apiClient = ConnectionManager.currentApiClient(); const apiClient = window.ConnectionManager.currentApiClient();
if (apiClient && apiClient.isLoggedIn()) { if (apiClient && apiClient.isLoggedIn()) {
isLoggedIn = true; isLoggedIn = true;

View File

@ -21,7 +21,7 @@ class BackdropScreensaver {
Limit: 200 Limit: 200
}; };
const apiClient = ConnectionManager.currentApiClient(); const apiClient = window.ConnectionManager.currentApiClient();
apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => { apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => {
if (result.Items.length) { if (result.Items.length) {
import('../../components/slideshow/slideshow').then(({default: Slideshow}) => { import('../../components/slideshow/slideshow').then(({default: Slideshow}) => {

View File

@ -328,7 +328,7 @@ class CastPlayer {
} else if (message.options && message.options.items && message.options.items.length) { } else if (message.options && message.options.items && message.options.items.length) {
apiClient = ConnectionManager.getApiClient(message.options.items[0].ServerId); apiClient = ConnectionManager.getApiClient(message.options.items[0].ServerId);
} else { } else {
apiClient = ConnectionManager.currentApiClient(); apiClient = window.ConnectionManager.currentApiClient();
} }
message = Object.assign(message, { message = Object.assign(message, {

View File

@ -13,7 +13,7 @@ export default class PhotoPlayer {
import('../../components/slideshow/slideshow').then(({default: Slideshow}) => { import('../../components/slideshow/slideshow').then(({default: Slideshow}) => {
var index = options.startIndex || 0; var index = options.startIndex || 0;
var apiClient = ConnectionManager.currentApiClient(); var apiClient = window.ConnectionManager.currentApiClient();
apiClient.getCurrentUser().then(function(result) { apiClient.getCurrentUser().then(function(result) {
var newSlideShow = new Slideshow({ var newSlideShow = new Slideshow({
showTitle: false, showTitle: false,

View File

@ -56,7 +56,7 @@ function getCurrentApiClient(instance) {
return ConnectionManager.getApiClient(currentServerId); return ConnectionManager.getApiClient(currentServerId);
} }
return ConnectionManager.currentApiClient(); return window.ConnectionManager.currentApiClient();
} }
function sendCommandByName(instance, name, options) { function sendCommandByName(instance, name, options) {