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