idwise-react-native-sdk 5.7.7 → 5.7.9-alpha.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 'IDWise', '5.7.
|
|
19
|
+
s.dependency 'IDWise', '5.7.8'
|
|
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",
|
|
@@ -2,6 +2,7 @@ package com.idwisereactnativesdk
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
4
|
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import android.util.Log
|
|
5
6
|
|
|
6
7
|
import android.graphics.Bitmap
|
|
7
8
|
import android.util.Base64
|
|
@@ -9,17 +10,22 @@ import androidx.annotation.Nullable
|
|
|
9
10
|
import com.facebook.react.bridge.*
|
|
10
11
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
11
12
|
import com.fasterxml.jackson.databind.ObjectMapper
|
|
13
|
+
import com.fasterxml.jackson.databind.MapperFeature
|
|
14
|
+
import com.fasterxml.jackson.annotation.PropertyAccessor
|
|
15
|
+
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility
|
|
12
16
|
import com.idwise.sdk.IDWise
|
|
13
17
|
import com.idwise.sdk.IDWiseDynamic
|
|
14
18
|
import com.idwise.sdk.IDWiseJourneyCallbacks
|
|
15
19
|
import com.idwise.sdk.IDWiseStepCallbacks
|
|
16
20
|
import com.idwise.sdk.data.models.*
|
|
17
21
|
import java.io.ByteArrayOutputStream
|
|
22
|
+
import org.json.JSONObject;
|
|
18
23
|
|
|
19
24
|
@ReactModule(name = IdwiseReactNativeSdkModule.NAME)
|
|
20
25
|
class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationContext) :
|
|
21
26
|
NativeIdwiseReactNativeSdkSpec(reactContext) {
|
|
22
27
|
|
|
28
|
+
val objectMapper = ObjectMapper()
|
|
23
29
|
override fun getName(): String {
|
|
24
30
|
return NAME
|
|
25
31
|
}
|
|
@@ -42,6 +48,12 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
42
48
|
|
|
43
49
|
@ReactMethod
|
|
44
50
|
override fun initialize(clientKey: String, theme: String) {
|
|
51
|
+
|
|
52
|
+
objectMapper.configure(MapperFeature.AUTO_DETECT_IS_GETTERS, false);
|
|
53
|
+
objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
|
|
54
|
+
objectMapper.setVisibility(PropertyAccessor.GETTER, Visibility.NONE);
|
|
55
|
+
objectMapper.setVisibility(PropertyAccessor.SETTER, Visibility.NONE);
|
|
56
|
+
|
|
45
57
|
val idwiseTheme: IDWiseTheme = try {
|
|
46
58
|
IDWiseTheme.valueOf(theme!!)
|
|
47
59
|
} catch (e: Exception) {
|
|
@@ -50,7 +62,7 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
50
62
|
|
|
51
63
|
IDWise.initialize(clientKey, idwiseTheme) { error ->
|
|
52
64
|
val params: WritableMap = Arguments.createMap()
|
|
53
|
-
params.putString("data",
|
|
65
|
+
params.putString("data",objectMapper.writeValueAsString(error))
|
|
54
66
|
sendEvent("onInitializeError", params)
|
|
55
67
|
}
|
|
56
68
|
}
|
|
@@ -149,7 +161,7 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
149
161
|
|
|
150
162
|
val summaryResponse = JourneySummaryExposed(summary,error)
|
|
151
163
|
|
|
152
|
-
argsMap.putString("data",
|
|
164
|
+
argsMap.putString("data", objectMapper.writeValueAsString(summaryResponse))
|
|
153
165
|
sendEvent("onJourneySummary", argsMap)
|
|
154
166
|
|
|
155
167
|
}
|
|
@@ -172,37 +184,40 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
172
184
|
override fun onJourneyStarted(journeyInfo: JourneyStartedInfo) {
|
|
173
185
|
val params: WritableMap = Arguments.createMap()
|
|
174
186
|
|
|
175
|
-
params.putString("data",
|
|
187
|
+
params.putString("data", objectMapper.writeValueAsString(journeyInfo))
|
|
176
188
|
sendEvent("onJourneyStarted", params)
|
|
177
189
|
}
|
|
178
190
|
|
|
179
191
|
override fun onJourneyResumed(journeyInfo: JourneyResumedInfo) {
|
|
180
192
|
val params: WritableMap = Arguments.createMap()
|
|
181
|
-
params.putString("data",
|
|
193
|
+
params.putString("data", objectMapper.writeValueAsString(journeyInfo))
|
|
182
194
|
sendEvent("onJourneyResumed", params)
|
|
183
195
|
}
|
|
184
196
|
|
|
185
197
|
override fun onJourneyCompleted(journeyInfo: JourneyCompletedInfo) {
|
|
186
198
|
val params: WritableMap = Arguments.createMap()
|
|
187
|
-
params.putString("data",
|
|
199
|
+
params.putString("data", objectMapper.writeValueAsString(journeyInfo))
|
|
188
200
|
sendEvent("onJourneyCompleted", params)
|
|
189
201
|
}
|
|
190
202
|
|
|
191
203
|
override fun onJourneyBlocked(journeyInfo: JourneyBlockedInfo) {
|
|
192
204
|
val params: WritableMap = Arguments.createMap()
|
|
193
|
-
params.putString("data",
|
|
205
|
+
params.putString("data", objectMapper.writeValueAsString(journeyInfo))
|
|
194
206
|
sendEvent("onJourneyBlocked", params)
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
override fun onJourneyCancelled(journeyInfo: JourneyCancelledInfo) {
|
|
198
210
|
val params: WritableMap = Arguments.createMap()
|
|
199
|
-
params.putString("data",
|
|
211
|
+
params.putString("data", objectMapper.writeValueAsString(journeyInfo))
|
|
200
212
|
sendEvent("onJourneyCancelled", params)
|
|
201
213
|
}
|
|
202
214
|
|
|
203
215
|
override fun onError(error: IDWiseError) {
|
|
204
216
|
val params: WritableMap = Arguments.createMap()
|
|
205
|
-
|
|
217
|
+
val errorMap = JSONObject();
|
|
218
|
+
errorMap.put("code", error.code)
|
|
219
|
+
errorMap.put("message", error.message)
|
|
220
|
+
params.putString("data", errorMap.toString())
|
|
206
221
|
sendEvent("onJourneyError", params)
|
|
207
222
|
}
|
|
208
223
|
}
|
|
@@ -217,25 +232,25 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
217
232
|
val croppedImageBack = convertImageToBase64String(stepCapturedInfo.croppedImageBack)
|
|
218
233
|
val response = OnStepCapturedInfoExposed(stepCapturedInfo.stepId.toString(),originalImage,croppedImage,originalImageBack,croppedImageBack)
|
|
219
234
|
|
|
220
|
-
params.putString("data",
|
|
235
|
+
params.putString("data", objectMapper.writeValueAsString(response))
|
|
221
236
|
sendEvent("onStepCaptured", params)
|
|
222
237
|
}
|
|
223
238
|
|
|
224
239
|
override fun onStepResult(stepInfo:StepResultInfo) {
|
|
225
240
|
val argsMap: WritableMap = Arguments.createMap()
|
|
226
|
-
argsMap.putString("data",
|
|
241
|
+
argsMap.putString("data", objectMapper.writeValueAsString(stepInfo))
|
|
227
242
|
sendEvent("onStepResult", argsMap)
|
|
228
243
|
}
|
|
229
244
|
|
|
230
245
|
override fun onStepSkipped(stepInfo:StepSkippedInfo) {
|
|
231
246
|
val params: WritableMap = Arguments.createMap()
|
|
232
|
-
params.putString("data",
|
|
247
|
+
params.putString("data", objectMapper.writeValueAsString(stepInfo))
|
|
233
248
|
sendEvent("onStepSkipped", params)
|
|
234
249
|
}
|
|
235
250
|
|
|
236
251
|
override fun onStepCancelled(stepInfo:StepCancelledInfo) {
|
|
237
252
|
val params: WritableMap = Arguments.createMap()
|
|
238
|
-
params.putString("data",
|
|
253
|
+
params.putString("data", objectMapper.writeValueAsString(stepInfo))
|
|
239
254
|
sendEvent("onStepCancelled", params)
|
|
240
255
|
}
|
|
241
256
|
}
|