Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
iOS update encode method return format
Browse files Browse the repository at this point in the history
  • Loading branch information
smlu authored and Ryan Willoughby committed Mar 30, 2015
1 parent 8b10b8a commit f04a2a0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ios/CDVBarcodeScanner.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ @interface CDVBarcodeScanner : CDVPlugin {}
- (NSString*)isScanNotPossible;
- (void)scan:(CDVInvokedUrlCommand*)command;
- (void)encode:(CDVInvokedUrlCommand*)command;
- (void)returnImage:(NSString*)filePath callback:(NSString*)callback;
- (void)returnImage:(NSString*)filePath format:(NSString*)format callback:(NSString*)callback;
- (void)returnSuccess:(NSString*)scannedText format:(NSString*)format cancelled:(BOOL)cancelled flipped:(BOOL)flipped callback:(NSString*)callback;
- (void)returnError:(NSString*)message callback:(NSString*)callback;
@end
Expand Down Expand Up @@ -190,10 +190,14 @@ - (void)encode:(CDVInvokedUrlCommand*)command {
[processor performSelector:@selector(generateImage) withObject:nil afterDelay:0];
}

- (void)returnImage:(NSString*)filePath callback:(NSString*)callback{
- (void)returnImage:(NSString*)filePath format:(NSString*)format callback:(NSString*)callback{
NSMutableDictionary* resultDict = [[[NSMutableDictionary alloc] init] autorelease];
[resultDict setObject:format forKey:@"format"];
[resultDict setObject:filePath forKey:@"file"];

CDVPluginResult* result = [CDVPluginResult
resultWithStatus: CDVCommandStatus_OK
messageAsString:filePath
messageAsDictionary:resultDict
];

[[self commandDelegate] sendPluginResult:result callbackId:callback];
Expand Down Expand Up @@ -734,7 +738,7 @@ - (void)generateImage{
[UIImageJPEGRepresentation(qrImage, 1.0) writeToFile:filePath atomically:YES];

/* return file path back to cordova */
[self.plugin returnImage:filePath callback: self.callback];
[self.plugin returnImage:filePath format:@"QR_CODE" callback: self.callback];
}
@end

Expand Down

0 comments on commit f04a2a0

Please sign in to comment.