Skip to content

Commit

Permalink
Merge pull request #2 from dmlg94/patch-1
Browse files Browse the repository at this point in the history
Update BlinkIdPlugin.m
  • Loading branch information
vmfo22 committed Dec 25, 2016
2 parents bb21085 + 4c0de38 commit dbb4c0b
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions src/ios/BlinkIdPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,36 @@ - (void)scanningViewController:(UIViewController<PPScanningViewController> *)sca
title = @"USDL";
message = [usdlResult description];


// TODO
NSDictionary *jsonObj = [ [NSDictionary alloc]
initWithObjectsAndKeys :
@"true", @"isParsed",
@"", @"issuer",
[usdlResult getStringElementUsingGuessedEncoding:@"Customer ID Numberp"], @"documentNumber",
@"", @"documentCode",
[usdlResult getStringElementUsingGuessedEncoding:@"Document Expiration Date"], @"dateOfExpiry",
[usdlResult getStringElementUsingGuessedEncoding:@"Customer First Name"], @"primaryId",
[usdlResult getStringElementUsingGuessedEncoding:@"Customer Name"], @"secondaryId",
[usdlResult getStringElementUsingGuessedEncoding:@"Date of Birth"] , @"dateOfBirth",
[usdlResult getStringElementUsingGuessedEncoding:@"Country Identification"], @"nationality",
[usdlResult getStringElementUsingGuessedEncoding:@"SEX"] , @"sex",
@"", @"opt1",
@"", @"opt2",
[usdlResult getStringElementUsingGuessedEncoding:@"pdf417"], @"mrzText",
nil
];
NSError* error ;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonObj
options:NSJSONWritingPrettyPrinted
error:&error];
NSString *jsonString = @"";
if (! jsonData) {
NSLog(@"Got an error: %@", error);
} else {
jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}

__block CDVPluginResult* pluginResult = nil;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:jsonString];

[self.commandDelegate sendPluginResult:pluginResult callbackId:self.commandHelper.callbackId];

Expand All @@ -243,4 +269,4 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
}


@end
@end

0 comments on commit dbb4c0b

Please sign in to comment.