(function () { function isAndroid() { var platform = (device.platform || '').toLowerCase(); return platform.indexOf('android') != -1; } function validatePlayback(deferred) { // Don't require validation on android if (isAndroid()) { deferred.resolve(); return; } validateFeature({ id: 'premiumunlock' }, deferred); } function validateLiveTV(deferred) { // Don't require validation if not android if (!isAndroid()) { deferred.resolve(); return; } validateFeature({ id: 'premiumunlock' }, deferred); } function validateSmb(deferred) { // Don't require validation if not android if (!isAndroid()) { deferred.resolve(); return; } validateFeature({ id: 'premiumunlock' }, deferred); } function getRegistrationInfo(feature, enableSupporterUnlock) { if (!enableSupporterUnlock) { var deferred = $.Deferred(); deferred.resolveWith(null, [{}]); return deferred.promise(); } return ConnectionManager.getRegistrationInfo(feature, ApiClient); } function validateFeature(info, deferred) { if (IapManager.hasPurchased(info.id)) { deferred.resolve(); return; } var productInfo = { enableSupporterUnlock: isAndroid(), enableAppUnlock: IapManager.isPurchaseAvailable(info.id), id: info.id }; 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) { cancelInAppPurchase(); var html = ''; html += '