Merge pull request #48 from dcousens/patch-2
wait until viewController is dismissed before callback, fixes #47
This commit is contained in:
commit
8d826e0def
33
ios/CsZBar.m
33
ios/CsZBar.m
@ -104,29 +104,32 @@
|
||||
ZBarSymbol *symbol = nil;
|
||||
for(symbol in results) break; // get the first result
|
||||
|
||||
[self.scanReader dismissModalViewControllerAnimated: YES];
|
||||
self.scanInProgress = NO;
|
||||
[self sendScanResult: [CDVPluginResult
|
||||
resultWithStatus: CDVCommandStatus_OK
|
||||
messageAsString: symbol.data]];
|
||||
[self.scanReader dismissViewControllerAnimated: YES completion: ^(void) {
|
||||
self.scanInProgress = NO;
|
||||
[self sendScanResult: [CDVPluginResult
|
||||
resultWithStatus: CDVCommandStatus_OK
|
||||
messageAsString: symbol.data]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) imagePickerControllerDidCancel:(UIImagePickerController*)picker
|
||||
{
|
||||
[self.scanReader dismissModalViewControllerAnimated: YES];
|
||||
self.scanInProgress = NO;
|
||||
[self sendScanResult: [CDVPluginResult
|
||||
resultWithStatus: CDVCommandStatus_ERROR
|
||||
messageAsString: @"cancelled"]];
|
||||
[self.scanReader dismissViewControllerAnimated: YES completion: ^(void) {
|
||||
self.scanInProgress = NO;
|
||||
[self sendScanResult: [CDVPluginResult
|
||||
resultWithStatus: CDVCommandStatus_ERROR
|
||||
messageAsString: @"cancelled"]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) readerControllerDidFailToRead:(ZBarReaderController*)reader withRetry:(BOOL)retry
|
||||
{
|
||||
[self.scanReader dismissModalViewControllerAnimated: YES];
|
||||
self.scanInProgress = NO;
|
||||
[self sendScanResult: [CDVPluginResult
|
||||
resultWithStatus: CDVCommandStatus_ERROR
|
||||
messageAsString: @"Failed"]];
|
||||
[self.scanReader dismissViewControllerAnimated: YES completion: ^(void) {
|
||||
self.scanInProgress = NO;
|
||||
[self sendScanResult: [CDVPluginResult
|
||||
resultWithStatus: CDVCommandStatus_ERROR
|
||||
messageAsString: @"Failed"]];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user