expo-camera 11.2.2 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +15 -13
  2. package/android/build.gradle +3 -6
  3. package/android/src/main/java/expo/modules/camera/CameraModule.java +5 -5
  4. package/android/src/main/java/expo/modules/camera/CameraPackage.java +3 -3
  5. package/android/src/main/java/expo/modules/camera/CameraViewHelper.java +1 -1
  6. package/android/src/main/java/expo/modules/camera/CameraViewManager.java +4 -4
  7. package/android/src/main/java/expo/modules/camera/ExpoCameraView.java +5 -5
  8. package/android/src/main/java/expo/modules/camera/events/BarCodeScannedEvent.java +1 -1
  9. package/android/src/main/java/expo/modules/camera/events/CameraMountErrorEvent.java +1 -1
  10. package/android/src/main/java/expo/modules/camera/events/CameraReadyEvent.java +1 -1
  11. package/android/src/main/java/expo/modules/camera/events/FaceDetectionErrorEvent.java +1 -1
  12. package/android/src/main/java/expo/modules/camera/events/FacesDetectedEvent.java +1 -1
  13. package/android/src/main/java/expo/modules/camera/events/PictureSavedEvent.java +1 -1
  14. package/android/src/main/java/expo/modules/camera/tasks/ResolveTakenPictureAsyncTask.java +1 -1
  15. package/build/Camera.d.ts +26 -0
  16. package/build/Camera.js +103 -68
  17. package/build/Camera.js.map +1 -1
  18. package/build/Camera.types.d.ts +2 -2
  19. package/build/Camera.types.js +1 -1
  20. package/build/Camera.types.js.map +1 -1
  21. package/build/ExponentCamera.js +1 -1
  22. package/build/ExponentCamera.js.map +1 -1
  23. package/build/ExponentCamera.web.js +2 -1
  24. package/build/ExponentCamera.web.js.map +1 -1
  25. package/build/ExponentCameraManager.js +1 -1
  26. package/build/ExponentCameraManager.js.map +1 -1
  27. package/build/ExponentCameraManager.web.js +1 -1
  28. package/build/ExponentCameraManager.web.js.map +1 -1
  29. package/build/WebCameraUtils.js +4 -4
  30. package/build/WebCameraUtils.js.map +1 -1
  31. package/build/WebConstants.d.ts +1 -1
  32. package/build/WebUserMediaManager.js +9 -9
  33. package/build/WebUserMediaManager.js.map +1 -1
  34. package/build/useWebCameraStream.js +2 -2
  35. package/build/useWebCameraStream.js.map +1 -1
  36. package/build/utils/props.js +1 -1
  37. package/build/utils/props.js.map +1 -1
  38. package/ios/EXCamera/EXCamera.h +6 -6
  39. package/ios/EXCamera/EXCamera.m +76 -76
  40. package/ios/EXCamera/EXCameraCameraPermissionRequester.m +5 -5
  41. package/ios/EXCamera/EXCameraManager.h +4 -4
  42. package/ios/EXCamera/EXCameraManager.m +59 -59
  43. package/ios/EXCamera/EXCameraMicrophonePermissionRequester.m +5 -5
  44. package/ios/EXCamera/EXCameraPermissionRequester.m +5 -5
  45. package/ios/EXCamera.podspec +2 -2
  46. package/ios/EXCamera.xcframework/Info.plist +5 -5
  47. package/ios/EXCamera.xcframework/ios-arm64/EXCamera.framework/EXCamera +0 -0
  48. package/ios/EXCamera.xcframework/ios-arm64/EXCamera.framework/Info.plist +0 -0
  49. package/ios/EXCamera.xcframework/ios-arm64_x86_64-simulator/EXCamera.framework/EXCamera +0 -0
  50. package/ios/EXCamera.xcframework/ios-arm64_x86_64-simulator/EXCamera.framework/Info.plist +0 -0
  51. package/package.json +6 -6
  52. package/plugin/build/withCamera.js +2 -2
  53. package/plugin/src/withCamera.ts +2 -2
  54. package/src/Camera.tsx +61 -17
  55. package/src/Camera.types.ts +7 -2
  56. package/src/ExponentCamera.ts +3 -4
  57. package/src/ExponentCamera.web.tsx +1 -1
  58. package/src/ExponentCameraManager.ts +1 -1
  59. package/src/ExponentCameraManager.web.ts +2 -2
  60. package/src/WebCameraUtils.ts +5 -11
  61. package/src/WebUserMediaManager.ts +10 -10
  62. package/src/useWebCameraStream.ts +2 -2
  63. package/src/utils/props.ts +1 -1
@@ -5,8 +5,8 @@
5
5
  #import <EXCamera/EXCameraUtils.h>
6
6
  #import <EXCamera/EXCameraManager.h>
7
7
  #import <EXCamera/EXCameraCameraPermissionRequester.h>
8
- #import <UMCore/UMAppLifecycleService.h>
9
- #import <UMCore/UMUtilities.h>
8
+ #import <ExpoModulesCore/EXAppLifecycleService.h>
9
+ #import <ExpoModulesCore/EXUtilities.h>
10
10
  #import <ExpoModulesCore/EXFaceDetectorManagerInterface.h>
11
11
  #import <ExpoModulesCore/EXFaceDetectorManagerProviderInterface.h>
12
12
  #import <ExpoModulesCore/EXFileSystemInterface.h>
@@ -15,28 +15,28 @@
15
15
  @interface EXCamera ()
16
16
 
17
17
  @property (nonatomic, weak) id<EXFileSystemInterface> fileSystem;
18
- @property (nonatomic, weak) UMModuleRegistry *moduleRegistry;
18
+ @property (nonatomic, weak) EXModuleRegistry *moduleRegistry;
19
19
  @property (nonatomic, strong) id<EXFaceDetectorManagerInterface> faceDetectorManager;
20
20
  @property (nonatomic, strong) id<EXBarCodeScannerInterface> barCodeScanner;
21
21
  @property (nonatomic, weak) id<EXPermissionsInterface> permissionsManager;
22
- @property (nonatomic, weak) id<UMAppLifecycleService> lifecycleManager;
22
+ @property (nonatomic, weak) id<EXAppLifecycleService> lifecycleManager;
23
23
 
24
24
  @property (nonatomic, assign, getter=isSessionPaused) BOOL paused;
25
25
  @property (nonatomic, assign) BOOL isValidVideoOptions;
26
26
 
27
27
  @property (nonatomic, strong) NSDictionary *photoCaptureOptions;
28
- @property (nonatomic, strong) UMPromiseResolveBlock photoCapturedResolve;
29
- @property (nonatomic, strong) UMPromiseRejectBlock photoCapturedReject;
28
+ @property (nonatomic, strong) EXPromiseResolveBlock photoCapturedResolve;
29
+ @property (nonatomic, strong) EXPromiseRejectBlock photoCapturedReject;
30
30
 
31
- @property (nonatomic, strong) UMPromiseResolveBlock videoRecordedResolve;
32
- @property (nonatomic, strong) UMPromiseRejectBlock videoRecordedReject;
31
+ @property (nonatomic, strong) EXPromiseResolveBlock videoRecordedResolve;
32
+ @property (nonatomic, strong) EXPromiseRejectBlock videoRecordedReject;
33
33
 
34
- @property (nonatomic, copy) UMDirectEventBlock onCameraReady;
35
- @property (nonatomic, copy) UMDirectEventBlock onMountError;
36
- @property (nonatomic, copy) UMDirectEventBlock onPictureSaved;
34
+ @property (nonatomic, copy) EXDirectEventBlock onCameraReady;
35
+ @property (nonatomic, copy) EXDirectEventBlock onMountError;
36
+ @property (nonatomic, copy) EXDirectEventBlock onPictureSaved;
37
37
 
38
- @property (nonatomic, copy) UMDirectEventBlock onBarCodeScanned;
39
- @property (nonatomic, copy) UMDirectEventBlock onFacesDetected;
38
+ @property (nonatomic, copy) EXDirectEventBlock onBarCodeScanned;
39
+ @property (nonatomic, copy) EXDirectEventBlock onFacesDetected;
40
40
 
41
41
  @end
42
42
 
@@ -44,7 +44,7 @@
44
44
 
45
45
  static NSDictionary *defaultFaceDetectorOptions = nil;
46
46
 
47
- - (id)initWithModuleRegistry:(UMModuleRegistry *)moduleRegistry
47
+ - (id)initWithModuleRegistry:(EXModuleRegistry *)moduleRegistry
48
48
  {
49
49
  if ((self = [super init])) {
50
50
  _moduleRegistry = moduleRegistry;
@@ -52,7 +52,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
52
52
  _sessionQueue = dispatch_queue_create("cameraQueue", DISPATCH_QUEUE_SERIAL);
53
53
  _faceDetectorManager = [self createFaceDetectorManager];
54
54
  _barCodeScanner = [self createBarCodeScanner];
55
- _lifecycleManager = [moduleRegistry getModuleImplementingProtocol:@protocol(UMAppLifecycleService)];
55
+ _lifecycleManager = [moduleRegistry getModuleImplementingProtocol:@protocol(EXAppLifecycleService)];
56
56
  _fileSystem = [moduleRegistry getModuleImplementingProtocol:@protocol(EXFileSystemInterface)];
57
57
  _permissionsManager = [moduleRegistry getModuleImplementingProtocol:@protocol(EXPermissionsInterface)];
58
58
  #if !(TARGET_IPHONE_SIMULATOR)
@@ -133,9 +133,9 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
133
133
 
134
134
  - (void)updateType
135
135
  {
136
- UM_WEAKIFY(self);
136
+ EX_WEAKIFY(self);
137
137
  dispatch_async(_sessionQueue, ^{
138
- UM_ENSURE_STRONGIFY(self);
138
+ EX_ENSURE_STRONGIFY(self);
139
139
  [self initializeCaptureSessionInput];
140
140
  if (!self.session.isRunning) {
141
141
  [self startSession];
@@ -155,7 +155,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
155
155
 
156
156
  if (![device lockForConfiguration:&error]) {
157
157
  if (error) {
158
- UMLogInfo(@"%s: %@", __func__, error);
158
+ EXLogInfo(@"%s: %@", __func__, error);
159
159
  }
160
160
  return;
161
161
  }
@@ -166,7 +166,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
166
166
  [device unlockForConfiguration];
167
167
  } else {
168
168
  if (error) {
169
- UMLogInfo(@"%s: %@", __func__, error);
169
+ EXLogInfo(@"%s: %@", __func__, error);
170
170
  }
171
171
  }
172
172
  }
@@ -177,7 +177,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
177
177
 
178
178
  if (![device lockForConfiguration:&error]) {
179
179
  if (error) {
180
- UMLogInfo(@"%s: %@", __func__, error);
180
+ EXLogInfo(@"%s: %@", __func__, error);
181
181
  }
182
182
  return;
183
183
  }
@@ -191,7 +191,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
191
191
  [device unlockForConfiguration];
192
192
  } else {
193
193
  if (error) {
194
- UMLogInfo(@"%s: %@", __func__, error);
194
+ EXLogInfo(@"%s: %@", __func__, error);
195
195
  }
196
196
  }
197
197
  }
@@ -207,7 +207,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
207
207
 
208
208
  if (![device lockForConfiguration:&error]) {
209
209
  if (error) {
210
- UMLogInfo(@"%s: %@", __func__, error);
210
+ EXLogInfo(@"%s: %@", __func__, error);
211
211
  }
212
212
  return;
213
213
  }
@@ -217,7 +217,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
217
217
  [device setFocusMode:_autoFocus];
218
218
  } else {
219
219
  if (error) {
220
- UMLogInfo(@"%s: %@", __func__, error);
220
+ EXLogInfo(@"%s: %@", __func__, error);
221
221
  }
222
222
  }
223
223
  }
@@ -237,20 +237,20 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
237
237
  if ([device isLockingFocusWithCustomLensPositionSupported]) {
238
238
  if (![device lockForConfiguration:&error]) {
239
239
  if (error) {
240
- UMLogInfo(@"%s: %@", __func__, error);
240
+ EXLogInfo(@"%s: %@", __func__, error);
241
241
  }
242
242
  return;
243
243
  }
244
244
 
245
- UM_WEAKIFY(device);
245
+ EX_WEAKIFY(device);
246
246
  [device setFocusModeLockedWithLensPosition:_focusDepth completionHandler:^(CMTime syncTime) {
247
- UM_ENSURE_STRONGIFY(device);
247
+ EX_ENSURE_STRONGIFY(device);
248
248
  [device unlockForConfiguration];
249
249
  }];
250
250
  return;
251
251
  }
252
252
 
253
- UMLogInfo(@"%s: Setting focusDepth isn't supported for this camera device", __func__);
253
+ EXLogInfo(@"%s: Setting focusDepth isn't supported for this camera device", __func__);
254
254
  return;
255
255
  }
256
256
 
@@ -260,7 +260,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
260
260
 
261
261
  if (![device lockForConfiguration:&error]) {
262
262
  if (error) {
263
- UMLogInfo(@"%s: %@", __func__, error);
263
+ EXLogInfo(@"%s: %@", __func__, error);
264
264
  }
265
265
  return;
266
266
  }
@@ -277,7 +277,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
277
277
 
278
278
  if (![device lockForConfiguration:&error]) {
279
279
  if (error) {
280
- UMLogInfo(@"%s: %@", __func__, error);
280
+ EXLogInfo(@"%s: %@", __func__, error);
281
281
  }
282
282
  return;
283
283
  }
@@ -292,14 +292,14 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
292
292
  };
293
293
  AVCaptureWhiteBalanceGains rgbGains = [device deviceWhiteBalanceGainsForTemperatureAndTintValues:temperatureAndTint];
294
294
  if ([device lockForConfiguration:&error]) {
295
- UM_WEAKIFY(device);
295
+ EX_WEAKIFY(device);
296
296
  [device setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:rgbGains completionHandler:^(CMTime syncTime) {
297
- UM_ENSURE_STRONGIFY(device);
297
+ EX_ENSURE_STRONGIFY(device);
298
298
  [device unlockForConfiguration];
299
299
  }];
300
300
  } else {
301
301
  if (error) {
302
- UMLogInfo(@"%s: %@", __func__, error);
302
+ EXLogInfo(@"%s: %@", __func__, error);
303
303
  }
304
304
  }
305
305
  }
@@ -317,7 +317,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
317
317
  if (_barCodeScanner) {
318
318
  [_barCodeScanner setIsEnabled:barCodeScanning];
319
319
  } else if (barCodeScanning) {
320
- UMLogError(@"BarCodeScanner module not found. Make sure `expo-barcode-scanner` is installed and linked correctly.");
320
+ EXLogError(@"BarCodeScanner module not found. Make sure `expo-barcode-scanner` is installed and linked correctly.");
321
321
  }
322
322
  }
323
323
 
@@ -333,7 +333,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
333
333
  if (_faceDetectorManager) {
334
334
  [_faceDetectorManager setIsEnabled:faceDetecting];
335
335
  } else if (faceDetecting) {
336
- UMLogError(@"FaceDetector module not found. Make sure `expo-face-detector` is installed and linked correctly.");
336
+ EXLogError(@"FaceDetector module not found. Make sure `expo-face-detector` is installed and linked correctly.");
337
337
  }
338
338
  }
339
339
 
@@ -344,7 +344,7 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
344
344
  }
345
345
  }
346
346
 
347
- - (void)takePicture:(NSDictionary *)options resolve:(UMPromiseResolveBlock)resolve reject:(UMPromiseRejectBlock)reject
347
+ - (void)takePicture:(NSDictionary *)options resolve:(EXPromiseResolveBlock)resolve reject:(EXPromiseRejectBlock)reject
348
348
  {
349
349
  if (_photoCapturedResolve) {
350
350
  reject(@"E_ANOTHER_CAPTURE", @"Another photo capture is already being processed. Await the first call.", nil);
@@ -390,8 +390,8 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
390
390
  error:(NSError *)error
391
391
  {
392
392
  NSDictionary *options = _photoCaptureOptions;
393
- UMPromiseRejectBlock reject = _photoCapturedReject;
394
- UMPromiseResolveBlock resolve = _photoCapturedResolve;
393
+ EXPromiseRejectBlock reject = _photoCapturedReject;
394
+ EXPromiseResolveBlock resolve = _photoCapturedResolve;
395
395
  _photoCapturedResolve = nil;
396
396
  _photoCapturedReject = nil;
397
397
  _photoCaptureOptions = nil;
@@ -414,11 +414,11 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
414
414
  CFRelease(sourceCGIImageRef);
415
415
  }
416
416
 
417
- - (void)captureOutput:(AVCapturePhotoOutput *)output didFinishProcessingPhoto:(AVCapturePhoto *)photo error:(NSError *)error API_AVAILABLE(ios(11.0))
417
+ - (void)captureOutput:(AVCapturePhotoOutput *)output didFinishProcessingPhoto:(AVCapturePhoto *)photo error:(NSError *)error
418
418
  {
419
419
  NSDictionary *options = _photoCaptureOptions;
420
- UMPromiseRejectBlock reject = _photoCapturedReject;
421
- UMPromiseResolveBlock resolve = _photoCapturedResolve;
420
+ EXPromiseRejectBlock reject = _photoCapturedReject;
421
+ EXPromiseResolveBlock resolve = _photoCapturedResolve;
422
422
  _photoCapturedResolve = nil;
423
423
  _photoCapturedReject = nil;
424
424
  _photoCaptureOptions = nil;
@@ -437,7 +437,7 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
437
437
  [self handleCapturedImageData:imageData metadata:photo.metadata options:options resolver:resolve reject:reject];
438
438
  }
439
439
 
440
- - (void)handleCapturedImageData:(NSData *)imageData metadata:(NSDictionary *)metadata options:(NSDictionary *)options resolver:(UMPromiseResolveBlock)resolve reject:(UMPromiseRejectBlock)reject
440
+ - (void)handleCapturedImageData:(NSData *)imageData metadata:(NSDictionary *)metadata options:(NSDictionary *)options resolver:(EXPromiseResolveBlock)resolve reject:(EXPromiseRejectBlock)reject
441
441
  {
442
442
  UIImage *takenImage = [UIImage imageWithData:imageData];
443
443
  BOOL useFastMode = [options[@"fastMode"] boolValue];
@@ -498,7 +498,7 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
498
498
  }
499
499
  }
500
500
 
501
- - (void)record:(NSDictionary *)options resolve:(UMPromiseResolveBlock)resolve reject:(UMPromiseRejectBlock)reject
501
+ - (void)record:(NSDictionary *)options resolve:(EXPromiseResolveBlock)resolve reject:(EXPromiseRejectBlock)reject
502
502
  {
503
503
  if (_movieFileOutput == nil) {
504
504
  // At the time of writing AVCaptureMovieFileOutput and AVCaptureVideoDataOutput (> GMVDataOutput)
@@ -517,7 +517,7 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
517
517
  AVCaptureConnection *connection = [_movieFileOutput connectionWithMediaType:AVMediaTypeVideo];
518
518
  // TODO: Add support for videoStabilizationMode (right now it is not only read, never written to)
519
519
  if (connection.isVideoStabilizationSupported == NO) {
520
- UMLogWarn(@"%s: Video Stabilization is not supported on this device.", __func__);
520
+ EXLogWarn(@"%s: Video Stabilization is not supported on this device.", __func__);
521
521
  } else {
522
522
  [connection setPreferredVideoStabilizationMode:self.videoStabilizationMode];
523
523
  }
@@ -543,9 +543,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
543
543
  [connection setVideoMirrored:shouldBeMirrored];
544
544
  }
545
545
 
546
- UM_WEAKIFY(self);
546
+ EX_WEAKIFY(self);
547
547
  dispatch_async(self.sessionQueue, ^{
548
- UM_STRONGIFY(self);
548
+ EX_STRONGIFY(self);
549
549
  // it is possible that the session has been invalidated at this point
550
550
  // for example, the video codec option is invalid and so this call has already rejected
551
551
  if (!self.isValidVideoOptions) {
@@ -572,11 +572,11 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
572
572
 
573
573
  // Video options are set in an async block to prevent the possible race condition outlined here:
574
574
  // https://github.com/react-native-camera/react-native-camera/pull/2694
575
- - (void)setVideoOptions:(NSDictionary *)options forConnection:(AVCaptureConnection *)connection onReject:(UMPromiseRejectBlock)reject
575
+ - (void)setVideoOptions:(NSDictionary *)options forConnection:(AVCaptureConnection *)connection onReject:(EXPromiseRejectBlock)reject
576
576
  {
577
- UM_WEAKIFY(self);
577
+ EX_WEAKIFY(self);
578
578
  dispatch_async(_sessionQueue, ^{
579
- UM_STRONGIFY(self);
579
+ EX_STRONGIFY(self);
580
580
  // Reset validation flag
581
581
  self.isValidVideoOptions = YES;
582
582
 
@@ -652,9 +652,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
652
652
  [self onMountingError:@{@"message": @"Camera permissions not granted - component could not be rendered."}];
653
653
  return;
654
654
  }
655
- UM_WEAKIFY(self);
655
+ EX_WEAKIFY(self);
656
656
  dispatch_async(_sessionQueue, ^{
657
- UM_ENSURE_STRONGIFY(self);
657
+ EX_ENSURE_STRONGIFY(self);
658
658
 
659
659
  if (self.presetCamera == AVCaptureDevicePositionUnspecified) {
660
660
  return;
@@ -670,9 +670,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
670
670
 
671
671
  [self setRuntimeErrorHandlingObserver:
672
672
  [[NSNotificationCenter defaultCenter] addObserverForName:AVCaptureSessionRuntimeErrorNotification object:self.session queue:nil usingBlock:^(NSNotification *note) {
673
- UM_ENSURE_STRONGIFY(self);
673
+ EX_ENSURE_STRONGIFY(self);
674
674
  dispatch_async(self.sessionQueue, ^{
675
- UM_ENSURE_STRONGIFY(self)
675
+ EX_ENSURE_STRONGIFY(self)
676
676
  // Manually restarting the session since it must
677
677
  // have been stopped due to an error.
678
678
  [self.session startRunning];
@@ -684,7 +684,7 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
684
684
  // when BarCodeScanner is enabled since the beginning of camera component lifecycle,
685
685
  // some race condition occurs in reconfiguration and barcodes aren't scanned at all
686
686
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 50 * NSEC_PER_USEC), self.sessionQueue, ^{
687
- UM_ENSURE_STRONGIFY(self);
687
+ EX_ENSURE_STRONGIFY(self);
688
688
  [self maybeStartFaceDetection:self.presetCamera!=1];
689
689
  if (self.barCodeScanner) {
690
690
  [self.barCodeScanner maybeStartBarCodeScanning];
@@ -703,9 +703,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
703
703
  #if TARGET_IPHONE_SIMULATOR
704
704
  return;
705
705
  #endif
706
- UM_WEAKIFY(self);
706
+ EX_WEAKIFY(self);
707
707
  dispatch_async(_sessionQueue, ^{
708
- UM_ENSURE_STRONGIFY(self);
708
+ EX_ENSURE_STRONGIFY(self);
709
709
 
710
710
  if (self.faceDetectorManager) {
711
711
  [self.faceDetectorManager stopFaceDetection];
@@ -733,14 +733,14 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
733
733
  }
734
734
 
735
735
  __block UIInterfaceOrientation interfaceOrientation;
736
- [UMUtilities performSynchronouslyOnMainThread:^{
736
+ [EXUtilities performSynchronouslyOnMainThread:^{
737
737
  interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
738
738
  }];
739
739
  AVCaptureVideoOrientation orientation = [EXCameraUtils videoOrientationForInterfaceOrientation:interfaceOrientation];
740
740
 
741
- UM_WEAKIFY(self);
741
+ EX_WEAKIFY(self);
742
742
  dispatch_async(_sessionQueue, ^{
743
- UM_ENSURE_STRONGIFY(self);
743
+ EX_ENSURE_STRONGIFY(self);
744
744
 
745
745
  [self.session beginConfiguration];
746
746
 
@@ -779,9 +779,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
779
779
  // - torchMode: https://stackoverflow.com/a/53666293/4337317
780
780
  - (void)ensureSessionConfiguration
781
781
  {
782
- UM_WEAKIFY(self);
782
+ EX_WEAKIFY(self);
783
783
  dispatch_async(_sessionQueue, ^{
784
- UM_ENSURE_STRONGIFY(self);
784
+ EX_ENSURE_STRONGIFY(self);
785
785
  [self updateFlashMode];
786
786
  });
787
787
  }
@@ -792,9 +792,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
792
792
  {
793
793
  #if !(TARGET_IPHONE_SIMULATOR)
794
794
  if (preset) {
795
- UM_WEAKIFY(self);
795
+ EX_WEAKIFY(self);
796
796
  dispatch_async(_sessionQueue, ^{
797
- UM_ENSURE_STRONGIFY(self);
797
+ EX_ENSURE_STRONGIFY(self);
798
798
  [self.session beginConfiguration];
799
799
  if ([self.session canSetSessionPreset:preset]) {
800
800
  self.session.sessionPreset = preset;
@@ -807,9 +807,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
807
807
 
808
808
  - (void)updateSessionAudioIsMuted:(BOOL)isMuted
809
809
  {
810
- UM_WEAKIFY(self);
810
+ EX_WEAKIFY(self);
811
811
  dispatch_async(_sessionQueue, ^{
812
- UM_ENSURE_STRONGIFY(self);
812
+ EX_ENSURE_STRONGIFY(self);
813
813
  [self.session beginConfiguration];
814
814
 
815
815
  for (AVCaptureDeviceInput* input in [self.session inputs]) {
@@ -829,7 +829,7 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
829
829
  AVCaptureDeviceInput *audioDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:audioCaptureDevice error:&error];
830
830
 
831
831
  if (error || audioDeviceInput == nil) {
832
- UMLogInfo(@"%s: %@", __func__, error);
832
+ EXLogInfo(@"%s: %@", __func__, error);
833
833
  return;
834
834
  }
835
835
 
@@ -846,9 +846,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
846
846
  {
847
847
  if (![_session isRunning] && [self isSessionPaused]) {
848
848
  _paused = NO;
849
- UM_WEAKIFY(self);
849
+ EX_WEAKIFY(self);
850
850
  dispatch_async(_sessionQueue, ^{
851
- UM_ENSURE_STRONGIFY(self);
851
+ EX_ENSURE_STRONGIFY(self);
852
852
  [self.session startRunning];
853
853
  [self ensureSessionConfiguration];
854
854
  });
@@ -859,9 +859,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
859
859
  {
860
860
  if ([_session isRunning] && ![self isSessionPaused]) {
861
861
  _paused = YES;
862
- UM_WEAKIFY(self);
862
+ EX_WEAKIFY(self);
863
863
  dispatch_async(_sessionQueue, ^{
864
- UM_ENSURE_STRONGIFY(self);
864
+ EX_ENSURE_STRONGIFY(self);
865
865
  [self.session stopRunning];
866
866
  });
867
867
  }
@@ -875,10 +875,10 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
875
875
 
876
876
  - (void)changePreviewOrientation:(UIInterfaceOrientation)orientation
877
877
  {
878
- UM_WEAKIFY(self);
878
+ EX_WEAKIFY(self);
879
879
  AVCaptureVideoOrientation videoOrientation = [EXCameraUtils videoOrientationForInterfaceOrientation:orientation];
880
- [UMUtilities performSynchronouslyOnMainThread:^{
881
- UM_ENSURE_STRONGIFY(self);
880
+ [EXUtilities performSynchronouslyOnMainThread:^{
881
+ EX_ENSURE_STRONGIFY(self);
882
882
  if (self.previewLayer.connection.isVideoOrientationSupported) {
883
883
  [self.previewLayer.connection setVideoOrientation:videoOrientation];
884
884
  }
@@ -942,9 +942,9 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
942
942
  if (faceDetectorProvider) {
943
943
  id<EXFaceDetectorManagerInterface> faceDetector = [faceDetectorProvider createFaceDetectorManager];
944
944
  if (faceDetector) {
945
- UM_WEAKIFY(self);
945
+ EX_WEAKIFY(self);
946
946
  [faceDetector setOnFacesDetected:^(NSArray<NSDictionary *> *faces) {
947
- UM_ENSURE_STRONGIFY(self);
947
+ EX_ENSURE_STRONGIFY(self);
948
948
  if (self.onFacesDetected) {
949
949
  self.onFacesDetected(@{
950
950
  @"type": @"face",
@@ -967,11 +967,11 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
967
967
  if (barCodeScannerProvider) {
968
968
  id<EXBarCodeScannerInterface> barCodeScanner = [barCodeScannerProvider createBarCodeScanner];
969
969
  if (barCodeScanner) {
970
- UM_WEAKIFY(self);
970
+ EX_WEAKIFY(self);
971
971
  [barCodeScanner setSession:_session];
972
972
  [barCodeScanner setSessionQueue:_sessionQueue];
973
973
  [barCodeScanner setOnBarCodeScanned:^(NSDictionary *body) {
974
- UM_ENSURE_STRONGIFY(self);
974
+ EX_ENSURE_STRONGIFY(self);
975
975
  [self onBarCodeScanned:body];
976
976
  }];
977
977
  }
@@ -1,7 +1,7 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
3
  #import <EXCamera/EXCameraCameraPermissionRequester.h>
4
- #import <UMCore/UMDefines.h>
4
+ #import <ExpoModulesCore/EXDefines.h>
5
5
  #import <ExpoModulesCore/EXPermissionsInterface.h>
6
6
 
7
7
  #import <AVFoundation/AVFoundation.h>
@@ -20,7 +20,7 @@
20
20
  NSString *cameraUsageDescription = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSCameraUsageDescription"];
21
21
 
22
22
  if (!cameraUsageDescription) {
23
- UMFatal(UMErrorWithMessage(@"This app is missing NSCameraUsageDescription, so video services will fail. Add this entry to your bundle's Info.plist."));
23
+ EXFatal(EXErrorWithMessage(@"This app is missing NSCameraUsageDescription, so video services will fail. Add this entry to your bundle's Info.plist."));
24
24
  systemStatus = AVAuthorizationStatusDenied;
25
25
  } else {
26
26
  systemStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
@@ -42,11 +42,11 @@
42
42
  };
43
43
  }
44
44
 
45
- - (void)requestPermissionsWithResolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject
45
+ - (void)requestPermissionsWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject
46
46
  {
47
- UM_WEAKIFY(self)
47
+ EX_WEAKIFY(self)
48
48
  [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
49
- UM_STRONGIFY(self)
49
+ EX_STRONGIFY(self)
50
50
  resolve([self getPermissions]);
51
51
  }];
52
52
  }
@@ -1,9 +1,9 @@
1
1
  #import <AVFoundation/AVFoundation.h>
2
- #import <UMCore/UMViewManager.h>
3
- #import <UMCore/UMExportedModule.h>
4
- #import <UMCore/UMModuleRegistryConsumer.h>
2
+ #import <ExpoModulesCore/EXViewManager.h>
3
+ #import <ExpoModulesCore/EXExportedModule.h>
4
+ #import <ExpoModulesCore/EXModuleRegistryConsumer.h>
5
5
  #import <EXCamera/EXCamera.h>
6
6
 
7
- @interface EXCameraManager : UMViewManager <UMModuleRegistryConsumer>
7
+ @interface EXCameraManager : EXViewManager <EXModuleRegistryConsumer>
8
8
 
9
9
  @end