From 75f2c989faf7444a1108edf2aa66f1af54083135 Mon Sep 17 00:00:00 2001 From: Han Lin Yap Date: Sun, 16 Jul 2017 16:08:30 +0200 Subject: [PATCH 1/2] Typo --- Readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index 7e205d4..8562229 100644 --- a/Readme.md +++ b/Readme.md @@ -88,19 +88,19 @@ InAppUtils.purchaseProduct(productIdentifier, (error, response) => { ### Restore payments ```javascript -InAppUtils.restorePurchases((error, response)=> { +InAppUtils.restorePurchases((error, response) => { if(error) { AlertIOS.alert('itunes Error', 'Could not connect to itunes store.'); } else { AlertIOS.alert('Restore Successful', 'Successfully restores all your purchases.'); - if (response.length == 0) { - Alert.alert('No Purchases', "We didn't find any purchases to restore."); + if (response.length === 0) { + AlertIOS.alert('No Purchases', "We didn't find any purchases to restore."); return; } - response.forEach( function(purchase) { - if (purchase.productIdentifier == "com.xyz.abc") { + response.forEach((purchase) => { + if (purchase.productIdentifier === 'com.xyz.abc') { // Handle purchased product. } }); From f8b5d00ff9c7a1d746c075f4252a5c3b24d9e7fc Mon Sep 17 00:00:00 2001 From: Han Lin Yap Date: Sun, 16 Jul 2017 20:31:19 +0200 Subject: [PATCH 2/2] Replace AlertIOS with Alert --- Readme.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Readme.md b/Readme.md index 8562229..a6818f1 100644 --- a/Readme.md +++ b/Readme.md @@ -67,7 +67,7 @@ var productIdentifier = 'com.xyz.abc'; InAppUtils.purchaseProduct(productIdentifier, (error, response) => { // NOTE for v3.0: User can cancel the payment which will be available as error object here. if(response && response.productIdentifier) { - AlertIOS.alert('Purchase Successful', 'Your Transaction ID is ' + response.transactionIdentifier); + Alert.alert('Purchase Successful', 'Your Transaction ID is ' + response.transactionIdentifier); //unlock store here. } }); @@ -90,12 +90,12 @@ InAppUtils.purchaseProduct(productIdentifier, (error, response) => { ```javascript InAppUtils.restorePurchases((error, response) => { if(error) { - AlertIOS.alert('itunes Error', 'Could not connect to itunes store.'); + Alert.alert('itunes Error', 'Could not connect to itunes store.'); } else { - AlertIOS.alert('Restore Successful', 'Successfully restores all your purchases.'); + Alert.alert('Restore Successful', 'Successfully restores all your purchases.'); if (response.length === 0) { - AlertIOS.alert('No Purchases', "We didn't find any purchases to restore."); + Alert.alert('No Purchases', "We didn't find any purchases to restore."); return; } @@ -127,7 +127,7 @@ iTunes receipts are associated to the users iTunes account and can be retrieved ```javascript InAppUtils.receiptData((error, receiptData)=> { if(error) { - AlertIOS.alert('itunes Error', 'Receipt not found.'); + Alert.alert('itunes Error', 'Receipt not found.'); } else { //send to validation server } @@ -143,9 +143,9 @@ Check if in-app purchases are enabled/disabled. ```javascript InAppUtils.canMakePayments((enabled) => { if(enabled) { - AlertIOS.alert('IAP enabled'); + Alert.alert('IAP enabled'); } else { - AlertIOS.alert('IAP disabled'); + Alert.alert('IAP disabled'); } }); ```