MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / removeAds

Function removeAds

src/lib/removeAds.js:9–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7 * @returns {Promise<void>}
8 */
9export default function removeAds() {
10 return new Promise((resolve, reject) => {
11 iap.getProducts(["acode_pro_new"], (products) => {
12 const [product] = products;
13
14 iap.setPurchaseUpdatedListener(...purchaseListener(onpurchase, reject));
15
16 iap.purchase(
17 product.productId,
18 (code) => {
19 // ignore
20 },
21 (err) => {
22 alert(strings.error, err);
23 },
24 );
25 });
26
27 function onpurchase() {
28 resolve(null);
29 hideAd(true);
30 // For caching, later verified so no need to worry about
31 localStorage.setItem("acode_pro", "true");
32 config.HAS_PRO = true;
33 toast(strings["thank you :)"]);
34 }
35 });
36}

Callers 2

purchaseRemoveAdsFunction · 0.85
callbackFunction · 0.85

Calls 5

purchaseListenerFunction · 0.85
alertFunction · 0.85
getProductsMethod · 0.65
purchaseMethod · 0.65

Tested by

no test coverage detected