Skip to content

Commit

Permalink
Merged in feature/uae-id/IOS-245 (pull request #23)
Browse files Browse the repository at this point in the history
Feature/uae id/IOS-245
  • Loading branch information
Dino Gustin authored and i1E committed Feb 8, 2018
2 parents 495cb1f + 9f7a63e commit 3dbc4bb
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 3 deletions.
4 changes: 3 additions & 1 deletion BlinkID/initIOSFramework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# enter into ios project folder
pushd src/ios/

VERSION='2.15.0'
VERSION='2.16.0'

# check if Microblink framework and bundle already exist
if [ ! -d 'blinkid-ios' ] ; then
Expand All @@ -16,6 +16,8 @@ echo "Checking out v${VERSION}"

cd blinkid-ios || exit 1
git checkout "v${VERSION}" >/dev/null 2>&1 || exit 1
git lfs fetch
git lfs checkout

mv Microblink.framework ../Microblink.framework
mv Microblink.bundle ../Microblink.bundle
Expand Down
98 changes: 97 additions & 1 deletion BlinkID/src/ios/sources/CDVBlinkIdScanner.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
const NSString *GERMAN_OLD_ID_TYPE = @"GermanOldID";
const NSString *GERMAN_ID_FRONT_TYPE = @"GermanIDFront";
const NSString *GERMAN_ID_BACK_TYPE = @"GermanIDBack";
const NSString *UAE_ID_BACK_TYPE = @"UnitedArabEmiratesIDBack";
const NSString *UAE_ID_FRONT_TYPE = @"UnitedArabEmiratesIDFront";
const NSString *GERMAN_PASS_TYPE = @"GermanPassport";
const NSString *DOCUMENTFACE_TYPE = @"DocumentFace";
const NSString *DOCUMENTDETECTOR_TYPE = @"DocumentDetector";
Expand Down Expand Up @@ -62,6 +64,8 @@
NSString *GERMAN_ID_FRONT_RESULT_TYPE = @"GermanFrontID result";
NSString *GERMAN_ID_BACK_RESULT_TYPE = @"GermanBackID result";
NSString *GERMAN_PASS_RESULT_TYPE = @"GermanPassport result";
NSString *UAE_ID_BACK_RESULT_TYPE = @"UnitedArabEmiratesIDBack result";
NSString *UAE_ID_FRONT_RESULT_TYPE = @"UnitedArabEmiratesIDFront result";
NSString *DOCUMENTFACE_RESULT_TYPE = @"DocumentFace result";
NSString *DOCUMENTDETECTOR_RESULT_TYPE = @"DocumentDetector result";

Expand Down Expand Up @@ -454,6 +458,45 @@ - (PPGermanPassportRecognizerSettings *)germanPassportRecognizerSettings {
return germanPassportRecognizerSettings;
}

- (PPUnitedArabEmiratesIDBackRecognizerSettings *)uaeBackRecognizerSettings {

PPUnitedArabEmiratesIDBackRecognizerSettings *uaeBackRecognizerSettings = [[PPUnitedArabEmiratesIDBackRecognizerSettings alloc] init];

// Setup returning document image

if ([self shouldReturnDocumentImage]) {
uaeBackRecognizerSettings.displayFullDocumentImage = YES;

NSMutableDictionary *dict = [self getInitializedImagesDictionaryForClass:[PPUnitedArabEmiratesIDBackRecognizerResult class]];
[dict setObject:[NSNull null] forKey:@(PPImageTypeDocument)];
}

return uaeBackRecognizerSettings;
}

- (PPUnitedArabEmiratesIDFrontRecognizerSettings *)uaeFrontRecognizerSettings {

PPUnitedArabEmiratesIDFrontRecognizerSettings *uaeFrontRecognizerSettings = [[PPUnitedArabEmiratesIDFrontRecognizerSettings alloc] init];

// Setup returning document image

if ([self shouldReturnDocumentImage]) {
uaeFrontRecognizerSettings.displayFullDocumentImage = YES;

NSMutableDictionary *dict = [self getInitializedImagesDictionaryForClass:[PPUnitedArabEmiratesIDFrontRecognizerResult class]];
[dict setObject:[NSNull null] forKey:@(PPImageTypeDocument)];
}

if ([self shouldReturnFaceImage]) {
uaeFrontRecognizerSettings.displayFacePhoto = YES;

NSMutableDictionary *dict = [self getInitializedImagesDictionaryForClass:[PPUnitedArabEmiratesIDFrontRecognizerResult class]];
[dict setObject:[NSNull null] forKey:@(PPImageTypeFace)];
}

return uaeFrontRecognizerSettings;
}


- (NSMutableDictionary *)getInitializedImagesDictionaryForClass:(Class)class {

Expand Down Expand Up @@ -526,6 +569,14 @@ - (BOOL)shouldUseGermanPassType:(NSArray *)types {
return [types containsObject:GERMAN_PASS_TYPE];
}

- (BOOL)shouldUseUaeIDBackType:(NSArray *)types {
return [types containsObject:UAE_ID_BACK_TYPE];
}

- (BOOL)shouldUseUaeIDFrontType:(NSArray *)types {
return [types containsObject:UAE_ID_FRONT_TYPE];
}

#pragma mark - Main

- (PPCameraCoordinator *)coordinatorWithError:(NSError **)error {
Expand Down Expand Up @@ -635,6 +686,14 @@ - (PPCameraCoordinator *)coordinatorWithError:(NSError **)error {
if ([self shouldUseGermanPassType:types]) {
[settings.scanSettings addRecognizerSettings:[self germanPassportRecognizerSettings]];
}

if ([self shouldUseUaeIDBackType:types]) {
[settings.scanSettings addRecognizerSettings:[self uaeBackRecognizerSettings]];
}

if ([self shouldUseUaeIDFrontType:types]) {
[settings.scanSettings addRecognizerSettings:[self uaeFrontRecognizerSettings]];
}

/** 4. Initialize the Scanning Coordinator object */

Expand Down Expand Up @@ -784,6 +843,20 @@ - (void)setDictionary:(NSMutableDictionary *)dict withGermanPassportRecognizerRe
[self setupDictionary:dict withImagesForResult:germanPassportResult];
}

- (void)setDictionary:(NSMutableDictionary *)dict withUaeIDBackRecognizerResult:(PPUnitedArabEmiratesIDBackRecognizerResult *)uaeIDBackResult {
NSMutableDictionary *stringElements = [NSMutableDictionary dictionaryWithDictionary:[uaeIDBackResult getAllStringElements]];
[dict setObject:stringElements forKey:FIELDS];
[dict setObject:UAE_ID_BACK_RESULT_TYPE forKey:RESULT_TYPE];
[self setupDictionary:dict withImagesForResult:uaeIDBackResult];
}

- (void)setDictionary:(NSMutableDictionary *)dict withUaeIDFrontRecognizerResult:(PPUnitedArabEmiratesIDFrontRecognizerResult *)uaeIDFrontResult {
NSMutableDictionary *stringElements = [NSMutableDictionary dictionaryWithDictionary:[uaeIDFrontResult getAllStringElements]];
[dict setObject:stringElements forKey:FIELDS];
[dict setObject:UAE_ID_FRONT_RESULT_TYPE forKey:RESULT_TYPE];
[self setupDictionary:dict withImagesForResult:uaeIDFrontResult];
}

- (void)returnResults:(NSArray *)results cancelled:(BOOL)cancelled {

NSMutableDictionary *resultDict = [[NSMutableDictionary alloc] init];
Expand Down Expand Up @@ -882,6 +955,7 @@ - (void)returnResults:(NSArray *)results cancelled:(BOOL)cancelled {
[resultArray addObject:dict];
continue;
}

if ([result isKindOfClass:[PPMyKadFrontRecognizerResult class]]) {
PPMyKadFrontRecognizerResult *myKadDecoderResult = (PPMyKadFrontRecognizerResult *)result;

Expand All @@ -891,6 +965,26 @@ - (void)returnResults:(NSArray *)results cancelled:(BOOL)cancelled {
[resultArray addObject:dict];
}

if ([result isKindOfClass:[PPUnitedArabEmiratesIDBackRecognizerResult class]]) {
PPUnitedArabEmiratesIDBackRecognizerResult *uaeIDBackResult = (PPUnitedArabEmiratesIDBackRecognizerResult *)result;

NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[self setDictionary:dict withUaeIDBackRecognizerResult:uaeIDBackResult];

[resultArray addObject:dict];
continue;
}

if ([result isKindOfClass:[PPUnitedArabEmiratesIDFrontRecognizerResult class]]) {
PPUnitedArabEmiratesIDFrontRecognizerResult *uaeIDFrontResult = (PPUnitedArabEmiratesIDFrontRecognizerResult *)result;

NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[self setDictionary:dict withUaeIDFrontRecognizerResult:uaeIDFrontResult];

[resultArray addObject:dict];
continue;
}

if ([result isKindOfClass:[PPDetectorRecognizerResult class]]) {
PPDetectorRecognizerResult *documentDetectorResult = (PPDetectorRecognizerResult *)result;

Expand All @@ -910,7 +1004,6 @@ - (void)returnResults:(NSArray *)results cancelled:(BOOL)cancelled {
[resultArray addObject:dict];
continue;
}

};

if ([resultArray count] > 0) {
Expand Down Expand Up @@ -1042,6 +1135,8 @@ - (void)scanningViewController:(UIViewController<PPScanningViewController> *)sca
[self setImageMetadata:imageMetadata forName:[PPGermanIDFrontRecognizerSettings FULL_DOCUMENT_IMAGE] imageType:PPImageTypeDocument resultClass:[PPGermanIDFrontRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPGermanIDBackRecognizerSettings ID_FULL_DOCUMENT] imageType:PPImageTypeDocument resultClass:[PPGermanIDBackRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPGermanPassportRecognizerSettings FULL_DOCUMENT_IMAGE] imageType:PPImageTypeDocument resultClass:[PPGermanPassportRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPUnitedArabEmiratesIDBackRecognizerSettings FULL_DOCUMENT_IMAGE] imageType:PPImageTypeDocument resultClass:[PPUnitedArabEmiratesIDBackRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPUnitedArabEmiratesIDFrontRecognizerSettings FULL_DOCUMENT_IMAGE] imageType:PPImageTypeDocument resultClass:[PPUnitedArabEmiratesIDFrontRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:DOCUMENTDETECTOR_ID1_NAME imageType:PPImageTypeDocument resultClass:[PPDetectorRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:DOCUMENTDETECTOR_ID1_NAME imageType:PPImageTypeDocument resultClass:[PPDetectorRecognizerResult class]];

Expand All @@ -1050,6 +1145,7 @@ - (void)scanningViewController:(UIViewController<PPScanningViewController> *)sca
[self setImageMetadata:imageMetadata forName:[PPGermanOldIDRecognizerSettings ID_FACE] imageType:PPImageTypeFace resultClass:[PPGermanOldIDRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPGermanIDFrontRecognizerSettings ID_FACE] imageType:PPImageTypeFace resultClass:[PPGermanIDFrontRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPGermanPassportRecognizerSettings ID_FACE] imageType:PPImageTypeFace resultClass:[PPGermanPassportRecognizerResult class]];
[self setImageMetadata:imageMetadata forName:[PPUnitedArabEmiratesIDFrontRecognizerSettings ID_FACE] imageType:PPImageTypeFace resultClass:[PPUnitedArabEmiratesIDFrontRecognizerResult class]];
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions Release notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.4.4
- added the following recognizers:
- `UnitedArabEmiratesIDBack` - scans the back of United Arab Emirates ID cards
- `UnitedArabEmiratesIDFront` - scans the front of United Arab Emirates ID cards
- updated iOS SDK to [2.16.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v2.16.0)
- updated Android SDK to [v3.15.1](https://github.com/BlinkID/blinkid-android/releases/tag/v3.15.1)

## 1.4.3
- added the following recognizers:
- `GermanOldID` - scans the front of old German ID cards
Expand Down
2 changes: 1 addition & 1 deletion www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var app = {
// Note that each platform requires its own license key

// This license key allows setting overlay views for this application ID: com.microblink.blinkid
var licenseiOs = "RYRTHFTE-BGSW25OV-22FACO5I-XKFH6NNV-EYKLREEQ-SCIJBEEQ-SCIJAMA4-CTCG345C"; // valid until 2018-03-04
var licenseiOs = "VD62UVB5-H24WWCCB-CCR443VD-IOD4AEF6-6W6P2KED-PIZ7VRQA-EVEKPC34-O27IFYXG"; // valid until 2018-05-09

// This license is only valid for package name "com.microblink.blinkid"
var licenseAndroid = "FESCWEBI-3FQIPFNN-UOA3DVXD-CARRDWLE-P7SQBC3D-V3PZU4SX-54PGVNWO-NQ5WS5HX";
Expand Down

0 comments on commit 3dbc4bb

Please sign in to comment.