(function () { function isAndroid() { var platform = (device.platform || '').toLowerCase(); return platform.indexOf('android') != -1; } function getPremiumUnlockFeatureId() { if (isAndroid()) { return "com.mb.android.unlock"; } return 'appunlock'; } function validatePlayback(deferred) { // Don't require validation on android if (isAndroid()) { deferred.resolve(); return; } validateFeature(getPremiumUnlockFeatureId(), deferred); } function validateLiveTV(deferred) { if (!isAndroid()) { deferred.resolve(); return; } validateFeature(getPremiumUnlockFeatureId(), deferred); } function validateServerManagement(deferred) { deferred.resolve(); } function getRegistrationInfo(feature, enableSupporterUnlock) { if (!enableSupporterUnlock) { var deferred = $.Deferred(); deferred.resolveWith(null, [{}]); return deferred.promise(); } return ConnectionManager.getRegistrationInfo(feature, ApiClient); } function validateFeature(id, deferred) { var info = IapManager.getProductInfo(id) || {}; if (info.owned) { deferred.resolve(); return; } var productInfo = { enableSupporterUnlock: isAndroid(), enableAppUnlock: IapManager.isPurchaseAvailable(id), id: id, price: info.price }; var prefix = isAndroid() ? 'android' : 'ios'; // Get supporter status getRegistrationInfo(prefix + 'appunlock', productInfo.enableSupporterUnlock).done(function (registrationInfo) { if (registrationInfo.IsRegistered) { deferred.resolve(); return; } showInAppPurchaseInfo(productInfo, registrationInfo, deferred); }).fail(function () { deferred.reject(); }); } function getInAppPurchaseElement(info) { require(['paperbuttonstyle']); cancelInAppPurchase(); var html = ''; html += '
'; if (info.enableSupporterUnlock && info.enableAppUnlock) { html += Globalize.translate('MessageUnlockAppWithPurchaseOrSupporter'); } else if (info.enableSupporterUnlock) { html += Globalize.translate('MessageUnlockAppWithSupporter'); } else if (info.enableAppUnlock) { html += Globalize.translate('MessageUnlockAppWithPurchase'); } else { html += ''; html += Globalize.translate('MessagePaymentServicesUnavailable'); html += ''; } html += '
'; if (info.enableSupporterUnlock) { html += ''; html += Globalize.translate('MessageToValidateSupporter'); html += '
'; } if (info.enableAppUnlock) { var unlockText = Globalize.translate('ButtonUnlockWithPurchase'); if (info.price) { unlockText = Globalize.translate('ButtonUnlockPrice', info.price); } html += '';
html += '
';
html += '
';
html += '