expo-camera 14.1.0 → 14.1.2

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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,17 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 14.1.2 — 2024-04-08
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Allow users using xcode 14 to still build when including camera. ([#27873](https://github.com/expo/expo/pull/27873) by [@alanjhughes](https://github.com/alanjhughes))
18
+ - Fix an issue where the permission functions were being imported from the wrong file. ([#27988](https://github.com/expo/expo/pull/27988) by [@alanjhughes](https://github.com/alanjhughes))
19
+
20
+ ## 14.1.1 — 2024-03-13
21
+
22
+ _This version does not introduce any user-facing changes._
23
+
13
24
  ## 14.1.0 — 2024-03-13
14
25
 
15
26
  ### 🐛 Bug fixes
@@ -23,6 +34,7 @@
23
34
  - Ensure `mute` prop is passed to native so it is correctly initialiased even when not provided from JS. ([#27546](https://github.com/expo/expo/pull/27546) by [@alanjhughes](https://github.com/alanjhughes))
24
35
  - On `iOS`, fix camera orientation on initial render. ([#27545](https://github.com/expo/expo/pull/27545) by [@alanjhughes](https://github.com/alanjhughes))
25
36
  - On `iOS`, fix an issue where the configuration can be interuppted when the dev menu is presented on intial launch. ([#27572](https://github.com/expo/expo/pull/27572) by [@alanjhughes](https://github.com/alanjhughes))
37
+ - On `iOS`, fix `getAvailablePictureSizes` in the legacy package. ([#27642](https://github.com/expo/expo/pull/27642) by [@alanjhughes](https://github.com/alanjhughes))
26
38
 
27
39
  ## 14.0.6 — 2024-03-07
28
40
 
@@ -45,6 +57,7 @@
45
57
  ### 💡 Others
46
58
 
47
59
  - Make the casing of `Barcode` consistent. ([#26900](https://github.com/expo/expo/pull/26900) by [@alanjhughes](https://github.com/alanjhughes))
60
+ - On `Android`, requesting audio permissions was meant to be optional in the config plugin. ([#27365](https://github.com/expo/expo/pull/27365) by [@alanjhughes](https://github.com/alanjhughes))
48
61
 
49
62
  ## 14.0.4 — 2024-02-06
50
63
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '14.1.0'
6
+ version = '14.1.2'
7
7
 
8
8
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
9
  if (expoModulesCorePlugin.exists()) {
@@ -94,7 +94,7 @@ android {
94
94
  namespace "expo.modules.camera"
95
95
  defaultConfig {
96
96
  versionCode 32
97
- versionName "14.1.0"
97
+ versionName "14.1.2"
98
98
  }
99
99
  }
100
100
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAGrD;;;GAGG;AACH,iBAAe,yBAAyB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAEtE;AAGD;;;;GAIG;AACH,iBAAe,6BAA6B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAE1E;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,wLAG/B,CAAC;AAGH;;;GAGG;AACH,iBAAe,6BAA6B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAE1E;AAGD;;;;GAIG;AACH,iBAAe,iCAAiC,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAE9E;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,wLAGnC,CAAC;AAEH,cAAc,gBAAgB,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;CAKlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAGrD;;;GAGG;AACH,iBAAe,yBAAyB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAEtE;AAGD;;;;GAIG;AACH,iBAAe,6BAA6B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAE1E;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,wLAG/B,CAAC;AAGH;;;GAGG;AACH,iBAAe,6BAA6B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAE1E;AAGD;;;;GAIG;AACH,iBAAe,iCAAiC,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAE9E;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,wLAGnC,CAAC;AAEH,cAAc,gBAAgB,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;CAKlB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { createPermissionHook } from 'expo-modules-core';
2
- import CameraManager from '../ExpoCameraManager';
2
+ import CameraManager from './ExpoCameraManager';
3
3
  export { default as CameraView } from './CameraView';
4
4
  // @needsAudit
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,cAAc;AACd;;;GAGG;AACH,KAAK,UAAU,yBAAyB;IACtC,OAAO,aAAa,CAAC,yBAAyB,EAAE,CAAC;AACnD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,KAAK,UAAU,6BAA6B;IAC1C,OAAO,aAAa,CAAC,6BAA6B,EAAE,CAAC;AACvD,CAAC;AAED,cAAc;AACd;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;IACvD,SAAS,EAAE,yBAAyB;IACpC,aAAa,EAAE,6BAA6B;CAC7C,CAAC,CAAC;AAEH,cAAc;AACd;;;GAGG;AACH,KAAK,UAAU,6BAA6B;IAC1C,OAAO,aAAa,CAAC,6BAA6B,EAAE,CAAC;AACvD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,KAAK,UAAU,iCAAiC;IAC9C,OAAO,aAAa,CAAC,iCAAiC,EAAE,CAAC;AAC3D,CAAC;AAED,cAAc;AACd;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;IAC3D,SAAS,EAAE,6BAA6B;IACxC,aAAa,EAAE,iCAAiC;CACjD,CAAC,CAAC;AAEH,cAAc,gBAAgB,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,yBAAyB;IACzB,6BAA6B;IAC7B,6BAA6B;IAC7B,iCAAiC;CAClC,CAAC","sourcesContent":["import { createPermissionHook } from 'expo-modules-core';\n\nimport { PermissionResponse } from '../Camera.types';\nimport CameraManager from '../ExpoCameraManager';\n\nexport { default as CameraView } from './CameraView';\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing camera.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function getCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing camera.\n * On iOS this will require apps to specify an `NSCameraUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function requestCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = useCameraPermissions();\n * ```\n */\nexport const useCameraPermissions = createPermissionHook({\n getMethod: getCameraPermissionsAsync,\n requestMethod: requestCameraPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing microphone.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function getMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getMicrophonePermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing the microphone.\n * On iOS this will require apps to specify an `NSMicrophoneUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function requestMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestMicrophonePermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the microphone.\n * This uses both `requestMicrophonePermissionsAsync` and `getMicrophonePermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Camera.useMicrophonePermissions();\n * ```\n */\nexport const useMicrophonePermissions = createPermissionHook({\n getMethod: getMicrophonePermissionsAsync,\n requestMethod: requestMicrophonePermissionsAsync,\n});\n\nexport * from './Camera.types';\n\n/**\n * @hidden\n */\nexport const Camera = {\n getCameraPermissionsAsync,\n requestCameraPermissionsAsync,\n getMicrophonePermissionsAsync,\n requestMicrophonePermissionsAsync,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAGhD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,cAAc;AACd;;;GAGG;AACH,KAAK,UAAU,yBAAyB;IACtC,OAAO,aAAa,CAAC,yBAAyB,EAAE,CAAC;AACnD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,KAAK,UAAU,6BAA6B;IAC1C,OAAO,aAAa,CAAC,6BAA6B,EAAE,CAAC;AACvD,CAAC;AAED,cAAc;AACd;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;IACvD,SAAS,EAAE,yBAAyB;IACpC,aAAa,EAAE,6BAA6B;CAC7C,CAAC,CAAC;AAEH,cAAc;AACd;;;GAGG;AACH,KAAK,UAAU,6BAA6B;IAC1C,OAAO,aAAa,CAAC,6BAA6B,EAAE,CAAC;AACvD,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,KAAK,UAAU,iCAAiC;IAC9C,OAAO,aAAa,CAAC,iCAAiC,EAAE,CAAC;AAC3D,CAAC;AAED,cAAc;AACd;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;IAC3D,SAAS,EAAE,6BAA6B;IACxC,aAAa,EAAE,iCAAiC;CACjD,CAAC,CAAC;AAEH,cAAc,gBAAgB,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,yBAAyB;IACzB,6BAA6B;IAC7B,6BAA6B;IAC7B,iCAAiC;CAClC,CAAC","sourcesContent":["import { createPermissionHook } from 'expo-modules-core';\n\nimport CameraManager from './ExpoCameraManager';\nimport { PermissionResponse } from '../Camera.types';\n\nexport { default as CameraView } from './CameraView';\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing camera.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function getCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing camera.\n * On iOS this will require apps to specify an `NSCameraUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function requestCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = useCameraPermissions();\n * ```\n */\nexport const useCameraPermissions = createPermissionHook({\n getMethod: getCameraPermissionsAsync,\n requestMethod: requestCameraPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing microphone.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function getMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getMicrophonePermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing the microphone.\n * On iOS this will require apps to specify an `NSMicrophoneUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\nasync function requestMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestMicrophonePermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the microphone.\n * This uses both `requestMicrophonePermissionsAsync` and `getMicrophonePermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Camera.useMicrophonePermissions();\n * ```\n */\nexport const useMicrophonePermissions = createPermissionHook({\n getMethod: getMicrophonePermissionsAsync,\n requestMethod: requestMicrophonePermissionsAsync,\n});\n\nexport * from './Camera.types';\n\n/**\n * @hidden\n */\nexport const Camera = {\n getCameraPermissionsAsync,\n requestCameraPermissionsAsync,\n getMicrophonePermissionsAsync,\n requestMicrophonePermissionsAsync,\n};\n"]}
@@ -201,7 +201,9 @@ public final class CameraViewModule: Module {
201
201
 
202
202
  AsyncFunction("getAvailablePictureSizes") { (_: String?, _: Int) in
203
203
  // Argument types must be compatible with Android which receives the ratio and view tag.
204
- return pictureSizesDict.keys
204
+ return pictureSizesDict.map { k, _ in
205
+ k
206
+ }
205
207
  }
206
208
 
207
209
  AsyncFunction("getAvailableVideoCodecsAsync") { () -> [String] in
@@ -119,7 +119,7 @@ public final class CameraViewNextModule: Module, ScannerResultHandler {
119
119
 
120
120
  AsyncFunction("launchScanner") { (options: VisionScannerOptions?) in
121
121
  if #available(iOS 16.0, *) {
122
- try await MainActor.run {
122
+ await MainActor.run {
123
123
  let delegate = VisionScannerDelegate(handler: self)
124
124
  scannerContext = ScannerContext(delegate: delegate)
125
125
  launchScanner(with: options)
@@ -210,7 +210,7 @@ public class CameraViewNext: ExpoView, EXCameraInterface, EXAppLifecycleListener
210
210
 
211
211
  self.addErrorNotification()
212
212
  self.changePreviewOrientation()
213
- self.session.commitConfiguration()
213
+ self.updateSessionAudioIsMuted()
214
214
 
215
215
  // Delay starting the scanner
216
216
  self.sessionQueue.asyncAfter(deadline: .now() + 0.5) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-camera",
3
- "version": "14.1.0",
3
+ "version": "14.1.2",
4
4
  "description": "A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to the app's cache. Morever, the component is also capable of detecting faces and bar codes appearing on the preview.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "peerDependencies": {
43
43
  "expo": "*"
44
44
  },
45
- "gitHead": "d846eb40fc384b9e4b21260af2a990dfe79cf461"
45
+ "gitHead": "2ad93407e82a11504d6cc2412cf3d76858782619"
46
46
  }
@@ -4,5 +4,6 @@ export declare function addCameraImport(src: string): MergeResults;
4
4
  declare const _default: ConfigPlugin<void | {
5
5
  cameraPermission?: string | undefined;
6
6
  microphonePermission?: string | undefined;
7
+ recordAudioAndroid?: boolean | undefined;
7
8
  }>;
8
9
  export default _default;
@@ -55,7 +55,7 @@ function appendContents({ src, newSrc, tag, comment, }) {
55
55
  }
56
56
  return { contents: src, didClear: false, didMerge: false };
57
57
  }
58
- const withCamera = (config, { cameraPermission, microphonePermission } = {}) => {
58
+ const withCamera = (config, { cameraPermission, microphonePermission, recordAudioAndroid = true } = {}) => {
59
59
  config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
60
60
  config.modResults.NSCameraUsageDescription =
61
61
  cameraPermission || config.modResults.NSCameraUsageDescription || CAMERA_USAGE;
@@ -66,8 +66,8 @@ const withCamera = (config, { cameraPermission, microphonePermission } = {}) =>
66
66
  config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
67
67
  'android.permission.CAMERA',
68
68
  // Optional
69
- 'android.permission.RECORD_AUDIO',
70
- ]);
69
+ recordAudioAndroid && 'android.permission.RECORD_AUDIO',
70
+ ].filter(Boolean));
71
71
  return withAndroidCameraGradle(config);
72
72
  };
73
73
  exports.default = (0, config_plugins_1.createRunOncePlugin)(withCamera, pkg.name, pkg.version);
@@ -82,8 +82,9 @@ const withCamera: ConfigPlugin<
82
82
  {
83
83
  cameraPermission?: string;
84
84
  microphonePermission?: string;
85
+ recordAudioAndroid?: boolean;
85
86
  } | void
86
- > = (config, { cameraPermission, microphonePermission } = {}) => {
87
+ > = (config, { cameraPermission, microphonePermission, recordAudioAndroid = true } = {}) => {
87
88
  config = withInfoPlist(config, (config) => {
88
89
  config.modResults.NSCameraUsageDescription =
89
90
  cameraPermission || config.modResults.NSCameraUsageDescription || CAMERA_USAGE;
@@ -94,11 +95,14 @@ const withCamera: ConfigPlugin<
94
95
  return config;
95
96
  });
96
97
 
97
- config = AndroidConfig.Permissions.withPermissions(config, [
98
- 'android.permission.CAMERA',
99
- // Optional
100
- 'android.permission.RECORD_AUDIO',
101
- ]);
98
+ config = AndroidConfig.Permissions.withPermissions(
99
+ config,
100
+ [
101
+ 'android.permission.CAMERA',
102
+ // Optional
103
+ recordAudioAndroid && 'android.permission.RECORD_AUDIO',
104
+ ].filter(Boolean) as string[]
105
+ );
102
106
 
103
107
  return withAndroidCameraGradle(config);
104
108
  };
package/src/next/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createPermissionHook } from 'expo-modules-core';
2
2
 
3
+ import CameraManager from './ExpoCameraManager';
3
4
  import { PermissionResponse } from '../Camera.types';
4
- import CameraManager from '../ExpoCameraManager';
5
5
 
6
6
  export { default as CameraView } from './CameraView';
7
7