define(['appStorage', 'jQuery'], function (appStorage, $) {
var supporterPlaybackKey = 'lastSupporterPlaybackMessage4';
function validatePlayback(resolve, reject) {
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
if (pluginSecurityInfo.IsMBSupporter) {
resolve();
} else {
var lastMessage = parseInt(appStorage.getItem(supporterPlaybackKey) || '0');
if (!lastMessage) {
// Don't show on the very first playback attempt
appStorage.setItem(supporterPlaybackKey, new Date().getTime());
resolve();
}
else if ((new Date().getTime() - lastMessage) > 259200000) {
showPlaybackOverlay(resolve, reject);
} else {
resolve();
}
}
});
}
function getSubscriptionBenefits() {
var list = [];
list.push({
name: Globalize.translate('CoverArt'),
icon: 'photo',
text: Globalize.translate('CoverArtFeatureDescription')
});
list.push({
name: Globalize.translate('HeaderFreeApps'),
icon: 'check',
text: Globalize.translate('FreeAppsFeatureDescription')
});
if (Dashboard.capabilities().SupportsSync) {
list.push({
name: Globalize.translate('HeaderMobileSync'),
icon: 'sync',
text: Globalize.translate('MobileSyncFeatureDescription')
});
}
else if (AppInfo.isNativeApp) {
list.push({
name: Globalize.translate('HeaderCloudSync'),
icon: 'sync',
text: Globalize.translate('CloudSyncFeatureDescription')
});
}
else {
list.push({
name: Globalize.translate('HeaderCinemaMode'),
icon: 'movie',
text: Globalize.translate('CinemaModeFeatureDescription')
});
}
return list;
}
function getSubscriptionBenefitHtml(item) {
var html = '';
html += '
' + Globalize.translate('MessageDidYouKnowCinemaMode') + '
'; html += '' + Globalize.translate('MessageDidYouKnowCinemaMode2') + '
'; html += '' + Globalize.translate('ButtonLearnMore') + '
', title: Globalize.translate('HeaderSync'), callback: reject }); }, function () { reject(); Dashboard.hideLoadingMsg(); Dashboard.alert({ message: Globalize.translate('ErrorValidatingSupporterInfo') }); }); }); } window.RegistrationServices = { renderPluginInfo: function (page, pkg, pluginSecurityInfo) { if (pkg.isPremium) { $('.premiumPackage', page).show(); // Fill in registration info var regStatus = ""; if (pkg.isRegistered) { regStatus += ""; regStatus += Globalize.translate('MessageFeatureIncludedWithSupporter'); } else { var expDateTime = new Date(pkg.expDate).getTime(); var nowTime = new Date().getTime(); if (expDateTime <= nowTime) { regStatus += "
"; regStatus += Globalize.translate('MessageTrialExpired'); } else if (expDateTime > new Date(1970, 1, 1).getTime()) { regStatus += "
"; regStatus += Globalize.translate('MessageTrialWillExpireIn').replace('{0}', Math.round(expDateTime - nowTime) / (86400000)); } } regStatus += "
"; $('#regStatus', page).html(regStatus); if (pluginSecurityInfo.IsMBSupporter) { $('#regInfo', page).html(pkg.regInfo || ""); $('.premiumDescription', page).hide(); $('.supporterDescription', page).hide(); if (pkg.price > 0) { $('.premiumHasPrice', page).show(); $('#featureId', page).val(pkg.featureId); $('#featureName', page).val(pkg.name); $('#amount', page).val(pkg.price); $('#regPrice', page).html("