uqudosdk-react-native 2.5.3 → 2.6.0-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.
- package/CHANGELOG.md +17 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sdk/uqudoid/UqudoIdModule.java +150 -47
- package/ios/UqudoId.m +442 -293
- package/package.json +1 -1
- package/uqudoBuilder/uqudo.js +110 -2
- package/uqudosdk-react-native.podspec +1 -1
package/ios/UqudoId.m
CHANGED
|
@@ -12,7 +12,7 @@ RCT_EXPORT_METHOD(init:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejec
|
|
|
12
12
|
tracer = [[MyTracer alloc] init];
|
|
13
13
|
tracer.emitter = self;
|
|
14
14
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
15
|
-
|
|
15
|
+
[[UQBuilderController alloc] initWithTracer:tracer];
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -27,182 +27,184 @@ RCT_EXPORT_METHOD(enroll:(NSString *)enrollObj resolver:(RCTPromiseResolveBlock)
|
|
|
27
27
|
|
|
28
28
|
@try {
|
|
29
29
|
if (enrollObj != nil && [enrollObj length] > 0) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (json[@"isRootedDeviceAllowed"]) {
|
|
47
|
-
enrollmentBuilder.isRootedDeviceAllowed = [[json valueForKey:@"isRootedDeviceAllowed"] boolValue];
|
|
48
|
-
}
|
|
49
|
-
if (json[@"isReturnDataForIncompleteSession"]) {
|
|
50
|
-
enrollmentBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
|
|
51
|
-
}
|
|
52
|
-
if (facialRecognitionSpecification) {
|
|
53
|
-
// Enable help page for face recognition
|
|
54
|
-
enrollmentBuilder.enableFacialRecognition = TRUE;
|
|
55
|
-
|
|
56
|
-
// Enable enroll face option
|
|
57
|
-
if (facialRecognitionSpecification[@"enrollFace"]) {
|
|
58
|
-
enrollmentBuilder.enrollFace = [[facialRecognitionSpecification valueForKey:@"enrollFace"] boolValue];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (facialRecognitionSpecification[@"scanMinimumMatchLevel"]) {
|
|
62
|
-
enrollmentBuilder.scanMinimumMatchLevel = [[facialRecognitionSpecification valueForKey:@"scanMinimumMatchLevel"] integerValue];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (facialRecognitionSpecification[@"readMinimumMatchLevel"]) {
|
|
66
|
-
enrollmentBuilder.readMinimumMatchLevel = [[facialRecognitionSpecification valueForKey:@"readMinimumMatchLevel"] integerValue];
|
|
67
|
-
}
|
|
68
|
-
if (facialRecognitionSpecification[@"maxAttempts"]) {
|
|
69
|
-
int maxAttempts = [[facialRecognitionSpecification valueForKey:@"maxAttempts"] intValue];
|
|
70
|
-
if (maxAttempts > 0) {
|
|
71
|
-
enrollmentBuilder.facialRecognitionMaxAttempts = maxAttempts;
|
|
72
|
-
}
|
|
30
|
+
UQBuilderController *builderController = [UQBuilderController defaultBuilder];
|
|
31
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
32
|
+
NSData* data = [enrollObj dataUsingEncoding:NSUTF8StringEncoding];
|
|
33
|
+
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
34
|
+
|
|
35
|
+
NSDictionary* documentList = json[@"documentList"];
|
|
36
|
+
NSDictionary* facialRecognitionSpecification = json[@"facialRecognitionSpecification"];
|
|
37
|
+
NSDictionary* backgroundCheckConfiguration = json[@"backgroundCheckConfiguration"];
|
|
38
|
+
NSDictionary* lookupConfiguration = json[@"lookupConfiguration"];
|
|
39
|
+
|
|
40
|
+
// Config enrollment builder
|
|
41
|
+
UQEnrollmentBuilder *enrollmentBuilder = [[UQEnrollmentBuilder alloc] init];
|
|
42
|
+
enrollmentBuilder.authorizationToken = json[@"authorizationToken"];
|
|
43
|
+
NSString* nonce = json[@"nonce"];
|
|
44
|
+
if (nonce && nonce.length > 0) {
|
|
45
|
+
enrollmentBuilder.nonce = nonce;
|
|
73
46
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
NSMutableArray *lookupDocumentTypes = [[NSMutableArray alloc] init];
|
|
78
|
-
if(lookupConfiguration[@"documentList"]){
|
|
79
|
-
for (NSString *document in lookupConfiguration[@"documentList"]) {
|
|
80
|
-
UQDocumentConfig *documentConfig = [[UQDocumentConfig alloc] initWithDocumentTypeName:document];
|
|
81
|
-
[lookupDocumentTypes addObject:[NSNumber numberWithInteger:[documentConfig documentType]]];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (lookupDocumentTypes.count) {
|
|
85
|
-
[enrollmentBuilder enableLookup:lookupDocumentTypes];
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
[enrollmentBuilder enableLookup];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (backgroundCheckConfiguration) {
|
|
92
|
-
BOOL isDisableConsent = FALSE;
|
|
93
|
-
BackgroundCheckType type = RDC;
|
|
94
|
-
if (backgroundCheckConfiguration[@"disableConsent"]) {
|
|
95
|
-
isDisableConsent = [[backgroundCheckConfiguration valueForKey:@"disableConsent"] boolValue];
|
|
47
|
+
NSString* sessionId = json[@"sessionId"];
|
|
48
|
+
if (sessionId && sessionId.length > 0) {
|
|
49
|
+
[enrollmentBuilder setSessionID:sessionId];
|
|
96
50
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
51
|
+
NSString* userIdentifier = json[@"userIdentifier"];
|
|
52
|
+
if (userIdentifier && userIdentifier.length > 0) {
|
|
53
|
+
NSUUID *userID = [[NSUUID alloc] initWithUUIDString:userIdentifier];
|
|
54
|
+
if (userID) {
|
|
55
|
+
[enrollmentBuilder setUserIdentifier:userID];
|
|
102
56
|
}
|
|
103
57
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
isMonitoringEnabled = [[backgroundCheckConfiguration valueForKey:@"monitoringEnabled"] boolValue];
|
|
58
|
+
if (json[@"isReturnDataForIncompleteSession"]) {
|
|
59
|
+
enrollmentBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
|
|
107
60
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
61
|
+
if (facialRecognitionSpecification) {
|
|
62
|
+
// Enable help page for face recognition
|
|
63
|
+
enrollmentBuilder.enableFacialRecognition = TRUE;
|
|
64
|
+
|
|
65
|
+
// Enable enroll face option
|
|
66
|
+
if (facialRecognitionSpecification[@"enrollFace"]) {
|
|
67
|
+
enrollmentBuilder.enrollFace = [[facialRecognitionSpecification valueForKey:@"enrollFace"] boolValue];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (facialRecognitionSpecification[@"scanMinimumMatchLevel"]) {
|
|
71
|
+
enrollmentBuilder.scanMinimumMatchLevel = [[facialRecognitionSpecification valueForKey:@"scanMinimumMatchLevel"] integerValue];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (facialRecognitionSpecification[@"readMinimumMatchLevel"]) {
|
|
75
|
+
enrollmentBuilder.readMinimumMatchLevel = [[facialRecognitionSpecification valueForKey:@"readMinimumMatchLevel"] integerValue];
|
|
76
|
+
}
|
|
77
|
+
if (facialRecognitionSpecification[@"maxAttempts"]) {
|
|
78
|
+
int maxAttempts = [[facialRecognitionSpecification valueForKey:@"maxAttempts"] intValue];
|
|
79
|
+
if (maxAttempts > 0) {
|
|
80
|
+
enrollmentBuilder.facialRecognitionMaxAttempts = maxAttempts;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
119
83
|
}
|
|
120
84
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
85
|
+
if(lookupConfiguration){
|
|
86
|
+
NSMutableArray *lookupDocumentTypes = [[NSMutableArray alloc] init];
|
|
87
|
+
if(lookupConfiguration[@"documentList"]){
|
|
88
|
+
for (NSString *document in lookupConfiguration[@"documentList"]) {
|
|
89
|
+
UQDocumentConfig *documentConfig = [[UQDocumentConfig alloc] initWithDocumentTypeName:document];
|
|
90
|
+
[lookupDocumentTypes addObject:[NSNumber numberWithInteger:[documentConfig documentType]]];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (lookupDocumentTypes.count) {
|
|
94
|
+
[enrollmentBuilder enableLookup:lookupDocumentTypes];
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
[enrollmentBuilder enableLookup];
|
|
98
|
+
}
|
|
124
99
|
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
100
|
+
if (backgroundCheckConfiguration) {
|
|
101
|
+
BOOL isDisableConsent = FALSE;
|
|
102
|
+
BackgroundCheckType type = RDC;
|
|
103
|
+
if (backgroundCheckConfiguration[@"disableConsent"]) {
|
|
104
|
+
isDisableConsent = [[backgroundCheckConfiguration valueForKey:@"disableConsent"] boolValue];
|
|
105
|
+
}
|
|
106
|
+
if (backgroundCheckConfiguration[@"backgroudCheckType"]) {
|
|
107
|
+
if ([backgroundCheckConfiguration[@"backgroudCheckType"] isEqual:@"RDC"]) {
|
|
108
|
+
type = RDC;
|
|
109
|
+
} else {
|
|
110
|
+
type = DOW_JONES;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
BOOL isMonitoringEnabled = FALSE;
|
|
114
|
+
if (backgroundCheckConfiguration[@"monitoringEnabled"]) {
|
|
115
|
+
isMonitoringEnabled = [[backgroundCheckConfiguration valueForKey:@"monitoringEnabled"] boolValue];
|
|
116
|
+
}
|
|
117
|
+
BOOL isSkipView = FALSE;
|
|
118
|
+
if (backgroundCheckConfiguration[@"skipView"]) {
|
|
119
|
+
isSkipView = [[backgroundCheckConfiguration valueForKey:@"skipView"] boolValue];
|
|
120
|
+
}
|
|
121
|
+
[enrollmentBuilder enableBackgroundCheck:isDisableConsent type:type monitoring:isMonitoringEnabled skipView:isSkipView];
|
|
127
122
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
for (NSDictionary *document in documentList) {
|
|
124
|
+
NSString* documentType = document[@"documentType"];
|
|
125
|
+
UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
126
|
+
if(documentObject.documentType == UNSPECIFY){
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
UQScanConfig *scanConfig = [[UQScanConfig alloc] init];
|
|
131
|
+
if (document[@"isHelpPageDisabled"]) {
|
|
132
|
+
scanConfig.disableHelpPage = [[document valueForKey:@"isHelpPageDisabled"] boolValue];
|
|
133
|
+
}
|
|
134
|
+
if (document[@"faceScanMinimumMatchLevel"]) {
|
|
135
|
+
scanConfig.faceMinimumMatchLevel = [[document valueForKey:@"faceScanMinimumMatchLevel"] intValue];
|
|
136
|
+
}
|
|
137
|
+
if (document[@"minimumAge"]) {
|
|
138
|
+
int minimumAge = [[document valueForKey:@"minimumAge"] intValue];
|
|
139
|
+
if (minimumAge > 0) {
|
|
140
|
+
documentObject.enableAgeVerification = minimumAge;
|
|
141
|
+
}
|
|
132
142
|
}
|
|
133
|
-
}
|
|
134
143
|
|
|
135
|
-
|
|
136
|
-
|
|
144
|
+
BOOL isEnableFrontSideReview = false;
|
|
145
|
+
BOOL isEnableBackSideReview = false;
|
|
137
146
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
if (document[@"isFrontSideReviewEnabled"]) {
|
|
148
|
+
isEnableFrontSideReview = [[document valueForKey:@"isFrontSideReviewEnabled"] boolValue];
|
|
149
|
+
}
|
|
150
|
+
if (document[@"isBackSideReviewEnabled"]) {
|
|
151
|
+
isEnableBackSideReview = [[document valueForKey:@"isBackSideReviewEnabled"] boolValue];
|
|
152
|
+
}
|
|
153
|
+
[scanConfig enableScanReview:isEnableFrontSideReview backSide:isEnableBackSideReview];
|
|
154
|
+
if (document[@"isUploadEnabled"]) {
|
|
155
|
+
scanConfig.enableUpload = [[document valueForKey:@"isUploadEnabled"] boolValue];
|
|
156
|
+
}
|
|
157
|
+
documentObject.scan = scanConfig;
|
|
149
158
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
159
|
+
if (document[@"isExpiredDocumentValidateDisabled"]) {
|
|
160
|
+
documentObject.disableExpiryValidation = [[document valueForKey:@"isExpiredDocumentValidateDisabled"] boolValue];
|
|
161
|
+
}
|
|
153
162
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
if (document[@"isUserDataReviewDisabled"]) {
|
|
164
|
+
documentObject.disableUserDataReview = [[document valueForKey:@"isUserDataReviewDisabled"] boolValue];
|
|
165
|
+
}
|
|
157
166
|
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
if (document[@"readingConfiguration"]) {
|
|
168
|
+
NSDictionary *readingConfiguration = document[@"readingConfiguration"];
|
|
160
169
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
UQReadingConfig *readConfig = [[UQReadingConfig alloc] init];
|
|
171
|
+
readConfig.enableReading = TRUE;
|
|
172
|
+
if (readingConfiguration[@"forceReading"]) {
|
|
173
|
+
[readConfig forceReading:[[readingConfiguration valueForKey:@"forceReading"] boolValue]];
|
|
174
|
+
}
|
|
175
|
+
if (readingConfiguration[@"forceReadingIfSupported"]) {
|
|
176
|
+
[readConfig forceReadingIfSupported:[[readingConfiguration valueForKey:@"forceReadingIfSupported"] boolValue]];
|
|
177
|
+
}
|
|
178
|
+
if (document[@"faceReadMinimumMatchLevel"]) {
|
|
179
|
+
readConfig.faceMinimumMatchLevel = [[document valueForKey:@"faceReadMinimumMatchLevel"] intValue];
|
|
180
|
+
}
|
|
181
|
+
if (readingConfiguration[@"timeoutInSeconds"]) {
|
|
182
|
+
int timeoutInSeconds = [[readingConfiguration valueForKey:@"timeoutInSeconds"] intValue];
|
|
183
|
+
if (timeoutInSeconds > 0) {
|
|
184
|
+
readConfig.forceReadingTimeout = timeoutInSeconds;
|
|
185
|
+
}
|
|
176
186
|
}
|
|
177
|
-
}
|
|
178
187
|
|
|
179
|
-
|
|
180
|
-
|
|
188
|
+
documentObject.reading = readConfig;
|
|
189
|
+
}
|
|
181
190
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
[enrollmentBuilder add:documentObject];
|
|
192
|
+
}
|
|
193
|
+
builderController.delegate = self;
|
|
194
|
+
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
|
195
|
+
builderController.appViewController = rootViewController;
|
|
196
|
+
[builderController setEnrollment:enrollmentBuilder];
|
|
197
|
+
NSInteger appearanceMode = SYSTEM;
|
|
198
|
+
if (json[@"appearanceMode"]) {
|
|
199
|
+
if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
|
|
200
|
+
appearanceMode = LIGHT;
|
|
201
|
+
} else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
|
|
202
|
+
appearanceMode = DARK;
|
|
203
|
+
}
|
|
194
204
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// accessToken reuire, if no token the UQExceptionInvalidToken will throw
|
|
199
|
-
|
|
200
|
-
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
201
|
-
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
|
202
|
-
UIViewController *rootViewController = window.rootViewController;
|
|
203
|
-
builderController.appViewController = rootViewController;
|
|
204
|
-
[builderController performEnrollmentWithToken:authorizationToken optionNonce:nonce];
|
|
205
|
-
});
|
|
205
|
+
[builderController setAppearanceMode:appearanceMode];
|
|
206
|
+
});
|
|
207
|
+
[builderController performEnrollment];
|
|
206
208
|
} else {
|
|
207
209
|
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
208
210
|
status.statusCode = UNEXPECTED_ERROR;
|
|
@@ -221,15 +223,6 @@ RCT_EXPORT_METHOD(enroll:(NSString *)enrollObj resolver:(RCTPromiseResolveBlock)
|
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
|
|
224
|
-
- (void) didEnrollmentFailWithError:(NSError *)error {
|
|
225
|
-
NSLog(@"Error %ld %@", (long)error.code, error.localizedDescription);
|
|
226
|
-
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
227
|
-
status.statusCode = UNEXPECTED_ERROR;
|
|
228
|
-
status.message = error.localizedDescription;
|
|
229
|
-
status.statusTask = -1;
|
|
230
|
-
[self sendPluginError:status];
|
|
231
|
-
}
|
|
232
|
-
|
|
233
226
|
- (void) didEnrollmentCompleteWithInfo:(NSString *)jwsString {
|
|
234
227
|
NSMutableDictionary *jsonResults = [[NSMutableDictionary alloc]init];
|
|
235
228
|
[jsonResults setValue:jwsString forKey:@"result"];
|
|
@@ -240,54 +233,54 @@ RCT_EXPORT_METHOD(enroll:(NSString *)enrollObj resolver:(RCTPromiseResolveBlock)
|
|
|
240
233
|
[self sendPluginError:status];
|
|
241
234
|
}
|
|
242
235
|
|
|
236
|
+
- (void)didEnrollmentFailWithError:(NSError *)error {
|
|
237
|
+
// IGNORE, deprecated in the SDK
|
|
238
|
+
}
|
|
239
|
+
|
|
243
240
|
RCT_EXPORT_METHOD(recover:(NSString *)recoverObj resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
244
241
|
self.promiseResolve = resolve;
|
|
245
242
|
self.promiseReject = reject;
|
|
246
243
|
@try {
|
|
247
244
|
if (recoverObj != nil && [recoverObj length] > 0) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
accountRecoveryBuilder.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
accountRecoveryBuilder.minimumMatchLevel = [[json valueForKey:@"minimumMatchLevel"] intValue];
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (json[@"maxAttempts"]) {
|
|
263
|
-
int maxAttempts = [[json valueForKey:@"maxAttempts"] intValue];
|
|
264
|
-
if (maxAttempts > 0) {
|
|
265
|
-
accountRecoveryBuilder.maxAttempts = maxAttempts;
|
|
245
|
+
UQBuilderController *builderController = [UQBuilderController defaultBuilder];
|
|
246
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
247
|
+
NSData *data = [recoverObj dataUsingEncoding:NSUTF8StringEncoding];
|
|
248
|
+
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
249
|
+
|
|
250
|
+
UQAccountRecoveryBuilder *accountRecoveryBuilder = [[UQAccountRecoveryBuilder alloc] init];
|
|
251
|
+
accountRecoveryBuilder.authorizationToken = json[@"token"];
|
|
252
|
+
accountRecoveryBuilder.enrollmentIdentifier = json[@"enrollmentIdentifier"];
|
|
253
|
+
accountRecoveryBuilder.nonce = json[@"nonce"];
|
|
254
|
+
if (json[@"minimumMatchLevel"]) {
|
|
255
|
+
accountRecoveryBuilder.minimumMatchLevel = [[json valueForKey:@"minimumMatchLevel"] intValue];
|
|
266
256
|
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (json[@"isReturnDataForIncompleteSession"]) {
|
|
270
|
-
accountRecoveryBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
|
|
271
|
-
}
|
|
272
257
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
NSInteger appearanceMode = SYSTEM;
|
|
280
|
-
if (json[@"appearanceMode"]) {
|
|
281
|
-
if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
|
|
282
|
-
appearanceMode = LIGHT;
|
|
283
|
-
} else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
|
|
284
|
-
appearanceMode = DARK;
|
|
258
|
+
if (json[@"maxAttempts"]) {
|
|
259
|
+
int maxAttempts = [[json valueForKey:@"maxAttempts"] intValue];
|
|
260
|
+
if (maxAttempts > 0) {
|
|
261
|
+
accountRecoveryBuilder.maxAttempts = maxAttempts;
|
|
262
|
+
}
|
|
285
263
|
}
|
|
286
|
-
}
|
|
287
|
-
[builderController setAppearanceMode:appearanceMode];
|
|
288
264
|
|
|
265
|
+
if (json[@"isReturnDataForIncompleteSession"]) {
|
|
266
|
+
accountRecoveryBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
|
|
267
|
+
}
|
|
289
268
|
|
|
269
|
+
builderController.delegate = self;
|
|
270
|
+
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
|
271
|
+
builderController.appViewController = rootViewController;
|
|
272
|
+
[builderController setAccountRecovery:accountRecoveryBuilder];
|
|
290
273
|
|
|
274
|
+
NSInteger appearanceMode = SYSTEM;
|
|
275
|
+
if (json[@"appearanceMode"]) {
|
|
276
|
+
if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
|
|
277
|
+
appearanceMode = LIGHT;
|
|
278
|
+
} else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
|
|
279
|
+
appearanceMode = DARK;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
[builderController setAppearanceMode:appearanceMode];
|
|
283
|
+
});
|
|
291
284
|
[builderController performAccountRecovery];
|
|
292
285
|
} else {
|
|
293
286
|
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
@@ -313,17 +306,12 @@ RCT_EXPORT_METHOD(recover:(NSString *)recoverObj resolver:(RCTPromiseResolveBloc
|
|
|
313
306
|
self.promiseResolve(jsonResults);
|
|
314
307
|
}
|
|
315
308
|
|
|
316
|
-
- (void)
|
|
317
|
-
NSLog(@"Error %ld %@", (long)error.code, error.localizedDescription);
|
|
318
|
-
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
319
|
-
status.statusCode = UNEXPECTED_ERROR;
|
|
320
|
-
status.message = error.localizedDescription;
|
|
321
|
-
status.statusTask = -1;
|
|
309
|
+
- (void)didAccountRecoveryIncompleteWithStatus:(UQSessionStatus *)status {
|
|
322
310
|
[self sendPluginError:status];
|
|
323
311
|
}
|
|
324
312
|
|
|
325
|
-
- (void)
|
|
326
|
-
|
|
313
|
+
- (void)didAccountRecoveryFailWithError:(nonnull NSError *)error {
|
|
314
|
+
// IGNORE, deprecated in the SDK
|
|
327
315
|
}
|
|
328
316
|
|
|
329
317
|
RCT_EXPORT_METHOD(faceSession:(NSString *)configuration resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
@@ -331,47 +319,44 @@ RCT_EXPORT_METHOD(faceSession:(NSString *)configuration resolver:(RCTPromiseReso
|
|
|
331
319
|
self.promiseReject = reject;
|
|
332
320
|
@try {
|
|
333
321
|
if (configuration != nil && [configuration length] > 0) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
faceSessionBuilder.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
faceSessionBuilder.maxAttempts = maxAttempts;
|
|
322
|
+
UQBuilderController *builderController = [UQBuilderController defaultBuilder];
|
|
323
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
324
|
+
NSData *data = [configuration dataUsingEncoding:NSUTF8StringEncoding];
|
|
325
|
+
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
326
|
+
|
|
327
|
+
UQFaceSessionBuilder *faceSessionBuilder = [[UQFaceSessionBuilder alloc] init];
|
|
328
|
+
faceSessionBuilder.authorizationToken = json[@"token"];
|
|
329
|
+
faceSessionBuilder.sessionId = json[@"sessionId"];
|
|
330
|
+
faceSessionBuilder.nonce = json[@"nonce"];
|
|
331
|
+
if (json[@"minimumMatchLevel"]) {
|
|
332
|
+
faceSessionBuilder.minimumMatchLevel = [[json valueForKey:@"minimumMatchLevel"] intValue];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (json[@"maxAttempts"]) {
|
|
336
|
+
int maxAttempts = [[json valueForKey:@"maxAttempts"] intValue];
|
|
337
|
+
if (maxAttempts > 0) {
|
|
338
|
+
faceSessionBuilder.maxAttempts = maxAttempts;
|
|
352
339
|
}
|
|
353
|
-
|
|
340
|
+
}
|
|
354
341
|
|
|
355
|
-
|
|
342
|
+
if (json[@"isReturnDataForIncompleteSession"]) {
|
|
356
343
|
faceSessionBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
[builderController setAppearanceMode:appearanceMode];
|
|
374
|
-
|
|
344
|
+
}
|
|
345
|
+
builderController.delegate = self;
|
|
346
|
+
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
|
347
|
+
builderController.appViewController = rootViewController;
|
|
348
|
+
[builderController setFaceSession:faceSessionBuilder];
|
|
349
|
+
|
|
350
|
+
NSInteger appearanceMode = SYSTEM;
|
|
351
|
+
if (json[@"appearanceMode"]) {
|
|
352
|
+
if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
|
|
353
|
+
appearanceMode = LIGHT;
|
|
354
|
+
} else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
|
|
355
|
+
appearanceMode = DARK;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
[builderController setAppearanceMode:appearanceMode];
|
|
359
|
+
});
|
|
375
360
|
[builderController performFaceSession];
|
|
376
361
|
} else {
|
|
377
362
|
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
@@ -397,28 +382,135 @@ RCT_EXPORT_METHOD(faceSession:(NSString *)configuration resolver:(RCTPromiseReso
|
|
|
397
382
|
self.promiseResolve(jsonResults);
|
|
398
383
|
}
|
|
399
384
|
|
|
400
|
-
- (void)
|
|
401
|
-
NSLog(@"Error %ld %@", (long)error.code, error.localizedDescription);
|
|
402
|
-
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
403
|
-
status.statusCode = UNEXPECTED_ERROR;
|
|
404
|
-
status.message = error.localizedDescription;
|
|
405
|
-
status.statusTask = -1;
|
|
385
|
+
- (void)didFaceSessionIncompleteWithStatus:(UQSessionStatus *)status {
|
|
406
386
|
[self sendPluginError:status];
|
|
407
387
|
}
|
|
408
388
|
|
|
409
|
-
- (void)
|
|
410
|
-
|
|
389
|
+
- (void)didFaceSessionFailWithError:(nonnull NSError *)error {
|
|
390
|
+
// IGNORE, deprecated in the SDK
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
RCT_EXPORT_METHOD(lookup:(NSString *)lookupObj resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
394
|
+
self.promiseResolve = resolve;
|
|
395
|
+
self.promiseReject = reject;
|
|
396
|
+
|
|
397
|
+
@try {
|
|
398
|
+
if (lookupObj != nil && [lookupObj length] > 0) {
|
|
399
|
+
UQBuilderController *builderController = [UQBuilderController defaultBuilder];
|
|
400
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
401
|
+
NSData* data = [lookupObj dataUsingEncoding:NSUTF8StringEncoding];
|
|
402
|
+
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
403
|
+
|
|
404
|
+
UQLookupBuilder *lookupBuilder = [[UQLookupBuilder alloc] init];
|
|
405
|
+
lookupBuilder.authorizationToken = json[@"authorizationToken"];
|
|
406
|
+
NSString* nonce = json[@"nonce"];
|
|
407
|
+
if (nonce && nonce.length > 0) {
|
|
408
|
+
lookupBuilder.nonce = nonce;
|
|
409
|
+
}
|
|
410
|
+
NSString* documentType = json[@"documentType"];
|
|
411
|
+
UQDocumentConfig *documentConfig = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
412
|
+
[lookupBuilder setDocumentType:documentConfig.documentType];
|
|
413
|
+
NSString* sessionId = json[@"sessionId"];
|
|
414
|
+
if (sessionId && sessionId.length > 0) {
|
|
415
|
+
[lookupBuilder setSessionID:sessionId];
|
|
416
|
+
}
|
|
417
|
+
NSString* userIdentifier = json[@"userIdentifier"];
|
|
418
|
+
if (userIdentifier && userIdentifier.length > 0) {
|
|
419
|
+
NSUUID *userID = [[NSUUID alloc] initWithUUIDString:userIdentifier];
|
|
420
|
+
if (userID) {
|
|
421
|
+
[lookupBuilder setUserIdentifier:userID];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (json[@"isReturnDataForIncompleteSession"]) {
|
|
425
|
+
lookupBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
|
|
426
|
+
}
|
|
427
|
+
NSDictionary* facialRecognitionSpecification = json[@"facialRecognitionSpecification"];
|
|
428
|
+
if (facialRecognitionSpecification) {
|
|
429
|
+
// Enable help page for face recognition
|
|
430
|
+
lookupBuilder.enableFacialRecognition = TRUE;
|
|
431
|
+
// Enable enroll face option
|
|
432
|
+
if (facialRecognitionSpecification[@"enrollFace"]) {
|
|
433
|
+
lookupBuilder.enrollFace = [[facialRecognitionSpecification valueForKey:@"enrollFace"] boolValue];
|
|
434
|
+
}
|
|
435
|
+
if (facialRecognitionSpecification[@"lookupMinimumMatchLevel"]) {
|
|
436
|
+
lookupBuilder.facialRecognitionMinimumMatchLevel = [[facialRecognitionSpecification valueForKey:@"lookupMinimumMatchLevel"] integerValue];
|
|
437
|
+
}
|
|
438
|
+
if (facialRecognitionSpecification[@"maxAttempts"]) {
|
|
439
|
+
int maxAttempts = [[facialRecognitionSpecification valueForKey:@"maxAttempts"] intValue];
|
|
440
|
+
if (maxAttempts > 0) {
|
|
441
|
+
lookupBuilder.facialRecognitionMaxAttempts = maxAttempts;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
NSDictionary* backgroundCheckConfiguration = json[@"backgroundCheckConfiguration"];
|
|
446
|
+
if (backgroundCheckConfiguration) {
|
|
447
|
+
BOOL isDisableConsent = FALSE;
|
|
448
|
+
BackgroundCheckType type = RDC;
|
|
449
|
+
if (backgroundCheckConfiguration[@"disableConsent"]) {
|
|
450
|
+
isDisableConsent = [[backgroundCheckConfiguration valueForKey:@"disableConsent"] boolValue];
|
|
451
|
+
}
|
|
452
|
+
if (backgroundCheckConfiguration[@"backgroudCheckType"]) {
|
|
453
|
+
if ([backgroundCheckConfiguration[@"backgroudCheckType"] isEqual:@"RDC"]) {
|
|
454
|
+
type = RDC;
|
|
455
|
+
} else {
|
|
456
|
+
type = DOW_JONES;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
BOOL isMonitoringEnabled = FALSE;
|
|
460
|
+
if (backgroundCheckConfiguration[@"monitoringEnabled"]) {
|
|
461
|
+
isMonitoringEnabled = [[backgroundCheckConfiguration valueForKey:@"monitoringEnabled"] boolValue];
|
|
462
|
+
}
|
|
463
|
+
BOOL isSkipView = FALSE;
|
|
464
|
+
if (backgroundCheckConfiguration[@"skipView"]) {
|
|
465
|
+
isSkipView = [[backgroundCheckConfiguration valueForKey:@"skipView"] boolValue];
|
|
466
|
+
}
|
|
467
|
+
[lookupBuilder enableBackgroundCheck:isDisableConsent type:type monitoring:isMonitoringEnabled skipView:isSkipView];
|
|
468
|
+
}
|
|
469
|
+
builderController.delegate = self;
|
|
470
|
+
[builderController setLookup:lookupBuilder];
|
|
471
|
+
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
|
472
|
+
builderController.appViewController = rootViewController;
|
|
473
|
+
NSInteger appearanceMode = SYSTEM;
|
|
474
|
+
if (json[@"appearanceMode"]) {
|
|
475
|
+
if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
|
|
476
|
+
appearanceMode = LIGHT;
|
|
477
|
+
} else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
|
|
478
|
+
appearanceMode = DARK;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
[builderController setAppearanceMode:appearanceMode];
|
|
482
|
+
});
|
|
483
|
+
[builderController performLookup];
|
|
484
|
+
} else {
|
|
485
|
+
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
486
|
+
status.statusCode = UNEXPECTED_ERROR;
|
|
487
|
+
status.message = @"Expected lookup object as argument.";
|
|
488
|
+
status.statusTask = -1;
|
|
489
|
+
[self sendPluginError:status];
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
@catch (NSException *exception) {
|
|
493
|
+
NSLog(@"%@", exception.callStackSymbols);
|
|
494
|
+
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
495
|
+
status.statusCode = UNEXPECTED_ERROR;
|
|
496
|
+
status.message = exception.reason;
|
|
497
|
+
status.statusTask = -1;
|
|
498
|
+
[self sendPluginError:status];
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
- (void) didLookupFlowCompleteWithInfo:(NSString *)jwsString {
|
|
503
|
+
NSMutableDictionary *jsonResults = [[NSMutableDictionary alloc]init];
|
|
504
|
+
[jsonResults setValue:jwsString forKey:@"result"];
|
|
505
|
+
self.promiseResolve(jsonResults);
|
|
411
506
|
}
|
|
412
507
|
|
|
413
|
-
- (void)
|
|
414
|
-
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
415
|
-
status.statusCode = UNEXPECTED_ERROR;
|
|
416
|
-
status.message = info;
|
|
417
|
-
status.statusTask = -1;
|
|
508
|
+
- (void) didLookupFlowIncompleteWithStatus:(UQSessionStatus *)status {
|
|
418
509
|
[self sendPluginError:status];
|
|
419
510
|
}
|
|
420
511
|
|
|
421
512
|
RCT_EXPORT_METHOD(isReadingSupported:(NSString *)documentType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
513
|
+
self.promiseReject = reject;
|
|
422
514
|
@try{
|
|
423
515
|
UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
424
516
|
resolve(@(documentObject.isSupportReading));
|
|
@@ -426,13 +518,14 @@ RCT_EXPORT_METHOD(isReadingSupported:(NSString *)documentType resolver:(RCTPromi
|
|
|
426
518
|
@catch (NSException *exception) {
|
|
427
519
|
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
428
520
|
status.statusCode = UNEXPECTED_ERROR;
|
|
429
|
-
status.message = @"Expected document type as argument
|
|
521
|
+
status.message = @"Expected valid document type as argument";
|
|
430
522
|
status.statusTask = -1;
|
|
431
523
|
[self sendPluginError:status];
|
|
432
524
|
}
|
|
433
525
|
}
|
|
434
526
|
|
|
435
527
|
RCT_EXPORT_METHOD(isFacialRecognitionSupported:(NSString *)documentType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
528
|
+
self.promiseReject = reject;
|
|
436
529
|
@try{
|
|
437
530
|
UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
438
531
|
resolve(@(documentObject.isSupportFaceRecognition));
|
|
@@ -440,7 +533,52 @@ RCT_EXPORT_METHOD(isFacialRecognitionSupported:(NSString *)documentType resolver
|
|
|
440
533
|
@catch (NSException *exception) {
|
|
441
534
|
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
442
535
|
status.statusCode = UNEXPECTED_ERROR;
|
|
443
|
-
status.message = @"Expected document type as argument
|
|
536
|
+
status.message = @"Expected valid document type as argument";
|
|
537
|
+
status.statusTask = -1;
|
|
538
|
+
[self sendPluginError:status];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
RCT_EXPORT_METHOD(isEnrollmentSupported:(NSString *)documentType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
543
|
+
self.promiseReject = reject;
|
|
544
|
+
@try{
|
|
545
|
+
UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
546
|
+
resolve(@(documentObject.isEnrollmentSupported));
|
|
547
|
+
}
|
|
548
|
+
@catch (NSException *exception) {
|
|
549
|
+
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
550
|
+
status.statusCode = UNEXPECTED_ERROR;
|
|
551
|
+
status.message = @"Expected valid document type as argument";
|
|
552
|
+
status.statusTask = -1;
|
|
553
|
+
[self sendPluginError:status];
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
RCT_EXPORT_METHOD(isLookupSupported:(NSString *)documentType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
558
|
+
self.promiseReject = reject;
|
|
559
|
+
@try{
|
|
560
|
+
UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
561
|
+
resolve(@(documentObject.isLookupSupported));
|
|
562
|
+
}
|
|
563
|
+
@catch (NSException *exception) {
|
|
564
|
+
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
565
|
+
status.statusCode = UNEXPECTED_ERROR;
|
|
566
|
+
status.message = @"Expected valid document type as argument";
|
|
567
|
+
status.statusTask = -1;
|
|
568
|
+
[self sendPluginError:status];
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
RCT_EXPORT_METHOD(isLookupFacialRecognitionSupported:(NSString *)documentType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
573
|
+
self.promiseReject = reject;
|
|
574
|
+
@try{
|
|
575
|
+
UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
|
|
576
|
+
resolve(@(documentObject.isLookupFacialRecognitionSupported));
|
|
577
|
+
}
|
|
578
|
+
@catch (NSException *exception) {
|
|
579
|
+
UQSessionStatus *status =[[UQSessionStatus alloc] init];
|
|
580
|
+
status.statusCode = UNEXPECTED_ERROR;
|
|
581
|
+
status.message = @"Expected valid document type as argument";
|
|
444
582
|
status.statusTask = -1;
|
|
445
583
|
[self sendPluginError:status];
|
|
446
584
|
}
|
|
@@ -470,6 +608,9 @@ RCT_EXPORT_METHOD(isFacialRecognitionSupported:(NSString *)documentType resolver
|
|
|
470
608
|
case SESSION_INVALIDATED_FACE_RECOGNITION_TOO_MANY_ATTEMPTS:
|
|
471
609
|
code = @"SESSION_INVALIDATED_FACE_RECOGNITION_TOO_MANY_ATTEMPTS";
|
|
472
610
|
break;
|
|
611
|
+
case SESSION_INVALIDATED_OTP_TOO_MANY_ATTEMPTS:
|
|
612
|
+
code = @"SESSION_INVALIDATED_OTP_TOO_MANY_ATTEMPTS";
|
|
613
|
+
break;
|
|
473
614
|
}
|
|
474
615
|
NSString *task = nil;
|
|
475
616
|
switch (status.statusTask) {
|
|
@@ -485,6 +626,9 @@ RCT_EXPORT_METHOD(isFacialRecognitionSupported:(NSString *)documentType resolver
|
|
|
485
626
|
case BACKGROUND_CHECK:
|
|
486
627
|
task = @"BACKGROUND_CHECK";
|
|
487
628
|
break;
|
|
629
|
+
case LOOKUP:
|
|
630
|
+
task = @"LOOKUP";
|
|
631
|
+
break;
|
|
488
632
|
}
|
|
489
633
|
NSMutableDictionary *error = [[NSMutableDictionary alloc]init];
|
|
490
634
|
[error setValue:code forKey:@"code"];
|
|
@@ -496,7 +640,7 @@ RCT_EXPORT_METHOD(isFacialRecognitionSupported:(NSString *)documentType resolver
|
|
|
496
640
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:error options:NSJSONWritingPrettyPrinted error:&err];
|
|
497
641
|
|
|
498
642
|
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
499
|
-
self.promiseReject(jsonString,
|
|
643
|
+
self.promiseReject(jsonString, jsonString, nil);
|
|
500
644
|
}
|
|
501
645
|
|
|
502
646
|
-(void)startObserving {
|
|
@@ -521,44 +665,49 @@ RCT_EXPORT_METHOD(isFacialRecognitionSupported:(NSString *)documentType resolver
|
|
|
521
665
|
@implementation MyTracer
|
|
522
666
|
|
|
523
667
|
- (void)trace:(UQTrace *)trace {
|
|
524
|
-
|
|
668
|
+
if(_hasListeners) {
|
|
669
|
+
NSMutableDictionary* parameters = [[NSMutableDictionary alloc] init];
|
|
525
670
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
671
|
+
if(nil != trace.sessionId){
|
|
672
|
+
[parameters setValue:trace.sessionId forKey:@"sessionId"];
|
|
673
|
+
}
|
|
674
|
+
[parameters setValue:trace.category->name forKey:@"category"];
|
|
675
|
+
[parameters setValue:trace.event->name forKey:@"event"];
|
|
676
|
+
[parameters setValue:trace.status->name forKey:@"status"];
|
|
531
677
|
|
|
532
|
-
|
|
533
|
-
|
|
678
|
+
NSString *timeStamp = [self timeStamp:trace.timestamp];
|
|
679
|
+
[parameters setValue:timeStamp forKey:@"timestamp"];
|
|
534
680
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
681
|
+
if (TP_NULL != trace.page) {
|
|
682
|
+
[parameters setValue:trace.page->name forKey:@"page"];
|
|
683
|
+
}
|
|
684
|
+
if (TSC_NULL != trace.statusCode) {
|
|
685
|
+
[parameters setValue:trace.statusCode->name forKey:@"statusCode"];
|
|
686
|
+
}
|
|
687
|
+
if (trace.documentType != UNSPECIFY) {
|
|
688
|
+
UQDocumentConfig *document = [[UQDocumentConfig alloc] initWithDocumentType:trace.documentType];
|
|
689
|
+
[parameters setValue:document.documentName forKey:@"documentType"];
|
|
690
|
+
}
|
|
691
|
+
if (trace.statusMessage) {
|
|
692
|
+
[parameters setValue:trace.statusMessage forKey:@"statusMessage"];
|
|
693
|
+
}
|
|
548
694
|
|
|
549
|
-
|
|
550
|
-
|
|
695
|
+
NSError *err = nil;
|
|
696
|
+
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:NSJSONWritingPrettyPrinted error:&err];
|
|
551
697
|
|
|
552
|
-
|
|
553
|
-
if(_hasListeners) {
|
|
698
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
554
699
|
[_emitter sendEventWithName:@"TraceEvent" body:jsonString];
|
|
555
700
|
}
|
|
556
701
|
}
|
|
557
702
|
|
|
558
703
|
- (NSString *)timeStamp:(NSDate *)currentDate {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
704
|
+
NSISO8601DateFormatter *dateFormatter = [[NSISO8601DateFormatter alloc] init];
|
|
705
|
+
return [dateFormatter stringFromDate:currentDate];
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
- (void)didRootedDeviceDetected:(NSString *)info {
|
|
709
|
+
// IGNORE, deprecated in the SDK
|
|
562
710
|
}
|
|
563
711
|
|
|
564
712
|
@end
|
|
713
|
+
|