react-native-iap 9.0.2 → 9.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ import java.util.HashSet
13
13
 
14
14
  class RNIapAmazonModule(reactContext: ReactApplicationContext) :
15
15
  ReactContextBaseJavaModule(reactContext) {
16
+ var hasListener = false
16
17
  override fun getName(): String {
17
18
  return TAG
18
19
  }
@@ -21,6 +22,7 @@ class RNIapAmazonModule(reactContext: ReactApplicationContext) :
21
22
  fun initConnection(promise: Promise) {
22
23
  val context = reactApplicationContext
23
24
  PurchasingService.registerListener(context, RNIapAmazonListener(context))
25
+ hasListener = true
24
26
  // Prefetch user and purchases as per Amazon SDK documentation:
25
27
  PurchasingService.getUserData()
26
28
  PurchasingService.getPurchaseUpdates(false)
@@ -132,8 +134,10 @@ class RNIapAmazonModule(reactContext: ReactApplicationContext) :
132
134
  * We should fetch updates on resume
133
135
  */
134
136
  override fun onHostResume() {
135
- PurchasingService.getUserData()
136
- PurchasingService.getPurchaseUpdates(false)
137
+ if (hasListener) {
138
+ PurchasingService.getUserData()
139
+ PurchasingService.getPurchaseUpdates(false)
140
+ }
137
141
  }
138
142
  override fun onHostPause() {}
139
143
  override fun onHostDestroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "9.0.2",
3
+ "version": "9.0.3",
4
4
  "description": "React Native In App Purchase Module.",
5
5
  "repository": "https://github.com/dooboolab/react-native-iap",
6
6
  "author": "dooboolab <support@dooboolab.com> (https://github.com/dooboolab)",