idwise-react-native-sdk 6.0.2 → 6.1.0
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.
- package/IdwiseReactNativeSdk.podspec +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/idwisereactnativesdk/IdwiseReactNativeSdkModule.kt +16 -9
- package/ios/IdwiseReactNativeSdk.swift +12 -3
- package/package.json +1 -1
- package/src/IDWiseConstants.js +1 -0
- package/src/IDWiseEventListeners.js +7 -0
|
@@ -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 'IDWise', '6.0
|
|
19
|
+
s.dependency 'IDWise', '6.1.0'
|
|
20
20
|
s.pod_target_xcconfig = {
|
|
21
21
|
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
22
22
|
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
@@ -60,16 +60,23 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
60
60
|
IDWiseTheme.SYSTEM_DEFAULT
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
IDWise.initialize(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
IDWise.initialize(
|
|
64
|
+
clientKey=clientKey, theme=idwiseTheme,
|
|
65
|
+
onSuccess = {
|
|
66
|
+
val params: WritableMap = Arguments.createMap()
|
|
67
|
+
sendEvent("onInitializeSuccess", params)
|
|
68
|
+
},
|
|
69
|
+
onError = { error ->
|
|
70
|
+
val params: WritableMap = Arguments.createMap()
|
|
71
|
+
val errorMap = JSONObject()
|
|
72
|
+
error?.let{
|
|
73
|
+
errorMap.put("code", error?.code)
|
|
74
|
+
errorMap.put("message", error?.message)
|
|
75
|
+
}
|
|
76
|
+
params.putString("data", errorMap.toString())
|
|
77
|
+
sendEvent("onInitializeError", params)
|
|
69
78
|
}
|
|
70
|
-
|
|
71
|
-
sendEvent("onInitializeError", params)
|
|
72
|
-
}
|
|
79
|
+
);
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
@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,7 +29,16 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
|
|
|
29
29
|
} else if theme == "DARK" {
|
|
30
30
|
sdkTheme = .dark
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
IDWise.initialize(clientKey: clientKey, theme: sdkTheme, onSuccess: {
|
|
33
|
+
print("SDK is Initialized")
|
|
34
|
+
do {
|
|
35
|
+
IdwiseReactNativeSdk.emitter.sendEvent(
|
|
36
|
+
withName: "onInitializeSuccess",
|
|
37
|
+
body: nil)
|
|
38
|
+
} catch {
|
|
39
|
+
print(error)
|
|
40
|
+
}
|
|
41
|
+
}, onError: { err in
|
|
33
42
|
if let error = err {
|
|
34
43
|
do {
|
|
35
44
|
let jsonData = try JSONEncoder().encode(error)
|
|
@@ -42,7 +51,7 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
|
|
|
42
51
|
print(error)
|
|
43
52
|
}
|
|
44
53
|
}
|
|
45
|
-
}
|
|
54
|
+
})
|
|
46
55
|
|
|
47
56
|
}
|
|
48
57
|
|
package/package.json
CHANGED
package/src/IDWiseConstants.js
CHANGED
|
@@ -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) => {
|