react-native-iap 12.10.3 → 12.10.4

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.
@@ -69,16 +69,29 @@ class RNIapModule(
69
69
  promise.safeReject(PromiseUtils.E_NOT_PREPARED, "Unable to auto-initialize connection")
70
70
  }
71
71
  } else {
72
+ promise.safeReject(PromiseUtils.E_UNKNOWN, "ensureConnection - incorrect parameter in resolve")
72
73
  Log.i(TAG, "Incorrect parameter in resolve")
73
74
  }
74
75
  },
75
76
  {
77
+ var errorCode: String? = null
78
+ var errorMessage: String? = null
76
79
  if (it.size > 1 && it[0] is String && it[1] is String) {
80
+ errorCode = it[0] as String
81
+ errorMessage = it[1] as String
82
+ } else if (it.isNotEmpty() && it[0] is WritableNativeMap) {
83
+ val errorMap = it[0] as WritableNativeMap
84
+ errorCode = errorMap.getString("code")
85
+ errorMessage = errorMap.getString("message")
86
+ }
87
+
88
+ if (errorCode is String && errorMessage is String) {
77
89
  promise.safeReject(
78
- it[0] as String,
79
- it[1] as String,
90
+ errorCode,
91
+ errorMessage,
80
92
  )
81
93
  } else {
94
+ promise.safeReject(PromiseUtils.E_UNKNOWN, "ensureConnection - incorrect parameter in reject")
82
95
  Log.i(TAG, "Incorrect parameters in reject")
83
96
  }
84
97
  },
@@ -903,20 +903,22 @@ class RNIapIosSk2iOS15: Sk2Delegate {
903
903
  reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
904
904
  ) {
905
905
  #if !os(tvOS)
906
- guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
907
- !ProcessInfo.processInfo.isiOSAppOnMac else {
908
- return
909
- }
906
+ DispatchQueue.main.async {
907
+ guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
908
+ !ProcessInfo.processInfo.isiOSAppOnMac else {
909
+ return
910
+ }
910
911
 
911
- Task {
912
- do {
913
- try await AppStore.showManageSubscriptions(in: scene)
914
- } catch {
915
- print("Error:(error)")
912
+ Task {
913
+ do {
914
+ try await AppStore.showManageSubscriptions(in: scene)
915
+ } catch {
916
+ print("Error:(error)")
917
+ }
916
918
  }
917
- }
918
919
 
919
- resolve(nil)
920
+ resolve(nil)
921
+ }
920
922
  #else
921
923
  reject(IapErrors.E_USER_CANCELLED.rawValue, "This method is not available on tvOS", nil)
922
924
  #endif
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "12.10.3",
3
+ "version": "12.10.4",
4
4
  "description": "React Native In App Purchase Module.",
5
5
  "repository": "https://github.com/dooboolab-community/react-native-iap",
6
6
  "author": "dooboolab <support@dooboolab.com> (https://github.com/dooboolab-community)",
@@ -86,8 +86,8 @@
86
86
  "@types/jest": "29.5.0",
87
87
  "@types/react": "*",
88
88
  "@types/react-native": "*",
89
- "@typescript-eslint/eslint-plugin": "5.56.0",
90
- "@typescript-eslint/parser": "5.56.0",
89
+ "@typescript-eslint/eslint-plugin": "5.57.1",
90
+ "@typescript-eslint/parser": "5.57.1",
91
91
  "babel-jest": "29.5.0",
92
92
  "eslint": "8.36.0",
93
93
  "eslint-config-prettier": "8.8.0",
@@ -106,14 +106,14 @@
106
106
  "ts-jest": "29.0.5",
107
107
  "typedoc": "^0.23.14",
108
108
  "typedoc-plugin-markdown": "^3.14.0",
109
- "typescript": "5.0.2"
109
+ "typescript": "5.0.3"
110
110
  },
111
111
  "peerDependencies": {
112
112
  "react": ">=16.13.1",
113
113
  "react-native": ">=0.65.1"
114
114
  },
115
115
  "resolutions": {
116
- "@types/react": "17.0.53",
116
+ "@types/react": "17.0.56",
117
117
  "@types/react-native": "0.68.2"
118
118
  },
119
119
  "dependencies": {