@icedevml/react-native-host-card-emulation 0.6.3 → 0.6.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.
@@ -34,6 +34,21 @@ extension Data {
34
34
 
35
35
  @objc public func acquireExclusiveNFC(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
36
36
  Task.init {
37
+ guard NFCReaderSession.readingAvailable else {
38
+ reject("err_nfc_reader_not_available", "Preflight check failed: NFCReaderSession.readingAvailable is false", nil)
39
+ return
40
+ }
41
+
42
+ guard CardSession.isSupported else {
43
+ reject("err_card_session_unsupported", "Preflight check failed: CardSession.isSupported is false", nil)
44
+ return
45
+ }
46
+
47
+ guard await CardSession.isEligible else {
48
+ reject("err_card_session_not_eligible", "Preflight check failed: CardSession.isEligible is false", nil)
49
+ return
50
+ }
51
+
37
52
  if self.presentmentIntent != nil && self.presentmentIntent!.isValid {
38
53
  reject("err_already_exists", "NFCPresentmentIntentAssertion already exists and is valid.", nil)
39
54
  return
@@ -44,8 +59,7 @@ extension Data {
44
59
  do {
45
60
  self.presentmentIntent = try await NFCPresentmentIntentAssertion.acquire()
46
61
  } catch (let error) {
47
- // TODO exact error details here and in other places as well
48
- reject("err_create_presentment", "Failed to create NFCPresentmentIntentAssertion: \(error)", nil)
62
+ reject("err_create_presentment_\(error)", "Failed to acquire NFCPresentmentIntentAssertion: \(error)", nil)
49
63
  return
50
64
  }
51
65
 
@@ -82,10 +96,11 @@ extension Data {
82
96
  do {
83
97
  self.cardSession = try await CardSession()
84
98
  } catch (let error) {
85
- reject("err_create_card_session", "Failed to create CardSession(): \(error)", nil)
99
+ reject("err_create_card_session_\(error)", "Failed to create CardSession: \(error)", nil)
86
100
  return
87
101
  }
88
102
 
103
+ self.cardSessionInvalidated = false
89
104
  resolve(nil)
90
105
 
91
106
  do {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icedevml/react-native-host-card-emulation",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Host Card Emulation (HCE) React Native Turbo Module for iOS and Android platforms.",
5
5
  "react-native": "js/index",
6
6
  "source": "js/index",