Added setter of onReadCode.

This commit is contained in:
Evgeni Silman 2019-03-04 15:29:20 +02:00
parent 43e8a40cf0
commit 35c6fca5c3
1 changed files with 12 additions and 7 deletions

View File

@ -297,18 +297,23 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
else {
self.setupResult = CKSetupResultSessionConfigurationFailed;
}
if (self.onReadCode) {//TODO check if qrcode mode is on
self.metadataOutput = [[AVCaptureMetadataOutput alloc] init];
[self.session addOutput:self.metadataOutput];
[self.metadataOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
[self.metadataOutput setMetadataObjectTypes:[self.metadataOutput availableMetadataObjectTypes]];
}
[self.session commitConfiguration];
} );
}
-(void)setOnReadCode:(RCTDirectEventBlock)onReadCode
{
_onReadCode = onReadCode;
if (self.onReadCode) {//TODO check if qrcode mode is on
self.metadataOutput = [[AVCaptureMetadataOutput alloc] init];
[self.session addOutput:self.metadataOutput];
[self.metadataOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
[self.metadataOutput setMetadataObjectTypes:[self.metadataOutput availableMetadataObjectTypes]];
}
[self.session commitConfiguration];
}
-(void)handleCameraPermission {
switch ( [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] )