Skip to content

Commit

Permalink
[iOS] updated bindings for v5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
juraskrlec committed Apr 29, 2020
1 parent 3fb04b0 commit 44e27e3
Show file tree
Hide file tree
Showing 12 changed files with 343 additions and 110 deletions.
1 change: 1 addition & 0 deletions BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
+(NSDictionary * _Nonnull) serializeMrzResult:(MBMrzResult * _Nonnull)mrzResult;
+(MBImageExtensionFactors) deserializeMBImageExtensionFactors:(NSDictionary * _Nullable)jsonExtensionFactors;
+(NSDictionary * _Nonnull) serializeDriverLicenseDetailedInfo:(MBDriverLicenseDetailedInfo * _Nonnull)driverLicenseDetailedInfo;
+(NSDictionary * _Nonnull) serializeClassInfo:(MBClassInfo * _Nonnull)classInfo;

@end
11 changes: 10 additions & 1 deletion BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ +(NSDictionary *) serializeMrzResult:(MBMrzResult *)mrzResult {
@"sanitizedNationality" : mrzResult.sanitizedNationality,
@"sanitizedIssuer" : mrzResult.sanitizedIssuer,
@"sanitizedDocumentCode" : mrzResult.sanitizedDocumentCode,
@"sanitizedDocumentNumber" : mrzResult.sanitizedDocumentNumber
@"sanitizedDocumentNumber" : mrzResult.sanitizedDocumentNumber,
@"age" : [NSNumber numberWithInteger:mrzResult.age]
};
}

Expand All @@ -60,4 +61,12 @@ +(NSDictionary *) serializeDriverLicenseDetailedInfo:(MBDriverLicenseDetailedInf
};
}

+(NSDictionary *) serializeClassInfo:(MBClassInfo *)classInfo {
return @{
@"country" : [NSNumber numberWithInteger:(classInfo.country + 1)],
@"region" : [NSNumber numberWithInteger:(classInfo.region + 1)],
@"type" : [NSNumber numberWithInteger:(classInfo.type + 1)],
};
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@

-(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOverlaySettings recognizerCollection:(MBRecognizerCollection*)recognizerCollection delegate:(id<MBOverlayViewControllerDelegate>)delegate;

-(MBOverlayViewController *) createDocumentCaptureOverlayViewControllerWithCollection:(MBRecognizerCollection*)recognizerCollection delegate:(id<MBOverlayViewControllerDelegate>)delegate;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve
return [[self.overlayCreators valueForKey:[jsonOverlaySettings valueForKey:@"overlaySettingsType"]] createOverlayViewController:jsonOverlaySettings recognizerCollection:recognizerCollection delegate:delegate];
}

-(MBOverlayViewController *) createDocumentCaptureOverlayViewControllerWithCollection:(MBRecognizerCollection*)recognizerCollection delegate:(id<MBOverlayViewControllerDelegate>)delegate {
return [[self.overlayCreators valueForKey:@"DocumentCaptureOverlaySettings"] createOverlayViewController:nil recognizerCollection:recognizerCollection delegate:delegate];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

#import <MicroBlink/MicroBlink.h>

@protocol MBOverlayViewControllerDelegate
@protocol MBOverlayViewControllerDelegate<NSObject>
@required

- (void)overlayViewControllerDidFinishScanning:(MBOverlayViewController *)overlayViewController state:(MBRecognizerResultState)state;
- (void)overlayDidTapClose:(MBOverlayViewController *)overlayViewController;

@optional
- (void)overlayViewControllerDidFinishScanning:(MBOverlayViewController *)overlayViewController highResImage:(MBImage *)highResImage state:(MBRecognizerResultState)state;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve
sett.backSideScanningTimeout = [backSideScanningTimeoutMilliseconds doubleValue] / 1000.0;
}
}

{
id scanBarcodeText = [jsonOverlaySettings valueForKey:@"scanBarcodeText"];
if (scanBarcodeText != nil) {
sett.scanBarcodeText = (NSString *)scanBarcodeText;
}
}

{
id errorDocumentTooCloseToEdge = [jsonOverlaySettings valueForKey:@"errorDocumentTooCloseToEdge"];
if (errorDocumentTooCloseToEdge != nil) {
sett.errorDocumentTooCloseToEdge = (NSString *)errorDocumentTooCloseToEdge;
}
}

return [[MBBlinkIdOverlayViewController alloc] initWithSettings:sett recognizerCollection:recognizerCollection delegate:self];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.fullDocumentImageExtensionFactors = [MBBlinkIDSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors];
}
}
{
id paddingEdge = [jsonRecognizer valueForKey:@"paddingEdge"];
if (paddingEdge != nil) {
recognizer.paddingEdge = [(NSNumber *)paddingEdge floatValue];
}
}
{
id returnFaceImage = [jsonRecognizer valueForKey:@"returnFaceImage"];
if (returnFaceImage != nil) {
Expand All @@ -70,6 +76,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.signResult = [(NSNumber *)signResult boolValue];
}
}
{
id skipUnsupportedBack = [jsonRecognizer valueForKey:@"skipUnsupportedBack"];
if (skipUnsupportedBack != nil) {
recognizer.skipUnsupportedBack = [(NSNumber *)skipUnsupportedBack boolValue];
}
}

return recognizer;
}
Expand All @@ -86,6 +98,8 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"];
[jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"];
[jsonResult setValue:self.result.address forKey:@"address"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeClassInfo:self.result.classInfo] forKey:@"classInfo"];
[jsonResult setValue:self.result.conditions forKey:@"conditions"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"];
Expand All @@ -94,7 +108,9 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:[self.result.digitalSignature base64EncodedStringWithOptions:0] forKey:@"digitalSignature"];
[jsonResult setValue:[NSNumber numberWithUnsignedInteger:self.result.digitalSignatureVersion] forKey:@"digitalSignatureVersion"];
[jsonResult setValue:self.result.documentAdditionalNumber forKey:@"documentAdditionalNumber"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentBackImageColorStatus + 1)] forKey:@"documentBackImageColorStatus"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentDataMatch + 1)] forKey:@"documentDataMatch"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentFrontImageColorStatus + 1)] forKey:@"documentFrontImageColorStatus"];
[jsonResult setValue:self.result.documentNumber forKey:@"documentNumber"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"];
[jsonResult setValue:self.result.employer forKey:@"employer"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.fullDocumentImageExtensionFactors = [MBBlinkIDSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors];
}
}
{
id paddingEdge = [jsonRecognizer valueForKey:@"paddingEdge"];
if (paddingEdge != nil) {
recognizer.paddingEdge = [(NSNumber *)paddingEdge floatValue];
}
}
{
id returnFaceImage = [jsonRecognizer valueForKey:@"returnFaceImage"];
if (returnFaceImage != nil) {
Expand Down Expand Up @@ -80,12 +86,15 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"];
[jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"];
[jsonResult setValue:self.result.address forKey:@"address"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeClassInfo:self.result.classInfo] forKey:@"classInfo"];
[jsonResult setValue:self.result.conditions forKey:@"conditions"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"];
[jsonResult setValue:[NSNumber numberWithBool:self.result.dateOfExpiryPermanent] forKey:@"dateOfExpiryPermanent"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"];
[jsonResult setValue:self.result.documentAdditionalNumber forKey:@"documentAdditionalNumber"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentImageColorStatus + 1)] forKey:@"documentImageColorStatus"];
[jsonResult setValue:self.result.documentNumber forKey:@"documentNumber"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"];
[jsonResult setValue:self.result.employer forKey:@"employer"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"];
[jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"];
[jsonResult setValue:self.result.address forKey:@"address"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.barcodeType + 1)] forKey:@"barcodeType"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.faceImage] forKey:@"faceImage"];
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.fullDocumentImage] forKey:@"fullDocumentImage"];
[jsonResult setValue:[NSNumber numberWithBool:self.result.scanningFirstSideDone] forKey:@"scanningFirstSideDone"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];

[jsonResult setValue:self.result.firstName forKey:@"firstName"];
[jsonResult setValue:self.result.lastName forKey:@"lastName"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];

[jsonResult setValue:[self.result optionalElements] forKey:@"optionalElements"];
[jsonResult setValue:[[self.result data] base64EncodedStringWithOptions:0] forKey:@"rawData"];
Expand Down
Loading

0 comments on commit 44e27e3

Please sign in to comment.