update cordova scripts
This commit is contained in:
parent
48a576778f
commit
6235ee51eb
3 changed files with 183 additions and 123 deletions
50
dashboard-ui/thirdparty/cordova/android/iap.js
vendored
Normal file
50
dashboard-ui/thirdparty/cordova/android/iap.js
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
(function () {
|
||||
|
||||
var unlockId = "premiumunlock";
|
||||
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 NativeIapManager.beginPurchase(id);
|
||||
}
|
||||
|
||||
window.IapManager = {
|
||||
isPurchaseAvailable: isPurchaseAvailable,
|
||||
hasPurchased: hasPurchased,
|
||||
updateProduct: updateProductInfo,
|
||||
beginPurchase: beginPurchase
|
||||
};
|
||||
|
||||
NativeIapManager.isPurchased(unlockId, "window.IapManager.updateProduct");
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue