expo-camera 14.1.2 → 15.0.0

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 (218) hide show
  1. package/CHANGELOG.md +27 -13
  2. package/android/build.gradle +10 -96
  3. package/android/src/main/java/expo/modules/camera/CameraExceptions.kt +3 -1
  4. package/android/src/main/java/expo/modules/camera/CameraViewHelper.kt +6 -92
  5. package/android/src/main/java/expo/modules/camera/CameraViewModule.kt +112 -173
  6. package/android/src/main/java/expo/modules/camera/ExpoCameraView.kt +376 -287
  7. package/android/src/main/java/expo/modules/camera/Options.kt +15 -28
  8. package/android/src/main/java/expo/modules/camera/{next/analyzers → analyzers}/BarcodeAnalyzer.kt +4 -4
  9. package/android/src/main/java/expo/modules/camera/{Events.kt → common/CommonEvents.kt} +4 -14
  10. package/android/src/main/java/expo/modules/camera/legacy/CameraExceptions.kt +7 -0
  11. package/android/src/main/java/expo/modules/camera/legacy/CameraViewHelper.kt +128 -0
  12. package/android/src/main/java/expo/modules/camera/legacy/CameraViewLegacyModule.kt +265 -0
  13. package/android/src/main/java/expo/modules/camera/legacy/Events.kt +15 -0
  14. package/android/src/main/java/expo/modules/camera/{ExifTags.kt → legacy/ExifTags.kt} +1 -1
  15. package/android/src/main/java/expo/modules/camera/legacy/ExpoCameraView.kt +434 -0
  16. package/android/src/main/java/expo/modules/camera/legacy/Options.kt +35 -0
  17. package/android/src/main/java/expo/modules/camera/{tasks → legacy/tasks}/BarCodeScannerAsyncTask.kt +1 -1
  18. package/android/src/main/java/expo/modules/camera/{tasks → legacy/tasks}/BarCodeScannerAsyncTaskDelegate.kt +1 -1
  19. package/android/src/main/java/expo/modules/camera/{tasks → legacy/tasks}/FaceDetectorAsyncTaskDelegate.kt +1 -1
  20. package/android/src/main/java/expo/modules/camera/{tasks → legacy/tasks}/FaceDetectorTask.kt +1 -1
  21. package/android/src/main/java/expo/modules/camera/legacy/tasks/PictureSavedDelegate.kt +7 -0
  22. package/android/src/main/java/expo/modules/camera/{tasks → legacy/tasks}/ResolveTakenPictureAsyncTask.kt +6 -6
  23. package/android/src/main/java/expo/modules/camera/{next → legacy}/utils/FileSystemUtils.kt +9 -1
  24. package/android/src/main/java/expo/modules/camera/{next → legacy}/utils/ImageDimensions.kt +2 -4
  25. package/android/src/main/java/expo/modules/camera/{next/records → records}/CameraRecords.kt +1 -1
  26. package/android/src/main/java/expo/modules/camera/tasks/PictureSavedDelegate.kt +1 -1
  27. package/android/src/main/java/expo/modules/camera/{next/tasks → tasks}/ResolveTakenPicture.kt +6 -6
  28. package/android/src/main/java/expo/modules/camera/utils/FileSystemUtils.kt +0 -8
  29. package/android/src/main/java/expo/modules/camera/utils/ImageDimensions.kt +3 -1
  30. package/build/Camera.types.d.ts +114 -214
  31. package/build/Camera.types.d.ts.map +1 -1
  32. package/build/Camera.types.js +0 -106
  33. package/build/Camera.types.js.map +1 -1
  34. package/build/{next/CameraView.d.ts → CameraView.d.ts} +8 -2
  35. package/build/CameraView.d.ts.map +1 -0
  36. package/build/{next/CameraView.js → CameraView.js} +8 -0
  37. package/build/CameraView.js.map +1 -0
  38. package/build/ExpoCamera.d.ts +2 -2
  39. package/build/ExpoCamera.d.ts.map +1 -1
  40. package/build/ExpoCamera.js +2 -2
  41. package/build/ExpoCamera.js.map +1 -1
  42. package/build/ExpoCamera.web.d.ts +2 -2
  43. package/build/ExpoCamera.web.d.ts.map +1 -1
  44. package/build/ExpoCamera.web.js +9 -11
  45. package/build/ExpoCamera.web.js.map +1 -1
  46. package/build/ExpoCameraManager.d.ts +2 -2
  47. package/build/ExpoCameraManager.d.ts.map +1 -1
  48. package/build/ExpoCameraManager.js +1 -2
  49. package/build/ExpoCameraManager.js.map +1 -1
  50. package/build/ExpoCameraManager.web.d.ts +2 -3
  51. package/build/ExpoCameraManager.web.d.ts.map +1 -1
  52. package/build/ExpoCameraManager.web.js +2 -5
  53. package/build/ExpoCameraManager.web.js.map +1 -1
  54. package/build/index.d.ts +53 -2
  55. package/build/index.d.ts.map +1 -1
  56. package/build/index.js +74 -2
  57. package/build/index.js.map +1 -1
  58. package/build/{Camera.d.ts → legacy/Camera.d.ts} +2 -2
  59. package/build/legacy/Camera.d.ts.map +1 -0
  60. package/build/legacy/Camera.js.map +1 -0
  61. package/build/{next → legacy}/Camera.types.d.ts +215 -103
  62. package/build/legacy/Camera.types.d.ts.map +1 -0
  63. package/build/legacy/Camera.types.js +109 -0
  64. package/build/legacy/Camera.types.js.map +1 -0
  65. package/build/legacy/ExpoCamera.d.ts +5 -0
  66. package/build/legacy/ExpoCamera.d.ts.map +1 -0
  67. package/build/legacy/ExpoCamera.js +4 -0
  68. package/build/legacy/ExpoCamera.js.map +1 -0
  69. package/build/legacy/ExpoCamera.web.d.ts +13 -0
  70. package/build/legacy/ExpoCamera.web.d.ts.map +1 -0
  71. package/build/{next → legacy}/ExpoCamera.web.js +11 -9
  72. package/build/legacy/ExpoCamera.web.js.map +1 -0
  73. package/build/legacy/ExpoCameraManager.d.ts +3 -0
  74. package/build/legacy/ExpoCameraManager.d.ts.map +1 -0
  75. package/build/legacy/ExpoCameraManager.js +4 -0
  76. package/build/legacy/ExpoCameraManager.js.map +1 -0
  77. package/build/{next → legacy}/ExpoCameraManager.web.d.ts +2 -3
  78. package/build/legacy/ExpoCameraManager.web.d.ts.map +1 -0
  79. package/build/{next → legacy}/ExpoCameraManager.web.js +2 -5
  80. package/build/legacy/ExpoCameraManager.web.js.map +1 -0
  81. package/build/legacy/index.d.ts +4 -0
  82. package/build/legacy/index.d.ts.map +1 -0
  83. package/build/legacy/index.js +4 -0
  84. package/build/legacy/index.js.map +1 -0
  85. package/build/legacy/utils/props.d.ts +10 -0
  86. package/build/legacy/utils/props.d.ts.map +1 -0
  87. package/build/{next → legacy}/utils/props.js +13 -4
  88. package/build/legacy/utils/props.js.map +1 -0
  89. package/build/utils/props.d.ts +3 -5
  90. package/build/utils/props.d.ts.map +1 -1
  91. package/build/utils/props.js +4 -13
  92. package/build/utils/props.js.map +1 -1
  93. package/build/{WebCameraUtils.d.ts → web/WebCameraUtils.d.ts} +1 -1
  94. package/build/web/WebCameraUtils.d.ts.map +1 -0
  95. package/build/{WebCameraUtils.js → web/WebCameraUtils.js} +1 -1
  96. package/build/web/WebCameraUtils.js.map +1 -0
  97. package/build/web/WebCapabilityUtils.d.ts.map +1 -0
  98. package/build/web/WebCapabilityUtils.js.map +1 -0
  99. package/build/{WebConstants.d.ts → web/WebConstants.d.ts} +1 -1
  100. package/build/web/WebConstants.d.ts.map +1 -0
  101. package/build/{WebConstants.js → web/WebConstants.js} +1 -1
  102. package/build/web/WebConstants.js.map +1 -0
  103. package/build/web/WebUserMediaManager.d.ts.map +1 -0
  104. package/build/web/WebUserMediaManager.js.map +1 -0
  105. package/build/{useWebCameraStream.d.ts → web/useWebCameraStream.d.ts} +1 -1
  106. package/build/web/useWebCameraStream.d.ts.map +1 -0
  107. package/build/web/useWebCameraStream.js.map +1 -0
  108. package/build/{useWebQRScanner.d.ts → web/useWebQRScanner.d.ts} +1 -1
  109. package/build/web/useWebQRScanner.d.ts.map +1 -0
  110. package/build/{useWebQRScanner.js → web/useWebQRScanner.js} +5 -0
  111. package/build/web/useWebQRScanner.js.map +1 -0
  112. package/expo-module.config.json +3 -3
  113. package/ios/CameraViewLegacyModule.swift +307 -0
  114. package/ios/CameraViewModule.swift +147 -233
  115. package/ios/{Next/ExpoCameraUtilsNext.swift → Common/ExpoCameraUtils.swift} +5 -5
  116. package/ios/{TakePictureOptions.swift → Common/TakePictureOptions.swift} +0 -2
  117. package/ios/{Next → Current}/BarcodeRecord.swift +10 -10
  118. package/ios/{Next → Current}/BarcodeScannerUtils.swift +22 -1
  119. package/ios/Current/CameraEnums.swift +38 -0
  120. package/ios/{CameraRecordingOptions.swift → Current/CameraRecordingOptions.swift} +35 -1
  121. package/ios/{Next/CameraViewNext.swift → Current/CameraView.swift} +76 -64
  122. package/ios/{CameraEnums.swift → Legacy/CameraEnumsLegacy.swift} +6 -6
  123. package/ios/Legacy/CameraRecordingOptionsLegacy.swift +10 -0
  124. package/ios/{CameraView.swift → Legacy/CameraViewLegacy.swift} +10 -9
  125. package/ios/SimulatorUtils.swift +45 -0
  126. package/legacy.d.ts +1 -0
  127. package/legacy.js +1 -0
  128. package/package.json +2 -2
  129. package/plugin/build/withCamera.d.ts +2 -2
  130. package/plugin/build/withCamera.js +7 -8
  131. package/plugin/src/withCamera.ts +9 -11
  132. package/src/Camera.types.ts +131 -211
  133. package/src/{next/CameraView.tsx → CameraView.tsx} +9 -0
  134. package/src/ExpoCamera.ts +2 -3
  135. package/src/ExpoCamera.web.tsx +10 -11
  136. package/src/ExpoCameraManager.ts +1 -3
  137. package/src/ExpoCameraManager.web.ts +3 -6
  138. package/src/index.ts +82 -8
  139. package/src/{next → legacy}/Camera.types.ts +212 -120
  140. package/src/{next → legacy}/ExpoCamera.ts +3 -3
  141. package/src/{next → legacy}/ExpoCamera.web.tsx +11 -10
  142. package/src/legacy/ExpoCameraManager.ts +5 -0
  143. package/src/{next → legacy}/ExpoCameraManager.web.ts +3 -6
  144. package/src/legacy/index.ts +12 -0
  145. package/src/{next → legacy}/utils/props.ts +27 -7
  146. package/src/utils/props.ts +7 -27
  147. package/src/{WebCameraUtils.ts → web/WebCameraUtils.ts} +4 -4
  148. package/src/{WebConstants.ts → web/WebConstants.ts} +1 -1
  149. package/src/{useWebCameraStream.ts → web/useWebCameraStream.ts} +3 -3
  150. package/src/{useWebQRScanner.ts → web/useWebQRScanner.ts} +11 -1
  151. package/android/src/main/java/expo/modules/camera/next/CameraExceptions.kt +0 -9
  152. package/android/src/main/java/expo/modules/camera/next/CameraViewHelper.kt +0 -43
  153. package/android/src/main/java/expo/modules/camera/next/CameraViewNextModule.kt +0 -168
  154. package/android/src/main/java/expo/modules/camera/next/ExpoCameraView.kt +0 -462
  155. package/android/src/main/java/expo/modules/camera/next/Options.kt +0 -22
  156. package/android/src/main/java/expo/modules/camera/next/tasks/PictureSavedDelegate.kt +0 -7
  157. package/build/Camera.d.ts.map +0 -1
  158. package/build/Camera.js.map +0 -1
  159. package/build/WebCameraUtils.d.ts.map +0 -1
  160. package/build/WebCameraUtils.js.map +0 -1
  161. package/build/WebCapabilityUtils.d.ts.map +0 -1
  162. package/build/WebCapabilityUtils.js.map +0 -1
  163. package/build/WebConstants.d.ts.map +0 -1
  164. package/build/WebConstants.js.map +0 -1
  165. package/build/WebUserMediaManager.d.ts.map +0 -1
  166. package/build/WebUserMediaManager.js.map +0 -1
  167. package/build/next/Camera.types.d.ts.map +0 -1
  168. package/build/next/Camera.types.js +0 -3
  169. package/build/next/Camera.types.js.map +0 -1
  170. package/build/next/CameraView.d.ts.map +0 -1
  171. package/build/next/CameraView.js.map +0 -1
  172. package/build/next/ExpoCamera.d.ts +0 -5
  173. package/build/next/ExpoCamera.d.ts.map +0 -1
  174. package/build/next/ExpoCamera.js +0 -4
  175. package/build/next/ExpoCamera.js.map +0 -1
  176. package/build/next/ExpoCamera.web.d.ts +0 -13
  177. package/build/next/ExpoCamera.web.d.ts.map +0 -1
  178. package/build/next/ExpoCamera.web.js.map +0 -1
  179. package/build/next/ExpoCameraManager.d.ts +0 -3
  180. package/build/next/ExpoCameraManager.d.ts.map +0 -1
  181. package/build/next/ExpoCameraManager.js +0 -3
  182. package/build/next/ExpoCameraManager.js.map +0 -1
  183. package/build/next/ExpoCameraManager.web.d.ts.map +0 -1
  184. package/build/next/ExpoCameraManager.web.js.map +0 -1
  185. package/build/next/index.d.ts +0 -55
  186. package/build/next/index.d.ts.map +0 -1
  187. package/build/next/index.js +0 -76
  188. package/build/next/index.js.map +0 -1
  189. package/build/next/utils/props.d.ts +0 -8
  190. package/build/next/utils/props.d.ts.map +0 -1
  191. package/build/next/utils/props.js.map +0 -1
  192. package/build/useWebCameraStream.d.ts.map +0 -1
  193. package/build/useWebCameraStream.js.map +0 -1
  194. package/build/useWebQRScanner.d.ts.map +0 -1
  195. package/build/useWebQRScanner.js.map +0 -1
  196. package/ios/CameraViewNextModule.swift +0 -284
  197. package/ios/ExpoCameraUtils.swift +0 -175
  198. package/ios/Next/CameraEnumsNext.swift +0 -29
  199. package/ios/Next/CameraRecordingOptionsNext.swift +0 -55
  200. package/ios/Next/TakePictureOptionsNext.swift +0 -23
  201. package/next.d.ts +0 -1
  202. package/next.js +0 -1
  203. package/src/next/ExpoCameraManager.ts +0 -3
  204. package/src/next/index.ts +0 -86
  205. /package/build/{Camera.js → legacy/Camera.js} +0 -0
  206. /package/build/{WebCapabilityUtils.d.ts → web/WebCapabilityUtils.d.ts} +0 -0
  207. /package/build/{WebCapabilityUtils.js → web/WebCapabilityUtils.js} +0 -0
  208. /package/build/{WebUserMediaManager.d.ts → web/WebUserMediaManager.d.ts} +0 -0
  209. /package/build/{WebUserMediaManager.js → web/WebUserMediaManager.js} +0 -0
  210. /package/build/{useWebCameraStream.js → web/useWebCameraStream.js} +0 -0
  211. /package/ios/{CameraExceptions.swift → Common/CameraExceptions.swift} +0 -0
  212. /package/ios/{CameraPermissionsRequester.swift → Common/CameraPermissionsRequester.swift} +0 -0
  213. /package/ios/{Next → Current}/BarcodeScanner.swift +0 -0
  214. /package/ios/{Next → Current}/PreviewView.swift +0 -0
  215. /package/ios/{Next → Current}/VisionScannerDelegate.swift +0 -0
  216. /package/src/{Camera.tsx → legacy/Camera.tsx} +0 -0
  217. /package/src/{WebCapabilityUtils.ts → web/WebCapabilityUtils.ts} +0 -0
  218. /package/src/{WebUserMediaManager.ts → web/WebUserMediaManager.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,25 +10,41 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 14.1.2 — 2024-04-08
13
+ ## 15.0.0 — 2024-04-18
14
+
15
+ ### 🎉 New features
16
+
17
+ - Add ability to disable permissions in config plugin by passing `false` instead of permission messages. ([#28107](https://github.com/expo/expo/pull/28107) by [@EvanBacon](https://github.com/EvanBacon))
18
+ - Add `pictureSize` prop to `CameraView` component. ([#27664](https://github.com/expo/expo/pull/27664) by [@alanjhughes](https://github.com/alanjhughes))
19
+ - Allow user to remove `NSMicrophoneUsageDescription` and ignore the `mute` prop if they don't intend to use video. ([#28156](https://github.com/expo/expo/pull/28156) by [@alanjhughes](https://github.com/alanjhughes))
20
+ - Add `animateShutter` prop to provide feedback when a picture is taken. Also added shutter sound on android. ([#28211](https://github.com/expo/expo/pull/28211) by [@alanjhughes](https://github.com/alanjhughes))
14
21
 
15
22
  ### 🐛 Bug fixes
16
23
 
17
24
  - 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
25
  - 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))
26
+ - Fix an issue on `iOS` where the barcode types did not match the typescript representation. Also enabled scanning `upc_a` codes on `iOS`. ([#28233](https://github.com/expo/expo/pull/28233) by [@alanjhughes](https://github.com/alanjhughes))
27
+
28
+ ### 💡 Others
19
29
 
20
- ## 14.1.1 2024-03-13
30
+ - drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
31
+ - 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))
32
+ - Prevent unnecessary configuration changes wherever possible. ([#27919](https://github.com/expo/expo/pull/27919) by [@alanjhughes](https://github.com/alanjhughes))
33
+ - On `Android`, only recreate camera after certain props have changed. ([#27952](https://github.com/expo/expo/pull/27952) by [@alanjhughes](https://github.com/alanjhughes))
34
+ - Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
35
+ - Promote `next` package to stable. ([#28226](https://github.com/expo/expo/pull/28226) by [@alanjhughes](https://github.com/alanjhughes))
36
+
37
+ ## 14.1.1 - 2024-03-13
21
38
 
22
39
  _This version does not introduce any user-facing changes._
23
40
 
24
- ## 14.1.0 2024-03-13
41
+ ## 14.1.0 - 2024-03-13
25
42
 
26
43
  ### 🐛 Bug fixes
27
44
 
28
45
  - On `Android`, fix empty qualities being passed to QualitySelector ([#27126](https://github.com/expo/expo/pull/27126) by [@leonhh](https://github.com/leonhh))
29
46
  - On `web`, prevent creating a webworker when rendering on the server ([#27222](https://github.com/expo/expo/pull/27222) by [@marklawlor](https://github.com/marklawlor))
30
47
  - On `iOS`, fix method call on an optional variable. ([#27235](https://github.com/expo/expo/pull/27235) by [@alanjhughes](https://github.com/alanjhughes))
31
- - On `iOS`, fix the orientation value in `onResponsiveOrientationChanged` when `exif` is set to true. ([#27314](https://github.com/expo/expo/pull/27314) by [@alanjhughes](https://github.com/alanjhughes))
32
48
  - Fix scanned frame bounds when scanning a barcode. ([#27207](https://github.com/expo/expo/pull/27207) by [@tamagokun](https://github.com/tamagokun))
33
49
  - Fix incorrect prop name `flash` being passed to native. ([#27394](https://github.com/expo/expo/pull/27394) by [@alanjhughes](https://github.com/alanjhughes))
34
50
  - 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))
@@ -36,13 +52,13 @@ _This version does not introduce any user-facing changes._
36
52
  - 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
53
  - On `iOS`, fix `getAvailablePictureSizes` in the legacy package. ([#27642](https://github.com/expo/expo/pull/27642) by [@alanjhughes](https://github.com/alanjhughes))
38
54
 
39
- ## 14.0.6 2024-03-07
55
+ ## 14.0.6 - 2024-03-07
40
56
 
41
57
  ### 🐛 Bug fixes
42
58
 
43
59
  - On `iOS`, fix the orientation value in `onResponsiveOrientationChanged` when `exif` is set to true. ([#27314](https://github.com/expo/expo/pull/27314) by [@alanjhughes](https://github.com/alanjhughes))
44
60
 
45
- ## 14.0.5 2024-02-16
61
+ ## 14.0.5 - 2024-02-16
46
62
 
47
63
  ### 🎉 New features
48
64
 
@@ -50,34 +66,32 @@ _This version does not introduce any user-facing changes._
50
66
 
51
67
  ### 🐛 Bug fixes
52
68
 
53
- - Set a higher resolution for barcode scans to allow scanning of high resolution barcodes. ([#26886](https://github.com/expo/expo/pull/26886)) by [@byudaniel](https://github.com/byudaniel))
69
+ - Set a higher resolution for barcode scans to allow scanning of high resolution barcodes. ([#26886](https://github.com/expo/expo/pull/26886)) by [@byudaniel](https://github.com/byudaniel)) ([#26886](https://github.com/expo/expo/pull/26886) by [@byudaniel](https://github.com/byudaniel))
54
70
  - Fix barcode types casing errors. ([#26888](https://github.com/expo/expo/pull/26888) by [@byudaniel](https://github.com/byudaniel))
55
71
  - On `Android`, fix the camera not being released when the view is destroyed. ([#27086](https://github.com/expo/expo/pull/27086) by [@alanjhughes](https://github.com/alanjhughes))
56
72
 
57
73
  ### 💡 Others
58
74
 
59
75
  - 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))
61
76
 
62
- ## 14.0.4 2024-02-06
77
+ ## 14.0.4 - 2024-02-06
63
78
 
64
79
  _This version does not introduce any user-facing changes._
65
80
 
66
- ## 14.0.3 2024-01-26
81
+ ## 14.0.3 - 2024-01-26
67
82
 
68
83
  ### 🐛 Bug fixes
69
84
 
70
- - Fix naming of web files. ([#26505](https://github.com/expo/expo/pull/26505) by [@alanjhughes](https://github.com/alanjhughes))
71
85
  - On `iOS`, barcode types were not converted correctly causing the scanner to not start immediately. ([#26704](https://github.com/expo/expo/pull/26704) by [@alanjhughes](https://github.com/alanjhughes))
72
86
  - On `iOS`, fix `maxDuration` timescale on videos. ([#26882](https://github.com/expo/expo/pull/26882) by [@alanjhughes](https://github.com/alanjhughes))
73
87
 
74
- ## 14.0.2 2024-01-23
88
+ ## 14.0.2 - 2024-01-23
75
89
 
76
90
  ### 🐛 Bug fixes
77
91
 
78
92
  - Fix naming of web files. ([#26505](https://github.com/expo/expo/pull/26505) by [@alanjhughes](https://github.com/alanjhughes))
79
93
 
80
- ## 14.0.1 2023-12-19
94
+ ## 14.0.1 - 2023-12-19
81
95
 
82
96
  _This version does not introduce any user-facing changes._
83
97
 
@@ -1,119 +1,33 @@
1
1
  apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'maven-publish'
4
2
 
5
3
  group = 'host.exp.exponent'
6
- version = '14.1.2'
4
+ version = '15.0.0'
7
5
 
8
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
- if (expoModulesCorePlugin.exists()) {
10
- apply from: expoModulesCorePlugin
11
- applyKotlinExpoModulesCorePlugin()
12
- // Remove this check, but keep the contents after SDK49 support is dropped
13
- if (safeExtGet("expoProvidesDefaultConfig", false)) {
14
- useExpoPublishing()
15
- useCoreDependencies()
16
- }
17
- }
18
-
19
- buildscript {
20
- // Simple helper that allows the root project to override versions declared by this library.
21
- ext.safeExtGet = { prop, fallback ->
22
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
- }
24
-
25
- // Ensures backward compatibility
26
- ext.getKotlinVersion = {
27
- if (ext.has("kotlinVersion")) {
28
- ext.kotlinVersion()
29
- } else {
30
- ext.safeExtGet("kotlinVersion", "1.8.10")
31
- }
32
- }
33
-
34
- repositories {
35
- mavenCentral()
36
- }
37
-
38
- dependencies {
39
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
40
- }
41
- }
42
-
43
- // Remove this if and it's contents, when support for SDK49 is dropped
44
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
45
- afterEvaluate {
46
- publishing {
47
- publications {
48
- release(MavenPublication) {
49
- from components.release
50
- }
51
- }
52
- repositories {
53
- maven {
54
- url = mavenLocal().url
55
- }
56
- }
57
- }
58
- }
59
- }
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useDefaultAndroidSdkVersions()
11
+ useExpoPublishing()
60
12
 
61
13
  android {
62
- // Remove this if and it's contents, when support for SDK49 is dropped
63
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
64
- compileSdkVersion safeExtGet("compileSdkVersion", 34)
65
-
66
- defaultConfig {
67
- minSdkVersion safeExtGet("minSdkVersion", 23)
68
- targetSdkVersion safeExtGet("targetSdkVersion", 34)
69
- }
70
-
71
- publishing {
72
- singleVariant("release") {
73
- withSourcesJar()
74
- }
75
- }
76
-
77
- lintOptions {
78
- abortOnError false
79
- }
80
- }
81
-
82
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
83
- if (agpVersion.tokenize('.')[0].toInteger() < 8) {
84
- compileOptions {
85
- sourceCompatibility JavaVersion.VERSION_11
86
- targetCompatibility JavaVersion.VERSION_11
87
- }
88
-
89
- kotlinOptions {
90
- jvmTarget = JavaVersion.VERSION_11.majorVersion
91
- }
92
- }
93
-
94
14
  namespace "expo.modules.camera"
95
15
  defaultConfig {
96
16
  versionCode 32
97
- versionName "14.1.2"
17
+ versionName "15.0.0"
98
18
  }
99
19
  }
100
20
 
101
21
  repositories {
102
- mavenCentral()
103
22
  maven {
104
23
  url "$projectDir/maven"
105
24
  }
106
25
  }
107
26
 
108
27
  dependencies {
109
- // Remove this if and it's contents, when support for SDK49 is dropped
110
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
111
- implementation project(':expo-modules-core')
112
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
113
- }
114
- def camerax_version = "1.4.0-alpha02"
28
+ def camerax_version = "1.4.0-alpha04"
115
29
 
116
- api "androidx.exifinterface:exifinterface:1.3.6"
30
+ api "androidx.exifinterface:exifinterface:1.3.7"
117
31
  api 'com.google.android:cameraview:1.0.0'
118
32
 
119
33
  implementation "androidx.camera:camera-core:${camerax_version}"
@@ -124,7 +38,7 @@ dependencies {
124
38
  implementation "androidx.camera:camera-view:${camerax_version}"
125
39
  implementation "androidx.camera:camera-extensions:${camerax_version}"
126
40
  implementation "com.google.mlkit:barcode-scanning:17.2.0"
127
- implementation 'androidx.camera:camera-mlkit-vision:1.4.0-alpha02'
41
+ implementation "androidx.camera:camera-mlkit-vision:${camerax_version}"
128
42
 
129
43
  api 'com.google.android:cameraview:1.0.0'
130
44
  }
@@ -3,5 +3,7 @@ package expo.modules.camera
3
3
  import expo.modules.kotlin.exception.CodedException
4
4
 
5
5
  class CameraExceptions {
6
- class CameraIsNotRunning : CodedException(message = "Camera is not running")
6
+ class ImageCaptureFailed : CodedException(message = "Failed to capture image")
7
+
8
+ class VideoRecordingFailed(cause: String?) : CodedException("Video recording failed: $cause")
7
9
  }
@@ -1,110 +1,25 @@
1
1
  package expo.modules.camera
2
2
 
3
- import androidx.exifinterface.media.ExifInterface
4
3
  import android.graphics.Bitmap
5
4
  import android.graphics.Canvas
6
5
  import android.graphics.Color
7
6
  import android.graphics.Paint
8
- import android.media.CamcorderProfile
9
- import android.os.Bundle
10
-
11
- import com.google.android.cameraview.CameraView
12
-
7
+ import expo.modules.camera.records.CameraType
13
8
  import java.io.ByteArrayOutputStream
14
- import java.io.IOException
15
9
  import java.text.SimpleDateFormat
16
- import java.util.*
10
+ import java.util.Calendar
11
+ import java.util.Locale
17
12
 
18
13
  object CameraViewHelper {
19
14
  // Utilities
20
15
  @JvmStatic
21
- fun getCorrectCameraRotation(rotation: Int, facing: Int) =
22
- if (facing == CameraView.FACING_FRONT) {
16
+ fun getCorrectCameraRotation(rotation: Int, facing: CameraType) =
17
+ if (facing == CameraType.FRONT) {
23
18
  (rotation - 90 + 360) % 360
24
19
  } else {
25
20
  (-rotation + 90 + 360) % 360
26
21
  }
27
22
 
28
- @JvmStatic
29
- fun getCamcorderProfile(cameraId: Int, quality: Int): CamcorderProfile {
30
- var profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH)
31
- when (quality) {
32
- VIDEO_2160P -> profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_2160P)
33
- VIDEO_1080P -> profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_1080P)
34
- VIDEO_720P -> profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_720P)
35
- VIDEO_480P -> profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P)
36
- VIDEO_4x3 -> {
37
- profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P)
38
- profile.videoFrameWidth = 640
39
- }
40
- }
41
- return profile
42
- }
43
-
44
- @JvmStatic
45
- fun getExifData(exifInterface: ExifInterface): Bundle {
46
- val exifMap = Bundle()
47
- for ((type, name) in exifTags) {
48
- if (exifInterface.getAttribute(name) != null) {
49
- when (type) {
50
- "string" -> exifMap.putString(name, exifInterface.getAttribute(name))
51
- "int" -> exifMap.putInt(name, exifInterface.getAttributeInt(name, 0))
52
- "double" -> exifMap.putDouble(name, exifInterface.getAttributeDouble(name, 0.0))
53
- }
54
- }
55
- }
56
- exifInterface.latLong?.let {
57
- exifMap.putDouble(ExifInterface.TAG_GPS_LATITUDE, it[0])
58
- exifMap.putDouble(ExifInterface.TAG_GPS_LONGITUDE, it[1])
59
- exifMap.putDouble(ExifInterface.TAG_GPS_ALTITUDE, exifInterface.getAltitude(0.0))
60
- }
61
- return exifMap
62
- }
63
-
64
- @JvmStatic
65
- @Throws(IllegalArgumentException::class)
66
- fun setExifData(baseExif: ExifInterface, exifMap: Map<String, Any>) {
67
- for ((_, name) in exifTags) {
68
- exifMap[name]?.let {
69
- // Convert possible type to string before putting into baseExif
70
- when (it) {
71
- is String -> baseExif.setAttribute(name, it)
72
- is Number -> baseExif.setAttribute(name, it.toDouble().toBigDecimal().toPlainString())
73
- is Boolean -> baseExif.setAttribute(name, it.toString())
74
- }
75
- }
76
- }
77
-
78
- if (exifMap.containsKey(ExifInterface.TAG_GPS_LATITUDE) &&
79
- exifMap.containsKey(ExifInterface.TAG_GPS_LONGITUDE) &&
80
- exifMap[ExifInterface.TAG_GPS_LATITUDE] is Number &&
81
- exifMap[ExifInterface.TAG_GPS_LONGITUDE] is Number
82
- ) {
83
- baseExif.setLatLong(
84
- exifMap[ExifInterface.TAG_GPS_LATITUDE] as Double,
85
- exifMap[ExifInterface.TAG_GPS_LONGITUDE] as Double
86
- )
87
- }
88
-
89
- if (exifMap.containsKey(ExifInterface.TAG_GPS_ALTITUDE) &&
90
- exifMap[ExifInterface.TAG_GPS_ALTITUDE] is Number
91
- ) {
92
- baseExif.setAltitude(exifMap[ExifInterface.TAG_GPS_ALTITUDE] as Double)
93
- }
94
- }
95
-
96
- @JvmStatic
97
- @Throws(IOException::class)
98
- fun addExifData(baseExif: ExifInterface, additionalExif: ExifInterface) {
99
- for (tagInfo in exifTags) {
100
- val name = tagInfo[1]
101
- additionalExif.getAttribute(name)?.let {
102
- baseExif.setAttribute(name, it)
103
- }
104
- }
105
- baseExif.saveAttributes()
106
- }
107
-
108
23
  fun generateSimulatorPhoto(width: Int, height: Int): ByteArray {
109
24
  val fakePhotoBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
110
25
  val canvas = Canvas(fakePhotoBitmap)
@@ -122,7 +37,6 @@ object CameraViewHelper {
122
37
 
123
38
  val stream = ByteArrayOutputStream()
124
39
  fakePhotoBitmap.compress(Bitmap.CompressFormat.PNG, 90, stream)
125
- val fakePhotoByteArray = stream.toByteArray()
126
- return fakePhotoByteArray
40
+ return stream.toByteArray()
127
41
  }
128
42
  }