mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
remove probing of live tv feeds
This commit is contained in:
parent
755f6fc79c
commit
2f83f86ee8
11 changed files with 129 additions and 80 deletions
|
@ -192,6 +192,16 @@
|
||||||
</select>
|
</select>
|
||||||
<div>${LabelEnableItemPreviewsHelp}</div>
|
<div>${LabelEnableItemPreviewsHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="fldFullscreen">
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<div data-role="controlgroup">
|
||||||
|
<label for="chkEnableFullScreen">${LabelEnableFullScreen}</label>
|
||||||
|
<input type="checkbox" id="chkEnableFullScreen" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1831,21 +1831,22 @@
|
||||||
return '<div class="posterRibbon offlinePosterRibbon">' + Globalize.translate('HeaderOffline') + '</div>';
|
return '<div class="posterRibbon offlinePosterRibbon">' + Globalize.translate('HeaderOffline') + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (item.Type == 'Episode') {
|
||||||
|
try {
|
||||||
|
|
||||||
var date = parseISO8601Date(item.PremiereDate, { toLocal: true });
|
var date = parseISO8601Date(item.PremiereDate, { toLocal: true });
|
||||||
|
|
||||||
|
if (item.PremiereDate && (new Date().getTime() < date.getTime())) {
|
||||||
|
return '<div class="posterRibbon unairedPosterRibbon">' + Globalize.translate('HeaderUnaired') + '</div>';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
if (item.PremiereDate && (new Date().getTime() < date.getTime())) {
|
|
||||||
return '<div class="posterRibbon unairedPosterRibbon">' + Globalize.translate('HeaderUnaired') + '</div>';
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
|
return '<div class="posterRibbon missingPosterRibbon">' + Globalize.translate('HeaderMissing') + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.IsFolder) {
|
return '';
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return '<div class="posterRibbon missingPosterRibbon">' + Globalize.translate('HeaderMissing') + '</div>';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getPlayedIndicatorHtml: function (item) {
|
getPlayedIndicatorHtml: function (item) {
|
||||||
|
|
|
@ -33,7 +33,12 @@
|
||||||
|
|
||||||
html += '<button onclick="VoiceInputManager.startListening();" type="button" data-role="none" class="headerButton headerButtonRight headerVoiceButton" style="display:none;"><i class="material-icons">mic</i></button>';
|
html += '<button onclick="VoiceInputManager.startListening();" type="button" data-role="none" class="headerButton headerButtonRight headerVoiceButton" style="display:none;"><i class="material-icons">mic</i></button>';
|
||||||
|
|
||||||
if (!$.browser.mobile) {
|
//if (AppInfo.isNativeApp && $.browser.android)
|
||||||
|
//{
|
||||||
|
// html += '<button class="headerButtonViewMenu headerButton headerButtonRight" type="button" data-role="none"><i class="material-icons">more_vert</i></button>';
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (!$.browser.mobile && !AppInfo.isTouchPreferred) {
|
||||||
html += '<a href="dashboard.html" class="headerButton headerButtonRight dashboardEntryHeaderButton" style="display:none;"><i class="material-icons">settings</i></a>';
|
html += '<a href="dashboard.html" class="headerButton headerButtonRight dashboardEntryHeaderButton" style="display:none;"><i class="material-icons">settings</i></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +99,27 @@
|
||||||
// Have to wait for document ready here because otherwise
|
// Have to wait for document ready here because otherwise
|
||||||
// we may see the jQM redirect back and forth problem
|
// we may see the jQM redirect back and forth problem
|
||||||
$(initViewMenuBarHeadroom);
|
$(initViewMenuBarHeadroom);
|
||||||
|
|
||||||
|
//$('.headerButtonViewMenu').off('click', onViewButtonClick).on('click', onViewButtonClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//function onViewButtonClick() {
|
||||||
|
|
||||||
|
// var html = '<div class="appViewMenuPanel" data-role="panel" data-position="right" data-display="overlay" data-position-fixed="true" data-theme="a">';
|
||||||
|
|
||||||
|
|
||||||
|
// html += '</div>';
|
||||||
|
|
||||||
|
// $(document.body).append(html);
|
||||||
|
|
||||||
|
// var elem = $('.appViewMenuPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
|
||||||
|
|
||||||
|
// $(this).off("panelclose").remove();
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
function initViewMenuBarHeadroom() {
|
function initViewMenuBarHeadroom() {
|
||||||
|
|
||||||
// grab an element
|
// grab an element
|
||||||
|
|
|
@ -508,7 +508,7 @@
|
||||||
|
|
||||||
Dashboard.loadLocalAssetManager().done(function () {
|
Dashboard.loadLocalAssetManager().done(function () {
|
||||||
|
|
||||||
var serverInfo = ApiClient.serverInfo().Id;
|
var serverInfo = ApiClient.serverInfo();
|
||||||
|
|
||||||
if (serverInfo.Id) {
|
if (serverInfo.Id) {
|
||||||
var localMediaSource = window.LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId);
|
var localMediaSource = window.LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
$('#selectEnableItemPreviews', page).val(AppSettings.enableItemPreviews().toString().toLowerCase()).selectmenu("refresh");
|
$('#selectEnableItemPreviews', page).val(AppSettings.enableItemPreviews().toString().toLowerCase()).selectmenu("refresh");
|
||||||
|
|
||||||
$('#chkEnableLibraryTileNames', page).checked(displayPreferences.CustomPrefs.enableLibraryTileNames != '0').checkboxradio("refresh");
|
$('#chkEnableLibraryTileNames', page).checked(displayPreferences.CustomPrefs.enableLibraryTileNames != '0').checkboxradio("refresh");
|
||||||
|
$('#chkEnableFullScreen', page).checked(AppSettings.enableFullScreen().toString().toLowerCase() == 'true').checkboxradio("refresh");
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
AppSettings.maxChromecastBitrate($('#selectMaxChromecastBitrate', page).val());
|
AppSettings.maxChromecastBitrate($('#selectMaxChromecastBitrate', page).val());
|
||||||
|
|
||||||
AppSettings.enableItemPreviews($('#selectEnableItemPreviews', page).val() == 'true');
|
AppSettings.enableItemPreviews($('#selectEnableItemPreviews', page).val() == 'true');
|
||||||
|
AppSettings.enableFullScreen($('#chkEnableFullScreen', page).checked());
|
||||||
|
|
||||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
|
@ -100,6 +102,12 @@
|
||||||
$('.labelGenericExternalPlayers', page).show();
|
$('.labelGenericExternalPlayers', page).show();
|
||||||
$('.labelNativeExternalPlayers', page).hide();
|
$('.labelNativeExternalPlayers', page).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppInfo.supportsFullScreen) {
|
||||||
|
$('.fldFullscreen', page).show();
|
||||||
|
} else {
|
||||||
|
$('.fldFullscreen', page).hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery, window, document);
|
})(jQuery, window, document);
|
|
@ -1626,6 +1626,7 @@ var AppInfo = {};
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
|
apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
|
||||||
|
apiClient.enableAutomaticNetworking = false;
|
||||||
ConnectionManager.addApiClient(apiClient);
|
ConnectionManager.addApiClient(apiClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
21
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
|
@ -173,7 +173,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.enableAutomaticNetwork || self.connectionMode == null) {
|
if (self.enableAutomaticNetworking === false || request.type != "GET") {
|
||||||
logger.log('Requesting url without automatic networking: ' + request.url);
|
logger.log('Requesting url without automatic networking: ' + request.url);
|
||||||
return AjaxApi.ajax(request).fail(onRequestFail);
|
return AjaxApi.ajax(request).fail(onRequestFail);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
|
|
||||||
logger.log("Reconnect succeeeded to " + url);
|
logger.log("Reconnect succeeeded to " + url);
|
||||||
|
|
||||||
self.connectionMode = connectionMode;
|
self.serverInfo().LastConnectionMode = connectionMode;
|
||||||
self.serverAddress(url);
|
self.serverAddress(url);
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -257,7 +257,7 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
tryReconnectInternal(deferred, self.connectionMode, 0);
|
tryReconnectInternal(deferred, self.serverInfo().LastConnectionMode, 0);
|
||||||
}, 500);
|
}, 500);
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,9 @@
|
||||||
|
|
||||||
if (replaceUrl) {
|
if (replaceUrl) {
|
||||||
|
|
||||||
var baseUrl = MediaBrowser.ServerInfo.getServerAddress(self.serverInfo(), self.connectionMode);
|
var currentServerInfo = self.serverInfo();
|
||||||
|
|
||||||
|
var baseUrl = MediaBrowser.ServerInfo.getServerAddress(currentServerInfo, currentServerInfo.LastConnectionMode);
|
||||||
|
|
||||||
request.url = replaceServerAddress(request.url, baseUrl);
|
request.url = replaceServerAddress(request.url, baseUrl);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +362,7 @@
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.enableAutomaticNetworking = function (server, connectionMode, serverUrl) {
|
self.updateServerInfo = function (server, connectionMode) {
|
||||||
|
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
throw new Error('server cannot be null');
|
throw new Error('server cannot be null');
|
||||||
|
@ -370,16 +372,11 @@
|
||||||
throw new Error('connectionMode cannot be null');
|
throw new Error('connectionMode cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!serverUrl) {
|
logger.log('Begin updateServerInfo');
|
||||||
throw new Error('serverUrl cannot be null or empty');
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.log('Begin enableAutomaticNetworking');
|
|
||||||
|
|
||||||
self.serverInfo(server);
|
self.serverInfo(server);
|
||||||
self.connectionMode = connectionMode;
|
|
||||||
self.enableAutomaticNetwork = true;
|
|
||||||
|
|
||||||
|
var serverUrl = MediaBrowser.ServerInfo.getServerAddress(connectionMode);
|
||||||
logger.log('Setting server address to ' + serverUrl);
|
logger.log('Setting server address to ' + serverUrl);
|
||||||
self.serverAddress(serverUrl);
|
self.serverAddress(serverUrl);
|
||||||
};
|
};
|
||||||
|
|
|
@ -221,19 +221,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var credentials = credentialProvider.credentials();
|
var credentials = credentialProvider.credentials();
|
||||||
var server = credentials.Servers.filter(function (s) {
|
var servers = credentials.Servers.filter(function (s) {
|
||||||
return stringEqualsIgnoreCase(s.Id, serverId);
|
return stringEqualsIgnoreCase(s.Id, serverId);
|
||||||
|
|
||||||
})[0];
|
});
|
||||||
|
|
||||||
|
if (!servers.length) {
|
||||||
|
throw new Error('Server not found: ' + serverId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var server = servers[0];
|
||||||
|
|
||||||
return getOrAddApiClient(server, server.LastConnectionMode);
|
return getOrAddApiClient(server, server.LastConnectionMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
function onAuthenticated(apiClient, result, options, saveCredentials) {
|
function onAuthenticated(apiClient, result, options, saveCredentials) {
|
||||||
|
|
||||||
var server = apiClient.serverInfo();
|
|
||||||
|
|
||||||
var credentials = credentialProvider.credentials();
|
var credentials = credentialProvider.credentials();
|
||||||
|
var servers = credentials.Servers.filter(function (s) {
|
||||||
|
return s.Id == result.ServerId;
|
||||||
|
});
|
||||||
|
|
||||||
|
var server = servers.length ? servers[0] : apiClient.serverInfo();
|
||||||
|
|
||||||
server.DateLastAccessed = new Date().getTime();
|
server.DateLastAccessed = new Date().getTime();
|
||||||
server.Id = result.ServerId;
|
server.Id = result.ServerId;
|
||||||
|
@ -942,7 +951,7 @@
|
||||||
MediaBrowser.ConnectionState.ServerSignIn;
|
MediaBrowser.ConnectionState.ServerSignIn;
|
||||||
|
|
||||||
result.Servers.push(server);
|
result.Servers.push(server);
|
||||||
result.ApiClient.enableAutomaticNetworking(server, connectionMode, MediaBrowser.ServerInfo.getServerAddress(server, connectionMode));
|
result.ApiClient.updateServerInfo(server, connectionMode);
|
||||||
|
|
||||||
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
||||||
afterConnected(result.ApiClient, options);
|
afterConnected(result.ApiClient, options);
|
||||||
|
|
13
dashboard-ui/thirdparty/cordova/android/iap.js
vendored
13
dashboard-ui/thirdparty/cordova/android/iap.js
vendored
|
@ -3,7 +3,7 @@
|
||||||
var unlockId = "com.mb.android.unlock";
|
var unlockId = "com.mb.android.unlock";
|
||||||
var updatedProducts = [];
|
var updatedProducts = [];
|
||||||
|
|
||||||
function updateProductInfo(id, owned) {
|
function updateProductInfo(id, owned, price) {
|
||||||
|
|
||||||
updatedProducts = updatedProducts.filter(function (r) {
|
updatedProducts = updatedProducts.filter(function (r) {
|
||||||
return r.id != id;
|
return r.id != id;
|
||||||
|
@ -11,7 +11,8 @@
|
||||||
|
|
||||||
var product = {
|
var product = {
|
||||||
id: id,
|
id: id,
|
||||||
owned: owned
|
owned: owned,
|
||||||
|
price: price
|
||||||
};
|
};
|
||||||
|
|
||||||
updatedProducts.push(product);
|
updatedProducts.push(product);
|
||||||
|
@ -19,12 +20,6 @@
|
||||||
Events.trigger(IapManager, 'productupdated', [product]);
|
Events.trigger(IapManager, 'productupdated', [product]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasPurchased(id) {
|
|
||||||
var product = getProduct(id);
|
|
||||||
|
|
||||||
return product != null && product.owned;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getProduct(id) {
|
function getProduct(id) {
|
||||||
var products = updatedProducts.filter(function (r) {
|
var products = updatedProducts.filter(function (r) {
|
||||||
return r.id == id;
|
return r.id == id;
|
||||||
|
@ -55,7 +50,7 @@
|
||||||
|
|
||||||
window.IapManager = {
|
window.IapManager = {
|
||||||
isPurchaseAvailable: isPurchaseAvailable,
|
isPurchaseAvailable: isPurchaseAvailable,
|
||||||
hasPurchased: hasPurchased,
|
getProductInfo: getProduct,
|
||||||
updateProduct: updateProductInfo,
|
updateProduct: updateProductInfo,
|
||||||
beginPurchase: beginPurchase,
|
beginPurchase: beginPurchase,
|
||||||
onPurchaseComplete: onPurchaseComplete
|
onPurchaseComplete: onPurchaseComplete
|
||||||
|
|
40
dashboard-ui/thirdparty/cordova/iap.js
vendored
40
dashboard-ui/thirdparty/cordova/iap.js
vendored
|
@ -1,15 +1,19 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
var unlockAlias = "premium features";
|
var unlockAlias = "premium features";
|
||||||
|
var unlockAppProductId = 'appunlock';
|
||||||
|
|
||||||
var updatedProducts = [];
|
var updatedProducts = [];
|
||||||
|
|
||||||
function updateProductInfo(p) {
|
function updateProductInfo(product) {
|
||||||
|
|
||||||
updatedProducts = updatedProducts.filter(function (r) {
|
updatedProducts = updatedProducts.filter(function (r) {
|
||||||
return r.id != p.id;
|
return r.id != product.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
updatedProducts.push(p);
|
updatedProducts.push(product);
|
||||||
|
|
||||||
|
Events.trigger(IapManager, 'productupdated', [product]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeId(id) {
|
function normalizeId(id) {
|
||||||
|
@ -31,20 +35,15 @@
|
||||||
return products.length ? products[0] : null;
|
return products.length ? products[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasPurchased(id) {
|
|
||||||
var product = getProduct(id);
|
|
||||||
|
|
||||||
return product != null && product.owned;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isPurchaseAvailable(id) {
|
function isPurchaseAvailable(id) {
|
||||||
var product = getProduct(id);
|
var product = getProduct(id);
|
||||||
|
|
||||||
return product != null && product.canPurchase;
|
return product != null && product.valid /*&& product.canPurchase*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
function beginPurchase(id) {
|
function beginPurchase(id) {
|
||||||
|
id = normalizeId(id);
|
||||||
|
store.order(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateProduct(product, callback) {
|
function validateProduct(product, callback) {
|
||||||
|
@ -80,22 +79,33 @@
|
||||||
|
|
||||||
// iOS
|
// iOS
|
||||||
store.register({
|
store.register({
|
||||||
id: "appunlock",
|
id: unlockAppProductId,
|
||||||
alias: unlockAlias,
|
alias: unlockAlias,
|
||||||
type: store.NON_CONSUMABLE
|
type: store.NON_CONSUMABLE
|
||||||
});
|
});
|
||||||
|
|
||||||
// When purchase of the full version is approved,
|
// When purchase of the full version is approved,
|
||||||
// show some logs and finish the transaction.
|
// show some logs and finish the transaction.
|
||||||
store.when(unlockAlias).approved(function (order) {
|
store.when(unlockAppProductId).approved(function (order) {
|
||||||
log('You just unlocked the FULL VERSION!');
|
log('You just unlocked the FULL VERSION!');
|
||||||
|
alert('approved');
|
||||||
order.finish();
|
order.finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
store.when(unlockAppProductId).verified(function (p) {
|
||||||
|
alert('verified');
|
||||||
|
log("verified");
|
||||||
|
p.finish();
|
||||||
|
});
|
||||||
|
|
||||||
// The play button can only be accessed when the user
|
// The play button can only be accessed when the user
|
||||||
// owns the full version.
|
// owns the full version.
|
||||||
store.when(unlockAlias).updated(function (product) {
|
store.when(unlockAppProductId).updated(function (product) {
|
||||||
|
|
||||||
|
if (product.loaded && product.valid && product.state == store.APPROVED) {
|
||||||
|
console.log('finishing previously created transaction');
|
||||||
|
product.finish();
|
||||||
|
}
|
||||||
updateProductInfo(product);
|
updateProductInfo(product);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -114,7 +124,7 @@
|
||||||
|
|
||||||
window.IapManager = {
|
window.IapManager = {
|
||||||
isPurchaseAvailable: isPurchaseAvailable,
|
isPurchaseAvailable: isPurchaseAvailable,
|
||||||
hasPurchased: hasPurchased,
|
getProductInfo: getProduct,
|
||||||
beginPurchase: beginPurchase
|
beginPurchase: beginPurchase
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
return "com.mb.android.unlock";
|
return "com.mb.android.unlock";
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'premiumunlock';
|
return 'appunlock';
|
||||||
}
|
}
|
||||||
|
|
||||||
function validatePlayback(deferred) {
|
function validatePlayback(deferred) {
|
||||||
|
@ -24,20 +24,12 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
validateFeature({
|
validateFeature(getPremiumUnlockFeatureId(), deferred);
|
||||||
|
|
||||||
id: getPremiumUnlockFeatureId()
|
|
||||||
|
|
||||||
}, deferred);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateLiveTV(deferred) {
|
function validateLiveTV(deferred) {
|
||||||
|
|
||||||
validateFeature({
|
validateFeature(getPremiumUnlockFeatureId(), deferred);
|
||||||
|
|
||||||
id: getPremiumUnlockFeatureId()
|
|
||||||
|
|
||||||
}, deferred);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRegistrationInfo(feature, enableSupporterUnlock) {
|
function getRegistrationInfo(feature, enableSupporterUnlock) {
|
||||||
|
@ -50,17 +42,20 @@
|
||||||
return ConnectionManager.getRegistrationInfo(feature, ApiClient);
|
return ConnectionManager.getRegistrationInfo(feature, ApiClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateFeature(info, deferred) {
|
function validateFeature(id, deferred) {
|
||||||
|
|
||||||
if (IapManager.hasPurchased(info.id)) {
|
var info = IapManager.getProductInfo(id) || {};
|
||||||
|
|
||||||
|
if (info.owned) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var productInfo = {
|
var productInfo = {
|
||||||
enableSupporterUnlock: isAndroid(),
|
enableSupporterUnlock: isAndroid(),
|
||||||
enableAppUnlock: IapManager.isPurchaseAvailable(info.id),
|
enableAppUnlock: IapManager.isPurchaseAvailable(id),
|
||||||
id: info.id
|
id: id,
|
||||||
|
price: info.price
|
||||||
};
|
};
|
||||||
|
|
||||||
var prefix = isAndroid() ? 'android' : 'ios';
|
var prefix = isAndroid() ? 'android' : 'ios';
|
||||||
|
@ -89,7 +84,7 @@
|
||||||
html += '<div class="inAppPurchaseOverlayInner" style="background:rgba(10,10,10,.8);width:100%;height:100%;color:#eee;">';
|
html += '<div class="inAppPurchaseOverlayInner" style="background:rgba(10,10,10,.8);width:100%;height:100%;color:#eee;">';
|
||||||
|
|
||||||
|
|
||||||
html += '<form class="inAppPurchaseForm" style="margin: 0 auto;padding: 30px 1em 0;">';
|
html += '<div class="inAppPurchaseForm" style="margin: 0 auto;padding: 30px 1em 0;">';
|
||||||
|
|
||||||
html += '<h1 style="color:#fff;">' + Globalize.translate('HeaderUnlockApp') + '</h1>';
|
html += '<h1 style="color:#fff;">' + Globalize.translate('HeaderUnlockApp') + '</h1>';
|
||||||
|
|
||||||
|
@ -116,7 +111,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.enableAppUnlock) {
|
if (info.enableAppUnlock) {
|
||||||
html += '<button class="btn btnActionAccent btnAppUnlock" data-role="none" type="submit"><span>' + Globalize.translate('ButtonUnlockWithPurchase') + '</span><i class="fa fa-check"></i></button>';
|
|
||||||
|
var unlockText = Globalize.translate('ButtonUnlockWithPurchase');
|
||||||
|
if (info.price) {
|
||||||
|
unlockText = Globalize.translate('ButtonUnlockPrice', info.price);
|
||||||
|
}
|
||||||
|
html += '<button class="btn btnActionAccent btnAppUnlock" data-role="none" type="button"><span>' + unlockText + '</span><i class="fa fa-check"></i></button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.enableSupporterUnlock) {
|
if (info.enableSupporterUnlock) {
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
|
|
||||||
html += '<button class="btn btnCancel" data-role="none" type="button"><span>' + Globalize.translate('ButtonCancel') + '</span><i class="fa fa-close"></i></button>';
|
html += '<button class="btn btnCancel" data-role="none" type="button"><span>' + Globalize.translate('ButtonCancel') + '</span><i class="fa fa-close"></i></button>';
|
||||||
|
|
||||||
html += '</form>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -155,10 +155,9 @@
|
||||||
currentDisplayingProductInfo = info;
|
currentDisplayingProductInfo = info;
|
||||||
currentDisplayingDeferred = deferred;
|
currentDisplayingDeferred = deferred;
|
||||||
|
|
||||||
$('.inAppPurchaseForm', elem).on('submit', function () {
|
$('.btnAppUnlock', elem).on('click', function () {
|
||||||
|
|
||||||
IapManager.beginPurchase(info.id);
|
IapManager.beginPurchase(info.id);
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btnCancel', elem).on('click', function () {
|
$('.btnCancel', elem).on('click', function () {
|
||||||
|
@ -166,12 +165,7 @@
|
||||||
clearCurrentDisplayingInfo();
|
clearCurrentDisplayingInfo();
|
||||||
cancelInAppPurchase();
|
cancelInAppPurchase();
|
||||||
|
|
||||||
// For testing purposes
|
deferred.reject();
|
||||||
if (!info.enableSupporterUnlock && !info.enableAppUnlock) {
|
|
||||||
deferred.resolve();
|
|
||||||
} else {
|
|
||||||
deferred.reject();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$('.btnSignInSupporter', elem).on('click', function () {
|
$('.btnSignInSupporter', elem).on('click', function () {
|
||||||
|
|
||||||
|
@ -238,9 +232,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAndroid()) {
|
if (isAndroid()) {
|
||||||
requirejs(['thirdparty/cordova/android/iap', onIapManagerLoaded]);
|
requirejs(['thirdparty/cordova/android/iap'], onIapManagerLoaded);
|
||||||
} else {
|
} else {
|
||||||
requirejs(['thirdparty/cordova/iap', onIapManagerLoaded]);
|
requirejs(['thirdparty/cordova/iap'], onIapManagerLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
Loading…
Add table
Add a link
Reference in a new issue