2017-08-05 12:03:18 -07:00
|
|
|
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){"use strict";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:!0,scrollY:!1});dlg.classList.add("formDialog");var html="";html+='<div class="formDialogHeader">',html+='<button is="paper-icon-button-light" class="btnCancelSupporterInfo autoSize" tabindex="-1"><i class="md-icon"></i></button>',html+='<h3 class="formDialogHeaderTitle">Emby Premiere',html+="</h3>",html+="</div>",html+='<div class="formDialogContent smoothScrollY">',html+='<div class="dialogContentInner dialog-content-centered">',html+="<h1>"+globalize.translate("sharedcomponents#HeaderDiscoverEmbyPremiere")+"</h1>",html+="<p>"+globalize.translate("sharedcomponents#MessageDidYouKnowCinemaMode")+"</p>",html+="<p>"+globalize.translate("sharedcomponents#MessageDidYouKnowCinemaMode2")+"</p>",html+='<h1 style="margin-top:1.5em;">'+globalize.translate("sharedcomponents#HeaderBenefitsEmbyPremiere")+"</h1>",html+='<div class="paperList">',html+=getSubscriptionBenefits().map(getSubscriptionBenefitHtml).join(""),html+="</div>",html+="<br/>",html+='<div class="formDialogFooter">',html+='<button is="emby-button" type="button" class="raised button-submit block btnGetPremiere block formDialogFooterItem" autoFocus><span>'+globalize.translate("sharedcomponents#HeaderBecomeProjectSupporter")+"</span></button>";var seconds=11;html+='<div class="continueTimeText formDialogFooterItem" style="margin: 1.5em 0 .5em;">'+globalize.translate("sharedcomponents#ContinueInSecondsValue",seconds)+"</div>",html+='<button is="emby-button" type="button" class="raised button-cancel block btnContinue block formDialogFooterItem hide"><span>'+globalize.translate("sharedcomponents#Continue")+"</span></button>",html+="</div>",html+="</div>",html+="</div>",dlg.innerHTML=html;var i,length,isRejected=!0,timeTextInterval=setInterval(function(){seconds-=1,seconds<=0?(dlg.querySelector(".continueTimeText").classList.add("hide"),dlg.querySelector(".btnContinue").classList.remove("hide")):dlg.querySelector(".continueTimeText").innerHTML=globalize.translate("sharedcomponents#ContinueInSecondsValue",seconds)},1e3),btnPurchases=dlg.querySelectorAll(".buttonPremiereInfo");for(i=0,length=btnPurchases.length;i<length;i++)btnPurchases[i].addEventListener("click",showExternalPremiereInfo);layoutManager.tv&¢erFocus(dlg.querySelector(".formDialogContent"),!1,!0),dlg.addEventListener("close",function(e){clearInterval(timeTextInterval),layoutManager.tv&¢erFocus(dlg.querySelector(".formDialogContent"),!1,!1),isRejected?reject():(appSettings.set(settingsKey,(new Date).getTime()),resolve())}),dlg.querySelector(".btnContinue").addEventListener("click",function(){isRejected=!1,dialogHelper.close(dlg)}),dlg.querySelector(".btnGetPremiere").addEventListener("click",showPremiereInfo),dialogHelper.open(dlg);var onCancelClick=function(){dialogHelper.close(dlg)},elems=dlg.querySelectorAll(".btnCancelSupporterInfo");for(i=0,length=elems.length;i<length;i++)elems[i].addEventListener("click",onCancelClick)})})}function showPeriodicMessageIfNeeded(feature){if("playback"!==feature)return Promise.resolve();var intervalMs=iapManager.getPeriodicMessageIntervalMs(featur
|