[permissions] rename checkCameraAuthorizationStatus to checkVideoAuthorizationStatus
This commit is contained in:
parent
c981675636
commit
cfac209da8
|
@ -113,7 +113,7 @@ export default class Camera extends Component {
|
|||
};
|
||||
|
||||
static checkDeviceAuthorizationStatus = CameraManager.checkDeviceAuthorizationStatus;
|
||||
static checkVideoAuthorizationStatus = CameraManager.checkCameraAuthorizationStatus;
|
||||
static checkVideoAuthorizationStatus = CameraManager.checkVideoAuthorizationStatus;
|
||||
static checkAudioAuthorizationStatus = CameraManager.checkAudioAuthorizationStatus;
|
||||
|
||||
setNativeProps(props) {
|
||||
|
|
|
@ -23,7 +23,7 @@ RCT_EXPORT_MODULE();
|
|||
- (UIView *)view
|
||||
{
|
||||
self.session = [AVCaptureSession new];
|
||||
|
||||
|
||||
self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.session];
|
||||
self.previewLayer.needsDisplayOnBoundsChange = YES;
|
||||
|
||||
|
@ -173,7 +173,7 @@ RCT_EXPORT_METHOD(checkDeviceAuthorizationStatus:(RCTPromiseResolveBlock)resolve
|
|||
}
|
||||
|
||||
|
||||
RCT_EXPORT_METHOD(checkCameraAuthorizationStatus:(RCTPromiseResolveBlock)resolve
|
||||
RCT_EXPORT_METHOD(checkVideoAuthorizationStatus:(RCTPromiseResolveBlock)resolve
|
||||
reject:(__unused RCTPromiseRejectBlock)reject) {
|
||||
__block NSString *mediaType = AVMediaTypeVideo;
|
||||
|
||||
|
@ -185,7 +185,7 @@ RCT_EXPORT_METHOD(checkCameraAuthorizationStatus:(RCTPromiseResolveBlock)resolve
|
|||
RCT_EXPORT_METHOD(checkAudioAuthorizationStatus:(RCTPromiseResolveBlock)resolve
|
||||
reject:(__unused RCTPromiseRejectBlock)reject) {
|
||||
__block NSString *mediaType = AVMediaTypeAudio;
|
||||
|
||||
|
||||
[AVCaptureDevice requestAccessForMediaType:mediaType completionHandler:^(BOOL granted) {
|
||||
resolve(@(granted));
|
||||
}];
|
||||
|
@ -258,7 +258,7 @@ RCT_EXPORT_METHOD(changeOrientation:(NSInteger)orientation) {
|
|||
self.previewLayer.connection.videoOrientation = orientation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RCT_EXPORT_METHOD(changeMirrorImage:(BOOL)mirrorImage) {
|
||||
self.mirrorImage = mirrorImage;
|
||||
}
|
||||
|
@ -554,18 +554,18 @@ RCT_EXPORT_METHOD(hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRej
|
|||
else if (target == RCTCameraCaptureTargetDisk) {
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
NSString *documentsDirectory = [paths firstObject];
|
||||
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *fullPath = [[documentsDirectory stringByAppendingPathComponent:[[NSUUID UUID] UUIDString]] stringByAppendingPathExtension:@"jpg"];
|
||||
|
||||
|
||||
[fileManager createFileAtPath:fullPath contents:imageData attributes:nil];
|
||||
responseString = fullPath;
|
||||
}
|
||||
|
||||
|
||||
else if (target == RCTCameraCaptureTargetTemp) {
|
||||
NSString *fileName = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||
NSString *fullPath = [NSString stringWithFormat:@"%@%@.jpg", NSTemporaryDirectory(), fileName];
|
||||
|
||||
|
||||
[imageData writeToFile:fullPath atomically:YES];
|
||||
responseString = fullPath;
|
||||
}
|
||||
|
@ -711,10 +711,10 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
|
|||
else if (self.videoTarget == RCTCameraCaptureTargetTemp) {
|
||||
NSString *fileName = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||
NSString *fullPath = [NSString stringWithFormat:@"%@%@.mov", NSTemporaryDirectory(), fileName];
|
||||
|
||||
|
||||
NSFileManager * fileManager = [NSFileManager defaultManager];
|
||||
NSError * error = nil;
|
||||
|
||||
|
||||
//moving to destination
|
||||
if (!([fileManager moveItemAtPath:[outputFileURL path] toPath:fullPath error:&error])) {
|
||||
self.videoReject(RCTErrorUnspecified, nil, RCTErrorWithMessage(error.description));
|
||||
|
@ -734,7 +734,7 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
|
|||
if (metadata.type == barcodeType) {
|
||||
// Transform the meta-data coordinates to screen coords
|
||||
AVMetadataMachineReadableCodeObject *transformed = (AVMetadataMachineReadableCodeObject *)[_previewLayer transformedMetadataObjectForMetadataObject:metadata];
|
||||
|
||||
|
||||
NSDictionary *event = @{
|
||||
@"type": metadata.type,
|
||||
@"data": metadata.stringValue,
|
||||
|
@ -868,7 +868,7 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
|
|||
@"zoomFactor": [NSNumber numberWithDouble:zoomFactor],
|
||||
@"velocity": [NSNumber numberWithDouble:velocity]
|
||||
};
|
||||
|
||||
|
||||
[self.bridge.eventDispatcher sendInputEventWithName:@"zoomChanged" body:event];
|
||||
|
||||
device.videoZoomFactor = zoomFactor;
|
||||
|
|
Loading…
Reference in New Issue