From 81c6dc6907f94ab7e438c8c17e8d6a13db481473 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 8 Aug 2020 15:26:03 +0200 Subject: [PATCH 1/9] Move Dashboard to a new module --- package.json | 1 + src/components/appRouter.js | 8 -- src/scripts/clientUtils.js | 228 ++++++++++++++++++++++++++++++++ src/scripts/site.js | 254 ++++++------------------------------ 4 files changed, 266 insertions(+), 225 deletions(-) create mode 100644 src/scripts/clientUtils.js diff --git a/package.json b/package.json index bd2605372c..7326dfa1f4 100644 --- a/package.json +++ b/package.json @@ -288,6 +288,7 @@ "src/scripts/alphanumericshortcuts.js", "src/scripts/autoBackdrops.js", "src/scripts/browser.js", + "src/scripts/clientUtils.js", "src/scripts/datetime.js", "src/scripts/deleteHelper.js", "src/scripts/dfnshelper.js", diff --git a/src/components/appRouter.js b/src/components/appRouter.js index e7b697daf4..9be762fc8f 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -485,13 +485,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro return (page.len || 0) > 0; } - function showDirect(path) { - return new Promise(function(resolve, reject) { - resolveOnNextShow = resolve; - page.show(baseUrl() + path); - }); - } - function show(path, options) { if (path.indexOf('/') !== 0 && path.indexOf('://') === -1) { path = '/' + path; @@ -625,7 +618,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro appRouter.param = param; appRouter.back = back; appRouter.show = show; - appRouter.showDirect = showDirect; appRouter.start = start; appRouter.baseUrl = baseUrl; appRouter.canGoBack = canGoBack; diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js new file mode 100644 index 0000000000..b576f0504e --- /dev/null +++ b/src/scripts/clientUtils.js @@ -0,0 +1,228 @@ +export function getCurrentUser() { + return window.ApiClient.getCurrentUser(false); +} + +//TODO: investigate url prefix support for serverAddress function +export function serverAddress() { + if (AppInfo.isNativeApp) { + var apiClient = window.ApiClient; + + if (apiClient) { + return apiClient.serverAddress(); + } + + return null; + } + + var urlLower = window.location.href.toLowerCase(); + var index = urlLower.lastIndexOf('/web'); + + if (index != -1) { + return urlLower.substring(0, index); + } + + var loc = window.location; + var address = loc.protocol + '//' + loc.hostname; + + if (loc.port) { + address += ':' + loc.port; + } + + return address; +} + +export function getCurrentUserId() { + var apiClient = window.ApiClient; + + if (apiClient) { + return apiClient.getCurrentUserId(); + } + + return null; +} + +export function onServerChanged(userId, accessToken, apiClient) { + apiClient = apiClient || window.ApiClient; + window.ApiClient = apiClient; +} + +export function logout() { + ConnectionManager.logout().then(function () { + var loginPage; + + if (AppInfo.isNativeApp) { + loginPage = 'selectserver.html'; + window.ApiClient = null; + } else { + loginPage = 'login.html'; + } + + navigate(loginPage); + }); +} + +export function getConfigurationPageUrl(name) { + return 'configurationpage?name=' + encodeURIComponent(name); +} + +export function getConfigurationResourceUrl(name) { + if (AppInfo.isNativeApp) { + return ApiClient.getUrl('web/ConfigurationPage', { + name: name + }); + } + + return getConfigurationPageUrl(name); +} + +export function navigate(url, preserveQueryString) { + if (!url) { + throw new Error('url cannot be null or empty'); + } + + var queryString = getWindowLocationSearch(); + + if (preserveQueryString && queryString) { + url += queryString; + } + + return new Promise(function (resolve, reject) { + require(['appRouter'], function (appRouter) { + return appRouter.show(url).then(resolve, reject); + }); + }); +} + +export function processPluginConfigurationUpdateResult() { + require(['loading', 'toast'], function (loading, toast) { + loading.hide(); + toast.default(Globalize.translate('MessageSettingsSaved')); + }); +} + +export function processServerConfigurationUpdateResult(result) { + require(['loading', 'toast'], function (loading, toast) { + loading.hide(); + toast.default(Globalize.translate('MessageSettingsSaved')); + }); +} + +export function processErrorResponse(response) { + require(['loading'], function (loading) { + loading.hide(); + }); + + var status = '' + response.status; + + if (response.statusText) { + status = response.statusText; + } + + alert({ + title: status, + message: response.headers ? response.headers.get('X-Application-Error-Code') : null + }); +} + +export function alert(options) { + if (typeof options == 'string') { + return void require(['toast'], function (toast) { + toast.default({ + text: options + }); + }); + } + + require(['alert'], function (alert) { + alert.default({ + title: options.title || Globalize.translate('HeaderAlert'), + text: options.message + }).then(options.callback || function () {}); + }); +} + +export function capabilities(appHost) { + var capabilities = { + PlayableMediaTypes: ['Audio', 'Video'], + SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'], + SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android', + SupportsMediaControl: true + }; + appHost.getPushTokenInfo(); + return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo()); +} + +export function selectServer() { + if (window.NativeShell && typeof window.NativeShell.selectServer === 'function') { + window.NativeShell.selectServer(); + } else { + navigate('selectserver.html'); + } +} + +export function hideLoadingMsg() { + 'use strict'; + require(['loading'], function(loading) { + loading.hide(); + }); +} + +export function showLoadingMsg() { + 'use strict'; + require(['loading'], function(loading) { + loading.show(); + }); +} + +export function confirm(message, title, callback) { + 'use strict'; + require(['confirm'], function(confirm) { + confirm(message, title).then(function() { + callback(!0); + }).catch(function() { + callback(!1); + }); + }); +} + +// This is used in plugins and templates, so keep it defined for now. +// TODO: Remove once plugins don't need it +window.Dashboard = { + alert, + capabilities, + confirm, + getConfigurationPageUrl, + getConfigurationResourceUrl, + getCurrentUser, + getCurrentUserId, + hideLoadingMsg, + logout, + navigate, + onServerChanged, + processErrorResponse, + processPluginConfigurationUpdateResult, + processServerConfigurationUpdateResult, + selectServer, + serverAddress, + showLoadingMsg +}; + +export default { + alert, + capabilities, + confirm, + getConfigurationPageUrl, + getConfigurationResourceUrl, + getCurrentUser, + getCurrentUserId, + hideLoadingMsg, + logout, + navigate, + onServerChanged, + processErrorResponse, + processPluginConfigurationUpdateResult, + processServerConfigurationUpdateResult, + selectServer, + serverAddress, + showLoadingMsg +}; diff --git a/src/scripts/site.js b/src/scripts/site.js index aa74411af4..02e24a8b46 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -1,4 +1,4 @@ -function getWindowLocationSearch(win) { +window.getWindowLocationSearch = function(win) { 'use strict'; var search = (win || window).location.search; @@ -12,9 +12,9 @@ function getWindowLocationSearch(win) { } return search || ''; -} +}; -window.getParameterByName = function (name, url) { +window.getParameterByName = function(name, url) { 'use strict'; name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); @@ -29,7 +29,7 @@ window.getParameterByName = function (name, url) { return decodeURIComponent(results[1].replace(/\+/g, ' ')); }; -function pageClassOn(eventName, className, fn) { +window.pageClassOn = function(eventName, className, fn) { 'use strict'; document.addEventListener(eventName, function (event) { @@ -39,7 +39,7 @@ function pageClassOn(eventName, className, fn) { fn.call(target, event); } }); -} +}; window.pageIdOn = function(eventName, id, fn) { 'use strict'; @@ -53,187 +53,6 @@ window.pageIdOn = function(eventName, id, fn) { }); }; -var Dashboard = { - getCurrentUser: function () { - return window.ApiClient.getCurrentUser(false); - }, - - //TODO: investigate url prefix support for serverAddress function - serverAddress: function () { - if (AppInfo.isNativeApp) { - var apiClient = window.ApiClient; - - if (apiClient) { - return apiClient.serverAddress(); - } - - return null; - } - - var urlLower = window.location.href.toLowerCase(); - var index = urlLower.lastIndexOf('/web'); - - if (index != -1) { - return urlLower.substring(0, index); - } - - var loc = window.location; - var address = loc.protocol + '//' + loc.hostname; - - if (loc.port) { - address += ':' + loc.port; - } - - return address; - }, - getCurrentUserId: function () { - var apiClient = window.ApiClient; - - if (apiClient) { - return apiClient.getCurrentUserId(); - } - - return null; - }, - onServerChanged: function (userId, accessToken, apiClient) { - apiClient = apiClient || window.ApiClient; - window.ApiClient = apiClient; - }, - logout: function () { - ConnectionManager.logout().then(function () { - var loginPage; - - if (AppInfo.isNativeApp) { - loginPage = 'selectserver.html'; - window.ApiClient = null; - } else { - loginPage = 'login.html'; - } - - Dashboard.navigate(loginPage); - }); - }, - getConfigurationPageUrl: function (name) { - return 'configurationpage?name=' + encodeURIComponent(name); - }, - getConfigurationResourceUrl: function (name) { - if (AppInfo.isNativeApp) { - return ApiClient.getUrl('web/ConfigurationPage', { - name: name - }); - } - - return Dashboard.getConfigurationPageUrl(name); - }, - navigate: function (url, preserveQueryString) { - if (!url) { - throw new Error('url cannot be null or empty'); - } - - var queryString = getWindowLocationSearch(); - - if (preserveQueryString && queryString) { - url += queryString; - } - - return new Promise(function (resolve, reject) { - require(['appRouter'], function (appRouter) { - return appRouter.show(url).then(resolve, reject); - }); - }); - }, - navigate_direct: function (path) { - return new Promise(function (resolve, reject) { - require(['appRouter'], function (appRouter) { - return appRouter.showDirect(path).then(resolve, reject); - }); - }); - }, - processPluginConfigurationUpdateResult: function () { - require(['loading', 'toast'], function (loading, toast) { - loading.hide(); - toast.default(Globalize.translate('MessageSettingsSaved')); - }); - }, - processServerConfigurationUpdateResult: function (result) { - require(['loading', 'toast'], function (loading, toast) { - loading.hide(); - toast.default(Globalize.translate('MessageSettingsSaved')); - }); - }, - processErrorResponse: function (response) { - require(['loading'], function (loading) { - loading.hide(); - }); - - var status = '' + response.status; - - if (response.statusText) { - status = response.statusText; - } - - Dashboard.alert({ - title: status, - message: response.headers ? response.headers.get('X-Application-Error-Code') : null - }); - }, - alert: function (options) { - if (typeof options == 'string') { - return void require(['toast'], function (toast) { - toast.default({ - text: options - }); - }); - } - - require(['alert'], function (alert) { - alert.default({ - title: options.title || Globalize.translate('HeaderAlert'), - text: options.message - }).then(options.callback || function () {}); - }); - }, - capabilities: function (appHost) { - var capabilities = { - PlayableMediaTypes: ['Audio', 'Video'], - SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'], - SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android', - SupportsMediaControl: true - }; - appHost.getPushTokenInfo(); - return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo()); - }, - selectServer: function () { - if (window.NativeShell && typeof window.NativeShell.selectServer === 'function') { - window.NativeShell.selectServer(); - } else { - Dashboard.navigate('selectserver.html'); - } - }, - hideLoadingMsg: function() { - 'use strict'; - require(['loading'], function(loading) { - loading.hide(); - }); - }, - showLoadingMsg: function() { - 'use strict'; - require(['loading'], function(loading) { - loading.show(); - }); - }, - confirm: function(message, title, callback) { - 'use strict'; - require(['confirm'], function(confirm) { - confirm(message, title).then(function() { - callback(!0); - }).catch(function() { - callback(!1); - }); - }); - } -}; - var AppInfo = {}; function initClient() { @@ -289,7 +108,7 @@ function initClient() { if (!AppInfo.isNativeApp) { console.debug('loading ApiClient singleton'); - return require(['apiclient'], function (apiClientFactory) { + return require(['apiclient', 'clientUtils'], function (apiClientFactory, clientUtils) { console.debug('creating ApiClient singleton'); var apiClient = new apiClientFactory(Dashboard.serverAddress(), apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId()); @@ -376,36 +195,12 @@ function initClient() { } } - function initRequireWithBrowser() { - var componentsPath = getComponentsPath(); - var scriptsPath = getScriptsPath(); - - define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency); - - define('lazyLoader', [componentsPath + '/lazyLoader/lazyLoaderIntersectionObserver'], returnFirstDependency); - define('shell', [scriptsPath + '/shell'], returnFirstDependency); - - define('alert', [componentsPath + '/alert'], returnFirstDependency); - - defineResizeObserver(); - - define('dialog', [componentsPath + '/dialog/dialog'], returnFirstDependency); - - define('confirm', [componentsPath + '/confirm/confirm'], returnFirstDependency); - - define('prompt', [componentsPath + '/prompt/prompt'], returnFirstDependency); - - define('loading', [componentsPath + '/loading/loading'], returnFirstDependency); - define('multi-download', [scriptsPath + '/multiDownload'], returnFirstDependency); - define('fileDownloader', [scriptsPath + '/fileDownloader'], returnFirstDependency); - - define('castSenderApiLoader', [componentsPath + '/castSenderApi'], returnFirstDependency); - } - function init() { define('livetvcss', ['css!assets/css/livetv.css'], returnFirstDependency); define('detailtablecss', ['css!assets/css/detailtable.css'], returnFirstDependency); + require(['clientUtils']); + var promises = []; if (!window.fetch) { promises.push(require(['fetch'])); @@ -605,7 +400,29 @@ function initClient() { } function onWebComponentsReady() { - initRequireWithBrowser(); + var componentsPath = getComponentsPath(); + var scriptsPath = getScriptsPath(); + + define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency); + + define('lazyLoader', [componentsPath + '/lazyLoader/lazyLoaderIntersectionObserver'], returnFirstDependency); + define('shell', [scriptsPath + '/shell'], returnFirstDependency); + + define('alert', [componentsPath + '/alert'], returnFirstDependency); + + defineResizeObserver(); + + define('dialog', [componentsPath + '/dialog/dialog'], returnFirstDependency); + + define('confirm', [componentsPath + '/confirm/confirm'], returnFirstDependency); + + define('prompt', [componentsPath + '/prompt/prompt'], returnFirstDependency); + + define('loading', [componentsPath + '/loading/loading'], returnFirstDependency); + define('multi-download', [scriptsPath + '/multiDownload'], returnFirstDependency); + define('fileDownloader', [scriptsPath + '/fileDownloader'], returnFirstDependency); + + define('castSenderApiLoader', [componentsPath + '/castSenderApi'], returnFirstDependency); if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') { AppInfo.isNativeApp = true; @@ -617,7 +434,7 @@ function initClient() { var localApiClient; let promise; - (function () { + function initRequireJs() { var urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate()); var bowerPath = getBowerPath(); @@ -648,7 +465,8 @@ function initClient() { nowPlayingHelper: componentsPath + '/playback/nowplayinghelper', pluginManager: componentsPath + '/pluginManager', packageManager: componentsPath + '/packageManager', - screensaverManager: componentsPath + '/screensavermanager' + screensaverManager: componentsPath + '/screensavermanager', + clientUtils: scriptsPath + '/clientUtils' }; requirejs.onError = onRequireJsError; @@ -1106,7 +924,9 @@ function initClient() { appRouter.showItem = showItem; return appRouter; }); - })(); + } + + initRequireJs(); promise.then(onWebComponentsReady); } From 195430ceff8125b80def5b94f0d203980e085b4a Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Fri, 14 Aug 2020 05:48:59 +0200 Subject: [PATCH 2/9] Use ES6 imports for clientUtils --- src/scripts/clientUtils.js | 62 +++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index b576f0504e..719d722a2b 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -1,3 +1,4 @@ + export function getCurrentUser() { return window.ApiClient.getCurrentUser(false); } @@ -5,7 +6,7 @@ export function getCurrentUser() { //TODO: investigate url prefix support for serverAddress function export function serverAddress() { if (AppInfo.isNativeApp) { - var apiClient = window.ApiClient; + const apiClient = window.ApiClient; if (apiClient) { return apiClient.serverAddress(); @@ -14,15 +15,15 @@ export function serverAddress() { return null; } - var urlLower = window.location.href.toLowerCase(); - var index = urlLower.lastIndexOf('/web'); + const urlLower = window.location.href.toLowerCase(); + const index = urlLower.lastIndexOf('/web'); if (index != -1) { return urlLower.substring(0, index); } - var loc = window.location; - var address = loc.protocol + '//' + loc.hostname; + const loc = window.location; + let address = loc.protocol + '//' + loc.hostname; if (loc.port) { address += ':' + loc.port; @@ -32,7 +33,7 @@ export function serverAddress() { } export function getCurrentUserId() { - var apiClient = window.ApiClient; + const apiClient = window.ApiClient; if (apiClient) { return apiClient.getCurrentUserId(); @@ -48,7 +49,7 @@ export function onServerChanged(userId, accessToken, apiClient) { export function logout() { ConnectionManager.logout().then(function () { - var loginPage; + let loginPage; if (AppInfo.isNativeApp) { loginPage = 'selectserver.html'; @@ -80,39 +81,47 @@ export function navigate(url, preserveQueryString) { throw new Error('url cannot be null or empty'); } - var queryString = getWindowLocationSearch(); + const queryString = getWindowLocationSearch(); if (preserveQueryString && queryString) { url += queryString; } return new Promise(function (resolve, reject) { - require(['appRouter'], function (appRouter) { + import('appRouter').then(({default: appRouter}) => { return appRouter.show(url).then(resolve, reject); }); }); } export function processPluginConfigurationUpdateResult() { - require(['loading', 'toast'], function (loading, toast) { - loading.hide(); - toast.default(Globalize.translate('MessageSettingsSaved')); - }); + Promise.all([ + import('loading'), + import('toast') + ]) + .then(([{default: loading}, {default: toast}]) => { + loading.hide(); + toast.default(Globalize.translate('MessageSettingsSaved')); + }); } export function processServerConfigurationUpdateResult(result) { - require(['loading', 'toast'], function (loading, toast) { - loading.hide(); - toast.default(Globalize.translate('MessageSettingsSaved')); - }); + Promise.all([ + import('loading'), + import('toast') + ]) + .then(([{default: loading}, {default: toast}]) => { + loading.hide(); + toast.default(Globalize.translate('MessageSettingsSaved')); + }); } export function processErrorResponse(response) { - require(['loading'], function (loading) { + import('loading').then(({default: loading}) => { loading.hide(); }); - var status = '' + response.status; + let status = '' + response.status; if (response.statusText) { status = response.statusText; @@ -126,14 +135,14 @@ export function processErrorResponse(response) { export function alert(options) { if (typeof options == 'string') { - return void require(['toast'], function (toast) { + return void import('toast').then(({default: toast}) => { toast.default({ text: options }); }); } - require(['alert'], function (alert) { + import('alert').then(({default: alert}) => { alert.default({ title: options.title || Globalize.translate('HeaderAlert'), text: options.message @@ -142,7 +151,7 @@ export function alert(options) { } export function capabilities(appHost) { - var capabilities = { + let capabilities = { PlayableMediaTypes: ['Audio', 'Video'], SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'], SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android', @@ -161,22 +170,19 @@ export function selectServer() { } export function hideLoadingMsg() { - 'use strict'; - require(['loading'], function(loading) { + import('loading').then(({default: loading}) => { loading.hide(); }); } export function showLoadingMsg() { - 'use strict'; - require(['loading'], function(loading) { + import('loading').then(({default: loading}) => { loading.show(); }); } export function confirm(message, title, callback) { - 'use strict'; - require(['confirm'], function(confirm) { + import('confirm').then(({default: confirm}) => { confirm(message, title).then(function() { callback(!0); }).catch(function() { From 58c49ab85a9eb8c80a9321c7e8949a82f1472087 Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Fri, 14 Aug 2020 17:10:13 +0200 Subject: [PATCH 3/9] Update src/scripts/clientUtils.js Co-authored-by: Cameron --- src/scripts/clientUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index 719d722a2b..fa9f232439 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -143,7 +143,7 @@ export function alert(options) { } import('alert').then(({default: alert}) => { - alert.default({ + alert({ title: options.title || Globalize.translate('HeaderAlert'), text: options.message }).then(options.callback || function () {}); From 5b0018850e8689cb9411f45f3724316e560d5351 Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Fri, 14 Aug 2020 17:10:20 +0200 Subject: [PATCH 4/9] Update src/scripts/clientUtils.js Co-authored-by: Cameron --- src/scripts/clientUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index fa9f232439..d94a08e56e 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -112,7 +112,7 @@ export function processServerConfigurationUpdateResult(result) { ]) .then(([{default: loading}, {default: toast}]) => { loading.hide(); - toast.default(Globalize.translate('MessageSettingsSaved')); + toast.(Globalize.translate('MessageSettingsSaved')); }); } From 7f9f3cf206950baae1ad2591b4a302546a42d717 Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Fri, 14 Aug 2020 17:10:27 +0200 Subject: [PATCH 5/9] Update src/scripts/clientUtils.js Co-authored-by: Cameron --- src/scripts/clientUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index d94a08e56e..eb3105a0a2 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -136,7 +136,7 @@ export function processErrorResponse(response) { export function alert(options) { if (typeof options == 'string') { return void import('toast').then(({default: toast}) => { - toast.default({ + toast({ text: options }); }); From c91a6195d75af7e78f9479afc72e9cee816a9551 Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Fri, 14 Aug 2020 20:00:46 +0200 Subject: [PATCH 6/9] Update src/scripts/clientUtils.js Co-authored-by: Cameron --- src/scripts/clientUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index eb3105a0a2..b8ed8c038b 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -112,7 +112,7 @@ export function processServerConfigurationUpdateResult(result) { ]) .then(([{default: loading}, {default: toast}]) => { loading.hide(); - toast.(Globalize.translate('MessageSettingsSaved')); + toast(Globalize.translate('MessageSettingsSaved')); }); } From e606681872e86d56c9b06da272f4ca184c956b8b Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Fri, 14 Aug 2020 20:00:57 +0200 Subject: [PATCH 7/9] Update src/scripts/clientUtils.js Co-authored-by: Cameron --- src/scripts/clientUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index b8ed8c038b..bf61bb1dd3 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -101,7 +101,7 @@ export function processPluginConfigurationUpdateResult() { ]) .then(([{default: loading}, {default: toast}]) => { loading.hide(); - toast.default(Globalize.translate('MessageSettingsSaved')); + toast(Globalize.translate('MessageSettingsSaved')); }); } From bc6a1d5734c3b5a688d12d20387b1670c71814cd Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sun, 16 Aug 2020 21:14:18 +0200 Subject: [PATCH 8/9] Fix linting issue --- src/components/appRouter.js | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/components/appRouter.js b/src/components/appRouter.js index 9734925657..28826c55cc 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -692,18 +692,12 @@ class AppRouter { return 'dashboard.html'; } -<<<<<<< HEAD - function show(path, options) { - if (path.indexOf('/') !== 0 && path.indexOf('://') === -1) { - path = '/' + path; -======= if (item === 'recordedtv') { return 'livetv.html?tab=3&serverId=' + options.serverId; } if (item === 'nextup') { return 'list.html?type=nextup&serverId=' + options.serverId; ->>>>>>> upstream/master } if (item === 'list') { @@ -851,31 +845,4 @@ class AppRouter { } } -<<<<<<< HEAD - appRouter.addRoute = addRoute; - appRouter.param = param; - appRouter.back = back; - appRouter.show = show; - appRouter.start = start; - appRouter.baseUrl = baseUrl; - appRouter.canGoBack = canGoBack; - appRouter.current = current; - appRouter.beginConnectionWizard = beginConnectionWizard; - appRouter.invokeShortcut = invokeShortcut; - appRouter.showItem = showItem; - appRouter.setTransparency = setTransparency; - appRouter.getRoutes = getRoutes; - appRouter.pushState = pushState; - appRouter.enableNativeHistory = enableNativeHistory; - appRouter.handleAnchorClick = page.clickHandler; - appRouter.TransparencyLevel = { - None: 0, - Backdrop: 1, - Full: 2 - }; - - return appRouter; -}); -======= export default new AppRouter(); ->>>>>>> upstream/master From 15010b142611aa05e3fe849873c809e1e8907ccd Mon Sep 17 00:00:00 2001 From: Julien Machiels Date: Mon, 17 Aug 2020 04:26:38 +0200 Subject: [PATCH 9/9] Update src/scripts/clientUtils.js Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com> --- src/scripts/clientUtils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index bf61bb1dd3..564f5784b0 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -157,8 +157,7 @@ export function capabilities(appHost) { SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android', SupportsMediaControl: true }; - appHost.getPushTokenInfo(); - return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo()); + return Object.assign(capabilities, appHost.getPushTokenInfo()); } export function selectServer() {