idwise-nfc-react-native-sdk 6.0.2 → 6.1.1

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.
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
18
 
19
- s.dependency 'IDWiseNFC', '6.0.1'
19
+ s.dependency 'IDWiseNFC', '6.1.1'
20
20
 
21
21
  s.pod_target_xcconfig = {
22
22
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
@@ -4,4 +4,4 @@ IdwiseReactNativeSdk_targetSdkVersion=34
4
4
  IdwiseReactNativeSdk_compileSdkVersion=35
5
5
  IdwiseReactNativeSdk_ndkVersion=27.1.12297006
6
6
  # Idwise SDK version
7
- idwise_sdk_version=6.0.2
7
+ idwise_sdk_version=6.1.1
@@ -60,16 +60,21 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
60
60
  IDWiseTheme.SYSTEM_DEFAULT
61
61
  }
62
62
 
63
- IDWise.initialize(clientKey, idwiseTheme) { error ->
64
- val params: WritableMap = Arguments.createMap()
65
- val errorMap = JSONObject()
66
- error?.let{
67
- errorMap.put("code", error?.code)
68
- errorMap.put("message", error?.message)
69
- }
70
- params.putString("data", errorMap.toString())
71
- sendEvent("onInitializeError", params)
72
- }
63
+ IDWise.initialize(clientKey=clientKey, theme=idwiseTheme,
64
+ onSuccess = {
65
+ val params: WritableMap = Arguments.createMap()
66
+ sendEvent("onInitializeSuccess", params)
67
+ },
68
+ onError = { error ->
69
+ val params: WritableMap = Arguments.createMap()
70
+ val errorMap = JSONObject()
71
+ error?.let{
72
+ errorMap.put("code", error?.code)
73
+ errorMap.put("message", error?.message)
74
+ }
75
+ params.putString("data", errorMap.toString())
76
+ sendEvent("onInitializeError", params)
77
+ });
73
78
  }
74
79
 
75
80
  @ReactMethod
@@ -12,7 +12,7 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
12
12
  "onJourneyStarted", "onJourneyResumed", "onJourneyCancelled", "onJourneyBlocked", "onError", "onJourneyError",
13
13
  "onJourneyCompleted",
14
14
  "onJourneySummary", "onStepCaptured", "onStepResult", "onStepCancelled", "onStepSkipped",
15
- "onInitializeError",
15
+ "onInitializeError", "onInitializeSuccess",
16
16
  "onJourneySummaryError",
17
17
  ]
18
18
  }
@@ -29,20 +29,29 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
29
29
  } else if theme == "DARK" {
30
30
  sdkTheme = .dark
31
31
  }
32
- IDWise.initialize(clientKey: clientKey, theme: sdkTheme) { err in
33
- if let error = err {
34
- do {
35
- let jsonData = try JSONEncoder().encode(error)
36
- let jsonString = String(data: jsonData, encoding: String.Encoding.utf8)
37
-
32
+ IDWise.initialize(clientKey: clientKey, theme: sdkTheme, onSuccess: {
33
+ print("SDK is Initialized")
34
+ do {
38
35
  IdwiseReactNativeSdk.emitter.sendEvent(
39
- withName: "onInitializeError",
40
- body: ["data": jsonString] as [String: Any])
41
- } catch {
36
+ withName: "onInitializeSuccess",
37
+ body: nil)
38
+ } catch {
42
39
  print(error)
43
40
  }
44
- }
45
- }
41
+ }, onError: { err in
42
+ if let error = err {
43
+ do {
44
+ let jsonData = try JSONEncoder().encode(error)
45
+ let jsonString = String(data: jsonData, encoding: String.Encoding.utf8)
46
+
47
+ IdwiseReactNativeSdk.emitter.sendEvent(
48
+ withName: "onInitializeError",
49
+ body: ["data": jsonString] as [String: Any])
50
+ } catch {
51
+ print(error)
52
+ }
53
+ }
54
+ });
46
55
 
47
56
  }
48
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idwise-nfc-react-native-sdk",
3
- "version": "6.0.2",
3
+ "version": "6.1.1",
4
4
  "description": "React-Native Wrapper for IDWise SDK",
5
5
  "main": "./lib/index.js",
6
6
  "react-native": "./src/index.js",
@@ -1,5 +1,6 @@
1
1
  export const IDWiseEvents = {
2
2
  EVENT_INITIALIZE_ERRROR: 'onInitializeError',
3
+ EVENT_INITIALIZE_SUCCESS: 'onInitializeSuccess',
3
4
 
4
5
  EVENT_JOURNEY_STARTED: 'onJourneyStarted',
5
6
  EVENT_JOURNEY_RESUMED: 'onJourneyResumed',
@@ -23,10 +23,17 @@ const eventEmitter = new NativeEventEmitter(RNIDWise);
23
23
  const setInitializeEventListeners = (idwiseInitializeCallback) => {
24
24
  console.log('IDWise - setInitializeEventListeners');
25
25
  eventEmitter.removeAllListeners(IDWiseEvents.EVENT_INITIALIZE_ERRROR);
26
+ eventEmitter.removeAllListeners(IDWiseEvents.EVENT_INITIALIZE_SUCCESS);
26
27
 
27
28
  eventEmitter.addListener(IDWiseEvents.EVENT_INITIALIZE_ERRROR, (event) => {
28
29
  idwiseInitializeCallback?.onError(JSON.parse(event.data));
29
30
  });
31
+
32
+ eventEmitter.addListener(IDWiseEvents.EVENT_INITIALIZE_SUCCESS, (event) => {
33
+ try {
34
+ idwiseInitializeCallback?.onSuccess();
35
+ } catch (error) {}
36
+ });
30
37
  };
31
38
 
32
39
  const setJourneyEventListeners = (idwiseJourneyCallback) => {