uqudosdk-react-native 2.5.4 → 2.6.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/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
- [[UQBuilderController alloc] initWithTracer:tracer];
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
- NSData* data = [enrollObj dataUsingEncoding:NSUTF8StringEncoding];
31
- id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
32
-
33
- NSString* authorizationToken = json[@"authorizationToken"];
34
- NSString* nonce = json[@"nonce"];
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
- NSString* sessionId = json[@"sessionId"];
43
- if (sessionId && sessionId.length > 0) {
44
- [enrollmentBuilder setSessionID:sessionId];
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
- if(lookupConfiguration){
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
- if (backgroundCheckConfiguration[@"backgroudCheckType"]) {
98
- if ([backgroundCheckConfiguration[@"backgroudCheckType"] isEqual:@"RDC"]) {
99
- type = RDC;
100
- } else {
101
- type = DOW_JONES;
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
- BOOL isMonitoringEnabled = FALSE;
105
- if (backgroundCheckConfiguration[@"monitoringEnabled"]) {
106
- isMonitoringEnabled = [[backgroundCheckConfiguration valueForKey:@"monitoringEnabled"] boolValue];
58
+ if (json[@"isReturnDataForIncompleteSession"]) {
59
+ enrollmentBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
107
60
  }
108
- BOOL isSkipView = FALSE;
109
- if (backgroundCheckConfiguration[@"skipView"]) {
110
- isSkipView = [[backgroundCheckConfiguration valueForKey:@"skipView"] boolValue];
111
- }
112
- [enrollmentBuilder enableBackgroundCheck:isDisableConsent type:type monitoring:isMonitoringEnabled skipView:isSkipView];
113
- }
114
- for (NSDictionary *document in documentList) {
115
- NSString* documentType = document[@"documentType"];
116
- UQDocumentConfig *documentObject = [[UQDocumentConfig alloc] initWithDocumentTypeName:documentType];
117
- if(documentObject.documentType == UNSPECIFY){
118
- continue;
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
- UQScanConfig *scanConfig = [[UQScanConfig alloc] init];
122
- if (document[@"isHelpPageDisabled"]) {
123
- scanConfig.disableHelpPage = [[document valueForKey:@"isHelpPageDisabled"] boolValue];
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 (document[@"faceScanMinimumMatchLevel"]) {
126
- scanConfig.faceMinimumMatchLevel = [[document valueForKey:@"faceScanMinimumMatchLevel"] intValue];
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
- if (document[@"minimumAge"]) {
129
- int minimumAge = [[document valueForKey:@"minimumAge"] intValue];
130
- if (minimumAge > 0) {
131
- documentObject.enableAgeVerification = minimumAge;
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
- BOOL isEnableFrontSideReview = false;
136
- BOOL isEnableBackSideReview = false;
144
+ BOOL isEnableFrontSideReview = false;
145
+ BOOL isEnableBackSideReview = false;
137
146
 
138
- if (document[@"isFrontSideReviewEnabled"]) {
139
- isEnableFrontSideReview = [[document valueForKey:@"isFrontSideReviewEnabled"] boolValue];
140
- }
141
- if (document[@"isBackSideReviewEnabled"]) {
142
- isEnableBackSideReview = [[document valueForKey:@"isBackSideReviewEnabled"] boolValue];
143
- }
144
- [scanConfig enableScanReview:isEnableFrontSideReview backSide:isEnableBackSideReview];
145
- if (document[@"isUploadEnabled"]) {
146
- scanConfig.enableUpload = [[document valueForKey:@"isUploadEnabled"] boolValue];
147
- }
148
- documentObject.scan = scanConfig;
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
- if (document[@"isExpiredDocumentValidateDisabled"]) {
151
- documentObject.disableExpiryValidation = [[document valueForKey:@"isExpiredDocumentValidateDisabled"] boolValue];
152
- }
159
+ if (document[@"isExpiredDocumentValidateDisabled"]) {
160
+ documentObject.disableExpiryValidation = [[document valueForKey:@"isExpiredDocumentValidateDisabled"] boolValue];
161
+ }
153
162
 
154
- if (document[@"isUserDataReviewDisabled"]) {
155
- documentObject.disableUserDataReview = [[document valueForKey:@"isUserDataReviewDisabled"] boolValue];
156
- }
163
+ if (document[@"isUserDataReviewDisabled"]) {
164
+ documentObject.disableUserDataReview = [[document valueForKey:@"isUserDataReviewDisabled"] boolValue];
165
+ }
157
166
 
158
- if (document[@"readingConfiguration"]) {
159
- NSDictionary *readingConfiguration = document[@"readingConfiguration"];
167
+ if (document[@"readingConfiguration"]) {
168
+ NSDictionary *readingConfiguration = document[@"readingConfiguration"];
160
169
 
161
- UQReadingConfig *readConfig = [[UQReadingConfig alloc] init];
162
- readConfig.enableReading = TRUE;
163
- if (readingConfiguration[@"forceReading"]) {
164
- [readConfig forceReading:[[readingConfiguration valueForKey:@"forceReading"] boolValue]];
165
- }
166
- if (readingConfiguration[@"forceReadingIfSupported"]) {
167
- [readConfig forceReadingIfSupported:[[readingConfiguration valueForKey:@"forceReadingIfSupported"] boolValue]];
168
- }
169
- if (document[@"faceReadMinimumMatchLevel"]) {
170
- readConfig.faceMinimumMatchLevel = [[document valueForKey:@"faceReadMinimumMatchLevel"] intValue];
171
- }
172
- if (readingConfiguration[@"timeoutInSeconds"]) {
173
- int timeoutInSeconds = [[readingConfiguration valueForKey:@"timeoutInSeconds"] intValue];
174
- if (timeoutInSeconds > 0) {
175
- readConfig.forceReadingTimeout = timeoutInSeconds;
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
- documentObject.reading = readConfig;
180
- }
188
+ documentObject.reading = readConfig;
189
+ }
181
190
 
182
- [enrollmentBuilder add:documentObject];
183
- }
184
- // Add enrollment to builder
185
- UQBuilderController *builderController = [UQBuilderController defaultBuilder];
186
- builderController.delegate = self;
187
- [builderController setEnrollment:enrollmentBuilder];
188
- NSInteger appearanceMode = SYSTEM;
189
- if (json[@"appearanceMode"]) {
190
- if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
191
- appearanceMode = LIGHT;
192
- } else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
193
- appearanceMode = DARK;
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
- [builderController setAppearanceMode:appearanceMode];
197
- // Start enrollment flow
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
- NSData *data = [recoverObj dataUsingEncoding:NSUTF8StringEncoding];
249
- id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
250
-
251
- UQAccountRecoveryBuilder *accountRecoveryBuilder = [[UQAccountRecoveryBuilder alloc] init];
252
- accountRecoveryBuilder.authorizationToken = json[@"token"];
253
- accountRecoveryBuilder.enrollmentIdentifier = json[@"enrollmentIdentifier"];
254
- accountRecoveryBuilder.nonce = json[@"nonce"];
255
- if (json[@"isRootedDeviceAllowed"]) {
256
- accountRecoveryBuilder.isRootedDeviceAllowed = [[json valueForKey:@"isRootedDeviceAllowed"] boolValue];
257
- }
258
- if (json[@"minimumMatchLevel"]) {
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
- UQBuilderController *builderController = [UQBuilderController defaultBuilder];
274
- builderController.delegate = self;
275
- UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
276
- builderController.appViewController = rootViewController;
277
- [builderController setAccountRecovery:accountRecoveryBuilder];
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)didAccountRecoveryFailWithError:(nonnull NSError *)error {
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)didAccountRecoveryIncompleteWithStatus:(UQSessionStatus *)status {
326
- [self sendPluginError:status];
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
- NSData *data = [configuration dataUsingEncoding:NSUTF8StringEncoding];
335
- id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
336
-
337
- UQFaceSessionBuilder *faceSessionBuilder = [[UQFaceSessionBuilder alloc] init];
338
- faceSessionBuilder.authorizationToken = json[@"token"];
339
- faceSessionBuilder.sessionId = json[@"sessionId"];
340
- faceSessionBuilder.nonce = json[@"nonce"];
341
- if (json[@"isRootedDeviceAllowed"]) {
342
- faceSessionBuilder.isRootedDeviceAllowed = [[json valueForKey:@"isRootedDeviceAllowed"] boolValue];
343
- }
344
- if (json[@"minimumMatchLevel"]) {
345
- faceSessionBuilder.minimumMatchLevel = [[json valueForKey:@"minimumMatchLevel"] intValue];
346
- }
347
-
348
- if (json[@"maxAttempts"]) {
349
- int maxAttempts = [[json valueForKey:@"maxAttempts"] intValue];
350
- if (maxAttempts > 0) {
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
- if (json[@"isReturnDataForIncompleteSession"]) {
342
+ if (json[@"isReturnDataForIncompleteSession"]) {
356
343
  faceSessionBuilder.returnDataForIncompleteSession = [[json valueForKey:@"isReturnDataForIncompleteSession"] boolValue];
357
- }
358
-
359
- UQBuilderController *builderController = [UQBuilderController defaultBuilder];
360
- builderController.delegate = self;
361
- UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
362
- builderController.appViewController = rootViewController;
363
- [builderController setFaceSession:faceSessionBuilder];
364
-
365
- NSInteger appearanceMode = SYSTEM;
366
- if (json[@"appearanceMode"]) {
367
- if ([json[@"appearanceMode"] isEqualToString:@"LIGHT"]) {
368
- appearanceMode = LIGHT;
369
- } else if ([json[@"appearanceMode"] isEqualToString:@"DARK"]) {
370
- appearanceMode = DARK;
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)didFaceSessionFailWithError:(nonnull NSError *)error {
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)didFaceSessionIncompleteWithStatus:(UQSessionStatus *)status {
410
- [self sendPluginError:status];
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) didRootedDeviceDetected:(NSString *)info {
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_EXPIRED:
612
+ code = @"SESSION_INVALIDATED_OTP_EXPIRED";
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, nil, nil);
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
- NSMutableDictionary* parameters = [[NSMutableDictionary alloc] init];
668
+ if(_hasListeners) {
669
+ NSMutableDictionary* parameters = [[NSMutableDictionary alloc] init];
525
670
 
526
- if(nil != trace.sessionId){
527
- [parameters setValue:trace.sessionId forKey:@"sessionId"];
528
- }
529
- [parameters setValue:trace.event->name forKey:@"event"];
530
- [parameters setValue:trace.status->name forKey:@"status"];
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
- NSString *timeStamp = [self timeStamp:trace.timestamp];
533
- [parameters setValue:timeStamp forKey:@"timestamp"];
678
+ NSString *timeStamp = [self timeStamp:trace.timestamp];
679
+ [parameters setValue:timeStamp forKey:@"timestamp"];
534
680
 
535
- if (TP_NULL != trace.page) {
536
- [parameters setValue:trace.page->name forKey:@"page"];
537
- }
538
- if (TSC_NULL != trace.statusCode) {
539
- [parameters setValue:trace.statusCode->name forKey:@"statusCode"];
540
- }
541
- if (trace.documentType != UNSPECIFY) {
542
- UQDocumentConfig *document = [[UQDocumentConfig alloc] initWithDocumentType:trace.documentType];
543
- [parameters setValue:document.documentName forKey:@"documentType"];
544
- }
545
- if (trace.statusMessage) {
546
- [parameters setValue:trace.statusMessage forKey:@"statusMessage"];
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
- NSError *err = nil;
550
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:NSJSONWritingPrettyPrinted error:&err];
695
+ NSError *err = nil;
696
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:NSJSONWritingPrettyPrinted error:&err];
551
697
 
552
- NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
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
- return [NSDateFormatter localizedStringFromDate:currentDate
560
- dateStyle:NSDateFormatterFullStyle
561
- timeStyle:NSDateFormatterFullStyle];
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
+