diff --git a/src/bower_components/emby-webcomponents/registrationservices/registrationservices.js b/src/bower_components/emby-webcomponents/registrationservices/registrationservices.js
index eccbeadacd..e753054a16 100644
--- a/src/bower_components/emby-webcomponents/registrationservices/registrationservices.js
+++ b/src/bower_components/emby-webcomponents/registrationservices/registrationservices.js
@@ -1,732 +1,15 @@
-define(['appSettings', 'loading', 'apphost', 'iapManager', 'events', 'shell', 'globalize', 'dialogHelper', 'connectionManager', 'layoutManager', 'emby-button', 'emby-linkbutton'], function (appSettings, loading, appHost, iapManager, events, shell, globalize, dialogHelper, connectionManager, layoutManager) {
+define(['appSettings', 'loading', 'apphost', 'events', 'shell', 'globalize', 'dialogHelper', 'connectionManager', 'layoutManager', 'emby-button', 'emby-linkbutton'], function (appSettings, loading, appHost, events, shell, globalize, dialogHelper, connectionManager, layoutManager) {
'use strict';
- var currentDisplayingProductInfos = [];
- var currentDisplayingResolve = null;
- var currentValidatingFeature = null;
- var isCurrentDialogRejected = null;
-
- function alertText(options) {
- return new Promise(function (resolve, reject) {
-
- require(['alert'], function (alert) {
- alert(options).then(resolve, reject);
- });
- });
- }
-
- function showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, dialogOptions) {
-
- return new Promise(function (resolve, reject) {
-
- require(['listViewStyle', 'formDialogStyle'], function () {
- showInAppPurchaseElement(subscriptionOptions, unlockableProductInfo, dialogOptions, resolve, reject);
-
- currentDisplayingResolve = resolve;
- });
- });
- }
-
- function showPeriodicMessage(feature, settingsKey) {
-
- return new Promise(function (resolve, reject) {
-
- require(['listViewStyle', 'emby-button', 'formDialogStyle'], function () {
-
- var dlg = dialogHelper.createDialog({
- size: layoutManager.tv ? 'fullscreen' : 'fullscreen-border',
- removeOnClose: true,
- scrollY: false
- });
-
- dlg.classList.add('formDialog');
-
- var html = '';
- var seconds = 11;
-
- html += '
';
-
- html += '';
-
- html += '';
-
- html += '';
- html += '';
-
- dlg.innerHTML = html;
-
- var isRejected = true;
-
- var timeTextInterval = setInterval(function () {
-
- seconds -= 1;
- if (seconds <= 0) {
- dlg.querySelector('.continueTimeText').classList.add('hide');
- dlg.querySelector('.btnContinue').classList.remove('hide');
- } else {
- dlg.querySelector('.continueTimeText').innerHTML = globalize.translate('sharedcomponents#ContinueInSecondsValue', seconds);
- }
-
- }, 1000);
-
- var i, length;
- var btnPurchases = dlg.querySelectorAll('.buttonPremiereInfo');
- for (i = 0, length = btnPurchases.length; i < length; i++) {
- btnPurchases[i].addEventListener('click', showExternalPremiereInfo);
- }
-
- if (layoutManager.tv) {
- centerFocus(dlg.querySelector('.formDialogContent'), false, true);
- }
-
- // Has to be assigned a z-index after the call to .open()
- dlg.addEventListener('close', function (e) {
-
- clearInterval(timeTextInterval);
-
- if (layoutManager.tv) {
- centerFocus(dlg.querySelector('.formDialogContent'), false, false);
- }
-
- if (isRejected) {
- reject();
- } else {
- appSettings.set(settingsKey, new Date().getTime());
-
- resolve();
- }
- });
-
- dlg.querySelector('.btnContinue').addEventListener('click', function () {
- isRejected = false;
- dialogHelper.close(dlg);
- });
-
- dlg.querySelector('.btnGetPremiere').addEventListener('click', showPremiereInfo);
-
- dialogHelper.open(dlg);
-
- var onCancelClick = function () {
- dialogHelper.close(dlg);
- };
- var elems = dlg.querySelectorAll('.btnCancelSupporterInfo');
- for (i = 0, length = elems.length; i < length; i++) {
- elems[i].addEventListener('click', onCancelClick);
- }
- });
- });
- }
-
- function showPeriodicMessageIfNeeded(feature) {
-
- if (feature !== 'playback') {
- return Promise.resolve();
- }
-
- var intervalMs = iapManager.getPeriodicMessageIntervalMs(feature);
- if (intervalMs <= 0) {
- return Promise.resolve();
- }
-
- var settingsKey = 'periodicmessage11-' + feature;
-
- var lastMessage = parseInt(appSettings.get(settingsKey) || '0');
-
- if (!lastMessage) {
-
- // Don't show on the very first playback attempt
- appSettings.set(settingsKey, new Date().getTime());
- return Promise.resolve();
- }
-
- if ((new Date().getTime() - lastMessage) > intervalMs) {
-
- var apiClient = connectionManager.currentApiClient();
- if (apiClient.serverId() === '6da60dd6edfc4508bca2c434d4400816') {
- return Promise.resolve();
- }
-
- var registrationOptions = {
- viewOnly: true
- };
-
- // Get supporter status
- return connectionManager.getRegistrationInfo(iapManager.getAdminFeatureName(feature), apiClient, registrationOptions).catch(function (errorResult) {
-
- if (errorResult === 'overlimit') {
- appSettings.set(settingsKey, new Date().getTime());
- return Promise.resolve();
- }
-
- return showPeriodicMessage(feature, settingsKey);
- });
- }
-
+ function validateFeature(feature, options) {
return Promise.resolve();
}
- function validateFeature(feature, options) {
-
- options = options || {};
-
- console.log('validateFeature: ' + feature);
-
- return iapManager.isUnlockedByDefault(feature, options).then(function () {
-
- return showPeriodicMessageIfNeeded(feature);
-
- }, function () {
-
- var unlockableFeatureCacheKey = 'featurepurchased-' + feature;
- if (appSettings.get(unlockableFeatureCacheKey) === '1') {
- return showPeriodicMessageIfNeeded(feature);
- }
-
- var unlockableProduct = iapManager.getProductInfo(feature);
- if (unlockableProduct) {
-
- var unlockableCacheKey = 'productpurchased-' + unlockableProduct.id;
- if (unlockableProduct.owned) {
-
- // Cache this to eliminate the store as a possible point of failure in the future
- appSettings.set(unlockableFeatureCacheKey, '1');
- appSettings.set(unlockableCacheKey, '1');
- return showPeriodicMessageIfNeeded(feature);
- }
-
- if (appSettings.get(unlockableCacheKey) === '1') {
- return showPeriodicMessageIfNeeded(feature);
- }
- }
-
- var unlockableProductInfo = unlockableProduct ? {
- enableAppUnlock: true,
- id: unlockableProduct.id,
- price: unlockableProduct.price,
- feature: feature
-
- } : null;
-
- return iapManager.getSubscriptionOptions().then(function (subscriptionOptions) {
-
- if (subscriptionOptions.filter(function (p) {
- return p.owned;
- }).length > 0) {
- return Promise.resolve();
- }
-
- var registrationOptions = {
- viewOnly: options.viewOnly
- };
-
- // Get supporter status
- return connectionManager.getRegistrationInfo(iapManager.getAdminFeatureName(feature), connectionManager.currentApiClient(), registrationOptions).catch(function (errorResult) {
-
- if (options.showDialog === false) {
- return Promise.reject();
- }
-
- var alertPromise;
-
- if (errorResult === 'overlimit') {
- alertPromise = showOverLimitAlert();
- }
-
- if (!alertPromise) {
- alertPromise = Promise.resolve();
- }
-
- return alertPromise.then(function () {
-
- var dialogOptions = {
- title: globalize.translate('sharedcomponents#HeaderUnlockFeature'),
- feature: feature
- };
-
- currentValidatingFeature = feature;
-
- return showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, dialogOptions);
- });
- });
- });
- });
- }
-
- function showOverLimitAlert() {
-
- return alertText('Your Jellyfin Premiere device limit has been exceeded. Please check with the owner of your Jellyfin Server and have them contact Emby support at apps@emby.media if necessary.').catch(function () {
- return Promise.resolve();
- });
- }
-
- function cancelInAppPurchase() {
-
- var elem = document.querySelector('.inAppPurchaseOverlay');
- if (elem) {
- dialogHelper.close(elem);
- }
- }
-
- function clearCurrentDisplayingInfo() {
- currentDisplayingProductInfos = [];
- currentDisplayingResolve = null;
- currentValidatingFeature = null;
- isCurrentDialogRejected = null;
- }
-
- function showExternalPremiereInfo() {
- shell.openUrl(iapManager.getPremiumInfoUrl());
- }
-
- function centerFocus(elem, horiz, on) {
- require(['scrollHelper'], function (scrollHelper) {
- var fn = on ? 'on' : 'off';
- scrollHelper.centerFocus[fn](elem, horiz);
- });
- }
-
- function getPurchaseTermHtml(term) {
-
- return '' + term + '';
- }
-
- function getTermsOfPurchaseHtml() {
-
- var html = '';
-
- var termsOfPurchase = iapManager.getTermsOfPurchase ? iapManager.getTermsOfPurchase() : [];
-
- if (!termsOfPurchase.length) {
-
- return html;
- }
-
- html += '' + globalize.translate('sharedcomponents#HeaderTermsOfPurchase') + '
';
-
- termsOfPurchase.push('' + globalize.translate('sharedcomponents#PrivacyPolicy') + '');
- termsOfPurchase.push('' + globalize.translate('sharedcomponents#TermsOfUse') + '');
-
- html += '';
- html += termsOfPurchase.map(getPurchaseTermHtml).join('');
- html += '
';
-
- return html;
- }
-
- function showInAppPurchaseElement(subscriptionOptions, unlockableProductInfo, dialogOptions, resolve, reject) {
-
- cancelInAppPurchase();
-
- // clone
- currentDisplayingProductInfos = subscriptionOptions.slice(0);
-
- if (unlockableProductInfo) {
- currentDisplayingProductInfos.push(unlockableProductInfo);
- }
-
- var dlg = dialogHelper.createDialog({
- size: layoutManager.tv ? 'fullscreen' : 'fullscreen-border',
- removeOnClose: true,
- scrollY: false
- });
-
- dlg.classList.add('formDialog');
-
- var html = '';
- html += '';
-
- html += '';
- html += '
';
- html += '
';
- html += '
';
- html += '
';
-
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
-
- var btnPurchases = dlg.querySelectorAll('.btnPurchase');
- for (i = 0, length = btnPurchases.length; i < length; i++) {
- btnPurchases[i].addEventListener('click', onPurchaseButtonClick);
- }
-
- btnPurchases = dlg.querySelectorAll('.buttonPremiereInfo');
- for (i = 0, length = btnPurchases.length; i < length; i++) {
- btnPurchases[i].addEventListener('click', showExternalPremiereInfo);
- }
-
- isCurrentDialogRejected = true;
- var resolveWithTimeLimit = false;
-
- var btnPlayMinute = dlg.querySelector('.btnPlayMinute');
- if (btnPlayMinute) {
- btnPlayMinute.addEventListener('click', function () {
-
- resolveWithTimeLimit = true;
- isCurrentDialogRejected = false;
- dialogHelper.close(dlg);
- });
- }
-
- dlg.querySelector('.btnRestorePurchase').addEventListener('click', function () {
- restorePurchase(unlockableProductInfo);
- });
-
- loading.hide();
-
- function onCloseButtonClick() {
-
- dialogHelper.close(dlg);
- }
-
- var btnCloseDialogs = dlg.querySelectorAll('.btnCloseDialog');
- for (i = 0, length = btnCloseDialogs.length; i < length; i++) {
- btnCloseDialogs[i].addEventListener('click', onCloseButtonClick);
- }
-
- dlg.classList.add('inAppPurchaseOverlay');
-
- if (layoutManager.tv) {
- centerFocus(dlg.querySelector('.formDialogContent'), false, true);
- }
-
- dialogHelper.open(dlg).then(function () {
- if (layoutManager.tv) {
- centerFocus(dlg.querySelector('.formDialogContent'), false, false);
- }
-
- var rejected = isCurrentDialogRejected;
- clearCurrentDisplayingInfo();
- if (rejected) {
- reject();
- } else if (resolveWithTimeLimit) {
- resolve({
- enableTimeLimit: true
- });
- }
- });
- }
-
- function getSubscriptionBenefits() {
-
- var list = [];
-
- list.push({
- name: globalize.translate('sharedcomponents#HeaderFreeApps'),
- icon: '',
- text: globalize.translate('sharedcomponents#FreeAppsFeatureDescription')
- });
-
- if (appHost.supports('sync')) {
- list.push({
- name: globalize.translate('sharedcomponents#HeaderOfflineDownloads'),
- icon: '',
- text: globalize.translate('sharedcomponents#HeaderOfflineDownloadsDescription')
- });
- }
-
- list.push({
- name: globalize.translate('sharedcomponents#LiveTV'),
- icon: '',
- text: globalize.translate('sharedcomponents#LiveTvFeatureDescription')
- });
-
- list.push({
- name: 'Jellyfin DVR',
- icon: '',
- text: globalize.translate('sharedcomponents#DvrFeatureDescription')
- });
-
- list.push({
- name: globalize.translate('sharedcomponents#HeaderCinemaMode'),
- icon: '',
- text: globalize.translate('sharedcomponents#CinemaModeFeatureDescription')
- });
-
- list.push({
- name: globalize.translate('sharedcomponents#HeaderCloudSync'),
- icon: '',
- text: globalize.translate('sharedcomponents#CloudSyncFeatureDescription')
- });
-
- return list;
- }
-
- function getSubscriptionBenefitHtml(item) {
-
- var enableLink = appHost.supports('externalpremium');
-
- var html = '';
-
- var cssClass = "listItem";
-
- if (layoutManager.tv) {
- cssClass += ' listItem-focusscale';
- }
-
- if (enableLink) {
- cssClass += ' listItem-button';
-
- html += '