1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/thirdparty/cordova/android/iap.js
2015-05-31 17:07:44 -04:00

55 lines
No EOL
1.2 KiB
JavaScript

(function () {
var unlockId = "com.mb.android.unlock";
var updatedProducts = [];
function updateProductInfo(id, owned) {
updatedProducts = updatedProducts.filter(function (r) {
return r.id != id;
});
updatedProducts.push({
id: id,
owned: owned
});
}
function hasPurchased(id) {
var product = getProduct(id);
return product != null && product.owned;
}
function getProduct(id) {
var products = updatedProducts.filter(function (r) {
return r.id == id;
});
return products.length ? products[0] : null;
}
function isPurchaseAvailable(id) {
return NativeIapManager.isStoreAvailable();
}
function beginPurchase(id) {
return MainActivity.beginPurchase(id);
}
function onPurchaseComplete(result) {
alert(result);
}
window.IapManager = {
isPurchaseAvailable: isPurchaseAvailable,
hasPurchased: hasPurchased,
updateProduct: updateProductInfo,
beginPurchase: beginPurchase,
onPurchaseComplete: onPurchaseComplete
};
NativeIapManager.isPurchased(unlockId, "window.IapManager.updateProduct");
})();