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) {
const apiClient = ConnectionManager.currentApiClient();
const apiClient = window.ConnectionManager.currentApiClient();
apiClient.getCurrentUser().then(user => {
const menuItems = [];

View File

@ -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);

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) => {
if (syncPlayEnabled) {
showLeaveGroupSelection(button, user, apiClient);

View File

@ -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) {

View File

@ -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();

View File

@ -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);
}

View File

@ -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;

View File

@ -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}) => {

View File

@ -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, {

View File

@ -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,

View File

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