mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
vulcanize
This commit is contained in:
parent
07df993238
commit
55e40bdcf7
52 changed files with 12309 additions and 33 deletions
61
dashboard-ui/cordova/android/iap.js
vendored
Normal file
61
dashboard-ui/cordova/android/iap.js
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
(function () {
|
||||
|
||||
var unlockId = "com.mb.android.unlock";
|
||||
var updatedProducts = [];
|
||||
|
||||
function updateProductInfo(id, owned, price) {
|
||||
|
||||
updatedProducts = updatedProducts.filter(function (r) {
|
||||
return r.id != id;
|
||||
});
|
||||
|
||||
var product = {
|
||||
id: id,
|
||||
owned: owned,
|
||||
price: price
|
||||
};
|
||||
|
||||
updatedProducts.push(product);
|
||||
|
||||
Events.trigger(IapManager, 'productupdated', [product]);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
if (result) {
|
||||
refreshPurchases();
|
||||
}
|
||||
}
|
||||
|
||||
function refreshPurchases() {
|
||||
NativeIapManager.isPurchased(unlockId, "window.IapManager.updateProduct");
|
||||
}
|
||||
|
||||
window.IapManager = {
|
||||
isPurchaseAvailable: isPurchaseAvailable,
|
||||
getProductInfo: getProduct,
|
||||
updateProduct: updateProductInfo,
|
||||
beginPurchase: beginPurchase,
|
||||
onPurchaseComplete: onPurchaseComplete
|
||||
};
|
||||
|
||||
refreshPurchases();
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue