expo-image-picker 13.2.0 → 13.2.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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 13.2.1 — 2022-07-11
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
13
17
  ## 13.2.0 — 2022-07-07
14
18
 
15
19
  ### 🎉 New features
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '13.2.0'
6
+ version = '13.2.1'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
76
  versionCode 22
77
- versionName "13.2.0"
77
+ versionName "13.2.1"
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -217,6 +217,19 @@ export declare type ImageInfo = {
217
217
  * The type of the asset.
218
218
  */
219
219
  type?: 'image' | 'video';
220
+ /**
221
+ * Preferred filename to use when saving this item. This might be `null` when the name is unavailable
222
+ * or user gave limited permission to access the media library.
223
+ *
224
+ * @platform ios
225
+ */
226
+ fileName?: string | null;
227
+ /**
228
+ * File size of the picked image or video, in bytes.
229
+ *
230
+ * @platform ios
231
+ */
232
+ fileSize?: number;
220
233
  /**
221
234
  * The `exif` field is included if the `exif` option is truthy, and is an object containing the
222
235
  * image's EXIF data. The names of this object's properties are EXIF tags and the values are the
@@ -341,6 +354,25 @@ export declare type ImagePickerOptions = {
341
354
  * @platform web
342
355
  */
343
356
  allowsMultipleSelection?: boolean;
357
+ /**
358
+ * The maximum number of items that user can select. Applicable when `allowsMultipleSelection` is enabled.
359
+ * Setting the value to `0` sets the selection limit to the maximum that the system supports.
360
+ *
361
+ * @platform ios 14+
362
+ * @default 0
363
+ */
364
+ selectionLimit?: number;
365
+ /**
366
+ * Whether to display number badges when assets are selected. The badges are numbered
367
+ * in selection order. Assets are then returned in the exact same order they were selected.
368
+ *
369
+ * > Assets should be returned in the selection order regardless of this option,
370
+ * > but there is no guarantee that it is always true when this option is disabled.
371
+ *
372
+ * @platform ios 15+
373
+ * @default false
374
+ */
375
+ orderedSelection?: boolean;
344
376
  /**
345
377
  * Maximum duration, in seconds, for video recording. Setting this to `0` disables the limit.
346
378
  * Defaults to `0` (no limit).
@@ -1 +1 @@
1
- {"version":3,"file":"ImagePicker.types.d.ts","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,oBAAY,wBAAwB,GAAG,kBAAkB,CAAC;AAG1D;;GAEG;AACH,oBAAY,8BAA8B,GAAG,kBAAkB,GAAG;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CAC/C,CAAC;AAGF;;;GAGG;AACH,oBAAY,4BAA4B,GAAG,8BAA8B,CAAC;AAG1E,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;CAClB;AAGD,oBAAY,iBAAiB;IAC3B;;;;OAIG;IACH,WAAW,IAAI;IACf;;;;OAIG;IACH,UAAU,IAAI;IACd;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,c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AC;IAClB;;;OAGG;IACH,uBAAuB,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,oBAAY,uBAAuB,CAAC,CAAC,SAAS,kBAAkB,GAAG,sBAAsB,IACvF,CAAC,SAAS;IACR,uBAAuB,EAAE,IAAI,CAAC;CAC/B,GACG,yBAAyB,GACzB,iBAAiB,CAAC"}
1
+ {"version":3,"file":"ImagePicker.types.d.ts","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,oBAAY,wBAAwB,GAAG,kBAAkB,CAAC;AAG1D;;GAEG;AACH,oBAAY,8BAA8B,GAAG,kBAAkB,GAAG;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CAC/C,CAAC;AAGF;;;GAGG;AACH,oBAAY,4BAA4B,GAAG,8BAA8B,CAAC;AAG1E,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;CAClB;AAGD,oBAAY,iBAAiB;IAC3B;;;;OAIG;IACH,WAAW,IAAI;IACf;;;;OAIG;IACH,UAAU,IAAI;IACd;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,KAAK;CACpB;AAGD,oBAAY,kCAAkC;IAC5C;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,MAAM,IAAI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AAY,sBAAsB,GAAG;IACnC;;;OAGG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAE7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,uBAAuB,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,oBAAY,uBAAuB,CAAC,CAAC,SAAS,kBAAkB,GAAG,sBAAsB,IACvF,CAAC,SAAS;IACR,uBAAuB,EAAE,IAAI,CAAC;CAC/B,GACG,yBAAyB,GACzB,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImagePicker.types.js","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AA0BA,cAAc;AACd,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,+BAAW,CAAA;IACX;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,qCAAiB,CAAA;AACnB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,iBAmEX;AAnED,WAAY,iBAAiB;IAC3B;;;;OAIG;IACH,uEAAe,CAAA;IACf;;;;OAIG;IACH,qEAAc,CAAA;IACd;;;;OAIG;IACH,2EAAiB,CAAA;IACjB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,yEAAgB,CAAA;IAChB;;;;OAIG;IACH,yEAAgB,CAAA;IAChB;;;;OAIG;IACH,2EAAiB,CAAA;IACjB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,8EAAmB,CAAA;AACrB,CAAC,EAnEW,iBAAiB,KAAjB,iBAAiB,QAmE5B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,kCAyBX;AAzBD,WAAY,kCAAkC;IAC5C;;OAEG;IACH,2FAAQ,CAAA;IACR;;OAEG;IACH,+FAAU,CAAA;IACV;;OAEG;IACH,yFAAO,CAAA;IACP;;OAEG;IACH,uGAAc,CAAA;IACd;;OAEG;IACH,+GAAkB,CAAA;IAClB;;OAEG;IACH,6GAAiB,CAAA;AACnB,CAAC,EAzBW,kCAAkC,KAAlC,kCAAkC,QAyB7C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAoEX;AApED,WAAY,8BAA8B;IACxC;;OAEG;IACH,4DAA0B,CAAA;IAC1B;;OAEG;IACH,0DAAwB,CAAA;IACxB;;OAEG;IACH,0DAAwB,CAAA;IACxB;;OAEG;IACH,oEAAkC,CAAA;IAClC;;OAEG;IACH,qEAAmC,CAAA;IACnC;;OAEG;IACH,6EAA2C,CAAA;IAC3C;;OAEG;IACH,qDAAmB,CAAA;IACnB;;;;;OAKG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,2DAAyB,CAAA;IACzB;;OAEG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,mEAAiC,CAAA;IACjC;;OAEG;IACH,mEAAiC,CAAA;IACjC;;OAEG;IACH,2EAAyC,CAAA;IACzC;;OAEG;IACH,qDAAmB,CAAA;IACnB;;OAEG;IACH,yDAAuB,CAAA;AACzB,CAAC,EApEW,8BAA8B,KAA9B,8BAA8B,QAoEzC","sourcesContent":["import { PermissionResponse } from 'expo-modules-core';\n\n// @needsAudit\n/**\n * Alias for `PermissionResponse` type exported by `expo-modules-core`.\n */\nexport type CameraPermissionResponse = PermissionResponse;\n\n// @needsAudit\n/**\n * Extends `PermissionResponse` type exported by `expo-modules-core` and contains additional iOS-specific field.\n */\nexport type MediaLibraryPermissionResponse = PermissionResponse & {\n /**\n * @platform ios\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n// @needsAudit\n/**\n * An alias for the `MediaLibraryPermissionResponse` object.\n * @deprecated Use `ImagePicker.MediaLibraryPermissionResponse` instead.\n */\nexport type CameraRollPermissionResponse = MediaLibraryPermissionResponse;\n\n// @needsAudit\nexport enum MediaTypeOptions {\n /**\n * Images and videos.\n */\n All = 'All',\n /**\n * Only videos.\n */\n Videos = 'Videos',\n /**\n * Only images.\n */\n Images = 'Images',\n}\n\n// @needsAudit\nexport enum VideoExportPreset {\n /**\n * Resolution: __Unchanged__ •\n * Video compression: __None__ •\n * Audio compression: __None__\n */\n Passthrough = 0,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n LowQuality = 1,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n MediumQuality = 2,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n HighestQuality = 3,\n /**\n * Resolution: __640 × 480__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_640x480 = 4,\n /**\n * Resolution: __960 × 540__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_960x540 = 5,\n /**\n * Resolution: __1280 × 720__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1280x720 = 6,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1920x1080 = 7,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_3840x2160 = 8,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_1920x1080 = 9,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_3840x2160 = 10,\n}\n\n// @needsAudit\nexport enum UIImagePickerControllerQualityType {\n /**\n * Highest available resolution.\n */\n High = 0,\n /**\n * Depends on the device.\n */\n Medium = 1,\n /**\n * Depends on the device.\n */\n Low = 2,\n /**\n * 640 × 480\n */\n VGA640x480 = 3,\n /**\n * 1280 × 720\n */\n IFrame1280x720 = 4,\n /**\n * 960 × 540\n */\n IFrame960x540 = 5,\n}\n\n/**\n * Picker presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport enum UIImagePickerPresentationStyle {\n /**\n * A presentation style in which the presented picker covers the screen.\n */\n FULL_SCREEN = 'fullScreen',\n /**\n * A presentation style that partially covers the underlying content.\n */\n PAGE_SHEET = 'pageSheet',\n /**\n * A presentation style that displays the picker centered in the screen.\n */\n FORM_SHEET = 'formSheet',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n CURRENT_CONTEXT = 'currentContext',\n /**\n * A presentation style in which the picker view covers the screen.\n */\n OVER_FULL_SCREEN = 'overFullScreen',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n OVER_CURRENT_CONTEXT = 'overCurrentContext',\n /**\n * A presentation style where the picker is displayed in a popover view.\n */\n POPOVER = 'popover',\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios 13+\n */\n AUTOMATIC = 'automatic',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.\n */\n FullScreen = 'fullScreen',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.\n */\n PageSheet = 'pageSheet',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.\n */\n FormSheet = 'formSheet',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.\n */\n CurrentContext = 'currentContext',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.\n */\n OverFullScreen = 'overFullScreen',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.\n */\n OverCurrentContext = 'overCurrentContext',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.\n */\n Popover = 'popover',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.\n */\n Automatic = 'automatic',\n}\n\n// @needsAudit\nexport type ImageInfo = {\n /**\n * URI to the local image or video file (usable as the source of an `Image` element, in the case of\n * an image) and `width` and `height` specify the dimensions of the media.\n */\n uri: string;\n /**\n * Width of the image or video.\n */\n width: number;\n /**\n * Height of the image or video.\n */\n height: number;\n /**\n * The type of the asset.\n */\n type?: 'image' | 'video';\n /**\n * The `exif` field is included if the `exif` option is truthy, and is an object containing the\n * image's EXIF data. The names of this object's properties are EXIF tags and the values are the\n * respective EXIF values for those tags.\n */\n exif?: Record<string, any>;\n /**\n * Included if the `base64` option is truthy, and is a Base64-encoded string of the selected\n * image's JPEG data. If you prepend this with `'data:image/jpeg;base64,'` to create a data URI,\n * you can use it as the source of an `Image` element; for example:\n * ```ts\n * <Image\n * source={{ uri: 'data:image/jpeg;base64,' + launchCameraResult.base64 }}\n * style={{ width: 200, height: 200 }}\n * />\n * ```\n */\n base64?: string;\n /**\n * Length of the video in milliseconds.\n */\n duration?: number;\n /**\n * Boolean flag which shows if request was cancelled. If asset data have been returned this should\n * always be `false`.\n */\n cancelled: boolean;\n};\n\n// @needsAudit\nexport type ImagePickerErrorResult = {\n /**\n * The error code.\n */\n code: string;\n /**\n * The error message.\n */\n message: string;\n /**\n * The exception which caused the error.\n */\n exception?: string;\n};\n\n// @needsAudit\n/**\n * An object returned when the pick action has been cancelled by the user.\n */\nexport type ImagePickerCancelledResult = { cancelled: true };\n\n// @needsAudit\nexport type ImagePickerResult = ImagePickerCancelledResult | ImageInfo;\n\n// @needsAudit @docsMissing\nexport type ImagePickerMultipleResult =\n | ImagePickerCancelledResult\n | { cancelled: false; selected: ImageInfo[] };\n\n// @needsAudit\nexport type ImagePickerOptions = {\n /**\n * Whether to show a UI to edit the image after it is picked. On Android the user can crop and\n * rotate the image and on iOS simply crop it.\n *\n * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.\n * > On iOS, this option is ignored if `allowsMultipleSelection` is enabled.\n *\n * @default false\n * @platform ios\n * @platform android\n */\n allowsEditing?: boolean;\n /**\n * An array with two entries `[x, y]` specifying the aspect ratio to maintain if the user is\n * allowed to edit the image (by passing `allowsEditing: true`). This is only applicable on\n * Android, since on iOS the crop rectangle is always a square.\n */\n aspect?: [number, number];\n /**\n * Specify the quality of compression, from `0` to `1`. `0` means compress for small size,\n * `1` means compress for maximum quality.\n * > Note: If the selected image has been compressed before, the size of the output file may be\n * > bigger than the size of the original image.\n *\n * > Note: On iOS, if a `.bmp` or `.png` image is selected from the library, this option is ignored.\n *\n * @default 0.2\n * @platform ios\n * @platform android\n */\n quality?: number;\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes?: MediaTypeOptions;\n /**\n * Whether to also include the EXIF data for the image. On iOS the EXIF data does not include GPS\n * tags in the camera case.\n */\n exif?: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Specify preset which will be used to compress selected video.\n * @default ImagePicker.VideoExportPreset.Passthrough\n * @platform ios 11+\n * @deprecated See [`videoExportPreset`](https://developer.apple.com/documentation/uikit/uiimagepickercontroller/2890964-videoexportpreset?language=objc)\n * in Apple documentation.\n */\n videoExportPreset?: VideoExportPreset;\n /**\n * Specify the quality of recorded videos. Defaults to the highest quality available for the device.\n * @default ImagePicker.UIImagePickerControllerQualityType.High\n * @platform ios\n */\n videoQuality?: UIImagePickerControllerQualityType;\n /**\n * Whether or not to allow selecting multiple media files at once.\n *\n * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsEditing`.\n * > If this option is enabled, then `allowsEditing` is ignored.\n *\n * @default false\n * @platform ios 14+\n * @platform web\n */\n allowsMultipleSelection?: boolean;\n /**\n * Maximum duration, in seconds, for video recording. Setting this to `0` disables the limit.\n * Defaults to `0` (no limit).\n * - **On iOS**, when `allowsEditing` is set to `true`, maximum duration is limited to 10 minutes.\n * This limit is applied automatically, if `0` or no value is specified.\n * - **On Android**, effect of this option depends on support of installed camera app.\n * - **On Web** this option has no effect - the limit is browser-dependant.\n */\n videoMaxDuration?: number;\n /**\n * Choose [presentation style](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle?language=objc)\n * to customize view during taking photo/video.\n * @default ImagePicker.UIImagePickerPresentationStyle.Automatic\n * @platform ios\n */\n presentationStyle?: UIImagePickerPresentationStyle;\n};\n\n// @needsAudit\nexport type OpenFileBrowserOptions = {\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes: MediaTypeOptions;\n // @docsMissing\n capture?: boolean;\n /**\n * Whether or not to allow selecting multiple media files at once.\n * @platform web\n */\n allowsMultipleSelection: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64: boolean;\n};\n\n// @needsAudit @docsMissing\nexport type ExpandImagePickerResult<T extends ImagePickerOptions | OpenFileBrowserOptions> =\n T extends {\n allowsMultipleSelection: true;\n }\n ? ImagePickerMultipleResult\n : ImagePickerResult;\n"]}
1
+ {"version":3,"file":"ImagePicker.types.js","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AA0BA,cAAc;AACd,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,+BAAW,CAAA;IACX;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,qCAAiB,CAAA;AACnB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,iBAmEX;AAnED,WAAY,iBAAiB;IAC3B;;;;OAIG;IACH,uEAAe,CAAA;IACf;;;;OAIG;IACH,qEAAc,CAAA;IACd;;;;OAIG;IACH,2EAAiB,CAAA;IACjB;;;;OAIG;IACH,6EAAkB,CAAA;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QAoEzC","sourcesContent":["import { PermissionResponse } from 'expo-modules-core';\n\n// @needsAudit\n/**\n * Alias for `PermissionResponse` type exported by `expo-modules-core`.\n */\nexport type CameraPermissionResponse = PermissionResponse;\n\n// @needsAudit\n/**\n * Extends `PermissionResponse` type exported by `expo-modules-core` and contains additional iOS-specific field.\n */\nexport type MediaLibraryPermissionResponse = PermissionResponse & {\n /**\n * @platform ios\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n// @needsAudit\n/**\n * An alias for the `MediaLibraryPermissionResponse` object.\n * @deprecated Use `ImagePicker.MediaLibraryPermissionResponse` instead.\n */\nexport type CameraRollPermissionResponse = MediaLibraryPermissionResponse;\n\n// @needsAudit\nexport enum MediaTypeOptions {\n /**\n * Images and videos.\n */\n All = 'All',\n /**\n * Only videos.\n */\n Videos = 'Videos',\n /**\n * Only images.\n */\n Images = 'Images',\n}\n\n// @needsAudit\nexport enum VideoExportPreset {\n /**\n * Resolution: __Unchanged__ •\n * Video compression: __None__ •\n * Audio compression: __None__\n */\n Passthrough = 0,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n LowQuality = 1,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n MediumQuality = 2,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n HighestQuality = 3,\n /**\n * Resolution: __640 × 480__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_640x480 = 4,\n /**\n * Resolution: __960 × 540__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_960x540 = 5,\n /**\n * Resolution: __1280 × 720__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1280x720 = 6,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1920x1080 = 7,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_3840x2160 = 8,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_1920x1080 = 9,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_3840x2160 = 10,\n}\n\n// @needsAudit\nexport enum UIImagePickerControllerQualityType {\n /**\n * Highest available resolution.\n */\n High = 0,\n /**\n * Depends on the device.\n */\n Medium = 1,\n /**\n * Depends on the device.\n */\n Low = 2,\n /**\n * 640 × 480\n */\n VGA640x480 = 3,\n /**\n * 1280 × 720\n */\n IFrame1280x720 = 4,\n /**\n * 960 × 540\n */\n IFrame960x540 = 5,\n}\n\n/**\n * Picker presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport enum UIImagePickerPresentationStyle {\n /**\n * A presentation style in which the presented picker covers the screen.\n */\n FULL_SCREEN = 'fullScreen',\n /**\n * A presentation style that partially covers the underlying content.\n */\n PAGE_SHEET = 'pageSheet',\n /**\n * A presentation style that displays the picker centered in the screen.\n */\n FORM_SHEET = 'formSheet',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n CURRENT_CONTEXT = 'currentContext',\n /**\n * A presentation style in which the picker view covers the screen.\n */\n OVER_FULL_SCREEN = 'overFullScreen',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n OVER_CURRENT_CONTEXT = 'overCurrentContext',\n /**\n * A presentation style where the picker is displayed in a popover view.\n */\n POPOVER = 'popover',\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios 13+\n */\n AUTOMATIC = 'automatic',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.\n */\n FullScreen = 'fullScreen',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.\n */\n PageSheet = 'pageSheet',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.\n */\n FormSheet = 'formSheet',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.\n */\n CurrentContext = 'currentContext',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.\n */\n OverFullScreen = 'overFullScreen',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.\n */\n OverCurrentContext = 'overCurrentContext',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.\n */\n Popover = 'popover',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.\n */\n Automatic = 'automatic',\n}\n\n// @needsAudit\nexport type ImageInfo = {\n /**\n * URI to the local image or video file (usable as the source of an `Image` element, in the case of\n * an image) and `width` and `height` specify the dimensions of the media.\n */\n uri: string;\n /**\n * Width of the image or video.\n */\n width: number;\n /**\n * Height of the image or video.\n */\n height: number;\n /**\n * The type of the asset.\n */\n type?: 'image' | 'video';\n /**\n * Preferred filename to use when saving this item. This might be `null` when the name is unavailable\n * or user gave limited permission to access the media library.\n *\n * @platform ios\n */\n fileName?: string | null;\n /**\n * File size of the picked image or video, in bytes.\n *\n * @platform ios\n */\n fileSize?: number;\n /**\n * The `exif` field is included if the `exif` option is truthy, and is an object containing the\n * image's EXIF data. The names of this object's properties are EXIF tags and the values are the\n * respective EXIF values for those tags.\n */\n exif?: Record<string, any>;\n /**\n * Included if the `base64` option is truthy, and is a Base64-encoded string of the selected\n * image's JPEG data. If you prepend this with `'data:image/jpeg;base64,'` to create a data URI,\n * you can use it as the source of an `Image` element; for example:\n * ```ts\n * <Image\n * source={{ uri: 'data:image/jpeg;base64,' + launchCameraResult.base64 }}\n * style={{ width: 200, height: 200 }}\n * />\n * ```\n */\n base64?: string;\n /**\n * Length of the video in milliseconds.\n */\n duration?: number;\n /**\n * Boolean flag which shows if request was cancelled. If asset data have been returned this should\n * always be `false`.\n */\n cancelled: boolean;\n};\n\n// @needsAudit\nexport type ImagePickerErrorResult = {\n /**\n * The error code.\n */\n code: string;\n /**\n * The error message.\n */\n message: string;\n /**\n * The exception which caused the error.\n */\n exception?: string;\n};\n\n// @needsAudit\n/**\n * An object returned when the pick action has been cancelled by the user.\n */\nexport type ImagePickerCancelledResult = { cancelled: true };\n\n// @needsAudit\nexport type ImagePickerResult = ImagePickerCancelledResult | ImageInfo;\n\n// @needsAudit @docsMissing\nexport type ImagePickerMultipleResult =\n | ImagePickerCancelledResult\n | { cancelled: false; selected: ImageInfo[] };\n\n// @needsAudit\nexport type ImagePickerOptions = {\n /**\n * Whether to show a UI to edit the image after it is picked. On Android the user can crop and\n * rotate the image and on iOS simply crop it.\n *\n * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.\n * > On iOS, this option is ignored if `allowsMultipleSelection` is enabled.\n *\n * @default false\n * @platform ios\n * @platform android\n */\n allowsEditing?: boolean;\n /**\n * An array with two entries `[x, y]` specifying the aspect ratio to maintain if the user is\n * allowed to edit the image (by passing `allowsEditing: true`). This is only applicable on\n * Android, since on iOS the crop rectangle is always a square.\n */\n aspect?: [number, number];\n /**\n * Specify the quality of compression, from `0` to `1`. `0` means compress for small size,\n * `1` means compress for maximum quality.\n * > Note: If the selected image has been compressed before, the size of the output file may be\n * > bigger than the size of the original image.\n *\n * > Note: On iOS, if a `.bmp` or `.png` image is selected from the library, this option is ignored.\n *\n * @default 0.2\n * @platform ios\n * @platform android\n */\n quality?: number;\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes?: MediaTypeOptions;\n /**\n * Whether to also include the EXIF data for the image. On iOS the EXIF data does not include GPS\n * tags in the camera case.\n */\n exif?: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Specify preset which will be used to compress selected video.\n * @default ImagePicker.VideoExportPreset.Passthrough\n * @platform ios 11+\n * @deprecated See [`videoExportPreset`](https://developer.apple.com/documentation/uikit/uiimagepickercontroller/2890964-videoexportpreset?language=objc)\n * in Apple documentation.\n */\n videoExportPreset?: VideoExportPreset;\n /**\n * Specify the quality of recorded videos. Defaults to the highest quality available for the device.\n * @default ImagePicker.UIImagePickerControllerQualityType.High\n * @platform ios\n */\n videoQuality?: UIImagePickerControllerQualityType;\n /**\n * Whether or not to allow selecting multiple media files at once.\n *\n * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsEditing`.\n * > If this option is enabled, then `allowsEditing` is ignored.\n *\n * @default false\n * @platform ios 14+\n * @platform web\n */\n allowsMultipleSelection?: boolean;\n /**\n * The maximum number of items that user can select. Applicable when `allowsMultipleSelection` is enabled.\n * Setting the value to `0` sets the selection limit to the maximum that the system supports.\n *\n * @platform ios 14+\n * @default 0\n */\n selectionLimit?: number;\n /**\n * Whether to display number badges when assets are selected. The badges are numbered\n * in selection order. Assets are then returned in the exact same order they were selected.\n *\n * > Assets should be returned in the selection order regardless of this option,\n * > but there is no guarantee that it is always true when this option is disabled.\n *\n * @platform ios 15+\n * @default false\n */\n orderedSelection?: boolean;\n /**\n * Maximum duration, in seconds, for video recording. Setting this to `0` disables the limit.\n * Defaults to `0` (no limit).\n * - **On iOS**, when `allowsEditing` is set to `true`, maximum duration is limited to 10 minutes.\n * This limit is applied automatically, if `0` or no value is specified.\n * - **On Android**, effect of this option depends on support of installed camera app.\n * - **On Web** this option has no effect - the limit is browser-dependant.\n */\n videoMaxDuration?: number;\n /**\n * Choose [presentation style](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle?language=objc)\n * to customize view during taking photo/video.\n * @default ImagePicker.UIImagePickerPresentationStyle.Automatic\n * @platform ios\n */\n presentationStyle?: UIImagePickerPresentationStyle;\n};\n\n// @needsAudit\nexport type OpenFileBrowserOptions = {\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes: MediaTypeOptions;\n // @docsMissing\n capture?: boolean;\n /**\n * Whether or not to allow selecting multiple media files at once.\n * @platform web\n */\n allowsMultipleSelection: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64: boolean;\n};\n\n// @needsAudit @docsMissing\nexport type ExpandImagePickerResult<T extends ImagePickerOptions | OpenFileBrowserOptions> =\n T extends {\n allowsMultipleSelection: true;\n }\n ? ImagePickerMultipleResult\n : ImagePickerResult;\n"]}
@@ -98,6 +98,18 @@ internal class FailedToReadVideoException: Exception {
98
98
  }
99
99
  }
100
100
 
101
+ internal class FailedToTranscodeVideoException: Exception {
102
+ override var reason: String {
103
+ "Failed to transcode picked video"
104
+ }
105
+ }
106
+
107
+ internal class UnsupportedVideoExportPresetException: GenericException<String> {
108
+ override var reason: String {
109
+ "Video cannot be transcoded with export preset: \(param)"
110
+ }
111
+ }
112
+
101
113
  internal class FailedToPickVideoException: Exception {
102
114
  override var reason: String {
103
115
  "Video could not be picked"
@@ -137,9 +137,13 @@ public class ImagePickerModule: Module, OnMediaPickingResultHandler {
137
137
  @available(iOS 14, *)
138
138
  private func launchMultiSelectPicker(pickingContext: PickingContext) {
139
139
  var configuration = PHPickerConfiguration(photoLibrary: PHPhotoLibrary.shared())
140
- // TODO: (barthap) Add configurable selection limit. 0 means unlimited
141
- configuration.selectionLimit = 0
142
- configuration.filter = pickingContext.options.mediaTypes.toPickerFilter()
140
+ let options = pickingContext.options
141
+
142
+ configuration.selectionLimit = options.selectionLimit
143
+ configuration.filter = options.mediaTypes.toPickerFilter()
144
+ if #available(iOS 15, *) {
145
+ configuration.selection = options.orderedSelection ? .ordered : .default
146
+ }
143
147
 
144
148
  let picker = PHPickerViewController(configuration: configuration)
145
149
 
@@ -5,6 +5,7 @@ import MobileCoreServices
5
5
  import PhotosUI
6
6
 
7
7
  internal let DEFAULT_QUALITY = 0.2
8
+ internal let UNLIMITED_SELECTION = 0
8
9
 
9
10
  internal struct ImagePickerOptions: Record {
10
11
  @Field
@@ -43,6 +44,12 @@ internal struct ImagePickerOptions: Record {
43
44
 
44
45
  @Field
45
46
  var allowsMultipleSelection: Bool = false
47
+
48
+ @Field
49
+ var selectionLimit: Int = UNLIMITED_SELECTION
50
+
51
+ @Field
52
+ var orderedSelection: Bool = false
46
53
  }
47
54
 
48
55
  internal enum PresentationStyle: String, EnumArgument {
@@ -67,6 +67,8 @@ internal struct ImageInfo: SelectedMediaInfo {
67
67
  let uri: String
68
68
  let width: Double
69
69
  let height: Double
70
+ let fileName: String?
71
+ let fileSize: Int?
70
72
  let base64: String?
71
73
  let exif: ExifInfo?
72
74
 
@@ -75,7 +77,9 @@ internal struct ImageInfo: SelectedMediaInfo {
75
77
  "type": type,
76
78
  "uri": uri,
77
79
  "width": width,
78
- "height": height
80
+ "height": height,
81
+ "fileName": fileName,
82
+ "fileSize": fileSize
79
83
  ]
80
84
  if base64 != nil {
81
85
  result["base64"] = base64
@@ -95,6 +99,8 @@ internal struct VideoInfo: SelectedMediaInfo {
95
99
  let uri: String
96
100
  let width: Double
97
101
  let height: Double
102
+ let fileName: String?
103
+ let fileSize: Int?
98
104
  let duration: Double
99
105
 
100
106
  var dictionary: [String: Any] {
@@ -103,6 +109,8 @@ internal struct VideoInfo: SelectedMediaInfo {
103
109
  "uri": uri,
104
110
  "width": width,
105
111
  "height": height,
112
+ "fileName": fileName,
113
+ "fileSize": fileSize,
106
114
  "duration": duration
107
115
  ]
108
116
  }
@@ -23,18 +23,18 @@ internal struct MediaHandler {
23
23
 
24
24
  @available(iOS 14, *)
25
25
  internal func handleMultipleMedia(_ selection: [PHPickerResult], completion: @escaping (ImagePickerResult) -> Void) {
26
- var results: [SelectedMediaInfo] = []
26
+ var results: [String: SelectedMediaInfo] = [:]
27
27
 
28
28
  let dispatchGroup = DispatchGroup()
29
29
  let dispatchQueue = DispatchQueue(label: "expo.imagepicker.multipleMediaHandler")
30
30
 
31
- let resultHandler = { (result: SelectedMediaResult) -> Void in
31
+ let resultHandler = { (assetId: String?, result: SelectedMediaResult) -> Void in
32
32
  switch result {
33
33
  case .failure(let exception):
34
34
  return completion(.failure(exception))
35
35
  case .success(let mediaInfo):
36
36
  dispatchQueue.async {
37
- results.append(mediaInfo)
37
+ results[assetId!] = mediaInfo
38
38
  dispatchGroup.leave()
39
39
  }
40
40
  }
@@ -42,19 +42,22 @@ internal struct MediaHandler {
42
42
 
43
43
  for item in selection {
44
44
  let itemProvider = item.itemProvider
45
+ let id = item.assetIdentifier
45
46
 
46
47
  dispatchGroup.enter()
47
48
  if itemProvider.hasItemConformingToTypeIdentifier(UTType.image.identifier) {
48
- handleImage(itemProvider: itemProvider, completion: resultHandler)
49
+ handleImage(itemProvider: itemProvider, assetId: id, completion: resultHandler)
49
50
  } else if itemProvider.hasItemConformingToTypeIdentifier(UTType.movie.identifier) {
50
- handleVideo(itemProvider: itemProvider, completion: resultHandler)
51
+ handleVideo(itemProvider: itemProvider, assetId: id, completion: resultHandler)
51
52
  } else {
52
53
  completion(.failure(InvalidMediaTypeException(itemProvider.registeredTypeIdentifiers.first)))
53
54
  }
54
55
  }
55
56
 
56
57
  dispatchGroup.notify(queue: .main) {
57
- completion(.success(ImagePickerMultipleResponse(results: results)))
58
+ // assign results in the order they were selected
59
+ let sortedResults = selection.map { results[$0.assetIdentifier!]! }
60
+ completion(.success(ImagePickerMultipleResponse(results: sortedResults)))
58
61
  }
59
62
  }
60
63
 
@@ -80,6 +83,12 @@ internal struct MediaHandler {
80
83
  try ImageUtils.write(imageData: imageData, to: targetUrl)
81
84
  }
82
85
 
86
+ // as calling this already requires media library permission, we can access it here
87
+ // if user gave limited permissions, in the worst case this will be null
88
+ let asset = mediaInfo[.phAsset] as? PHAsset
89
+ let fileName = asset?.value(forKey: "filename") as? String
90
+ let fileSize = getFileSize(from: targetUrl)
91
+
83
92
  let base64 = try ImageUtils.optionallyReadBase64From(imageData: imageData,
84
93
  orImageFileUrl: targetUrl,
85
94
  tryReadingFile: fileWasCopied,
@@ -89,6 +98,8 @@ internal struct MediaHandler {
89
98
  let result: ImagePickerSingleResponse = .image(ImageInfo(uri: targetUrl.absoluteString,
90
99
  width: image.size.width,
91
100
  height: image.size.height,
101
+ fileName: fileName,
102
+ fileSize: fileSize,
92
103
  base64: base64,
93
104
  exif: exif))
94
105
  completion(.success(result))
@@ -101,13 +112,15 @@ internal struct MediaHandler {
101
112
  }
102
113
 
103
114
  @available(iOS 14, *)
104
- private func handleImage(itemProvider: NSItemProvider, completion: @escaping (SelectedMediaResult) -> Void) {
115
+ private func handleImage(itemProvider: NSItemProvider,
116
+ assetId: String?,
117
+ completion: @escaping (String?, SelectedMediaResult) -> Void) {
105
118
  itemProvider.loadDataRepresentation(forTypeIdentifier: UTType.image.identifier) { rawData, error in
106
119
  do {
107
120
  guard error == nil,
108
121
  let rawData = rawData,
109
122
  let image = try? UIImage(data: rawData) else {
110
- return completion(.failure(FailedToReadImageException().causedBy(error)))
123
+ return completion(assetId, .failure(FailedToReadImageException().causedBy(error)))
111
124
  }
112
125
 
113
126
  let (imageData, fileExtension) = try ImageUtils.readDataAndFileExtension(image: image,
@@ -116,6 +129,8 @@ internal struct MediaHandler {
116
129
 
117
130
  let targetUrl = try generateUrl(withFileExtension: fileExtension)
118
131
  try ImageUtils.write(imageData: imageData, to: targetUrl)
132
+ let fileSize = getFileSize(from: targetUrl)
133
+ let fileName = itemProvider.suggestedName.map { $0 + fileExtension }
119
134
 
120
135
  // We need to get EXIF from original image data, as it is being lost in UIImage
121
136
  let exif = ImageUtils.optionallyReadExifFrom(data: rawData, shouldReadExif: self.options.exif)
@@ -128,13 +143,15 @@ internal struct MediaHandler {
128
143
  let result = ImageInfo(uri: targetUrl.absoluteString,
129
144
  width: image.size.width,
130
145
  height: image.size.height,
146
+ fileName: fileName,
147
+ fileSize: fileSize,
131
148
  base64: base64,
132
149
  exif: exif)
133
- completion(.success(result))
150
+ completion(assetId, .success(result))
134
151
  } catch let exception as Exception {
135
- return completion(.failure(exception))
152
+ return completion(assetId, .failure(exception))
136
153
  } catch {
137
- return completion(.failure(UnexpectedException(error)))
154
+ return completion(assetId, .failure(UnexpectedException(error)))
138
155
  }
139
156
  } // loadObject
140
157
  }
@@ -152,7 +169,7 @@ internal struct MediaHandler {
152
169
 
153
170
  try VideoUtils.tryCopyingVideo(at: pickedVideoUrl, to: targetUrl)
154
171
 
155
- guard let size = VideoUtils.readSizeFrom(url: targetUrl) else {
172
+ guard let dimensions = VideoUtils.readSizeFrom(url: targetUrl) else {
156
173
  return completion(.failure(FailedToReadVideoSizeException()))
157
174
  }
158
175
 
@@ -161,10 +178,16 @@ internal struct MediaHandler {
161
178
  // TODO: (@bbarthec): inspect whether it makes sense to read duration from two different assets
162
179
  let videoUrlToReadDurationFrom = self.options.allowsEditing ? pickedVideoUrl : targetUrl
163
180
  let duration = VideoUtils.readDurationFrom(url: videoUrlToReadDurationFrom)
181
+
182
+ let asset = mediaInfo[.phAsset] as? PHAsset
183
+ let fileName = asset?.value(forKey: "filename") as? String
184
+ let fileSize = getFileSize(from: targetUrl)
164
185
 
165
186
  let result: ImagePickerSingleResponse = .video(VideoInfo(uri: targetUrl.absoluteString,
166
- width: size.width,
167
- height: size.height,
187
+ width: dimensions.width,
188
+ height: dimensions.height,
189
+ fileName: fileName,
190
+ fileSize: fileSize,
168
191
  duration: duration))
169
192
  completion(.success(result))
170
193
  } catch let exception as Exception {
@@ -175,32 +198,46 @@ internal struct MediaHandler {
175
198
  }
176
199
 
177
200
  @available(iOS 14, *)
178
- private func handleVideo(itemProvider: NSItemProvider, completion: @escaping (SelectedMediaResult) -> Void) {
201
+ private func handleVideo(itemProvider: NSItemProvider,
202
+ assetId: String?,
203
+ completion: @escaping (String?, SelectedMediaResult) -> Void) {
179
204
  itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.movie.identifier) { [self] url, error in
180
205
  do {
181
206
  guard error == nil,
182
207
  let videoUrl = url as? URL else {
183
- return completion(.failure(FailedToReadVideoException().causedBy(error)))
208
+ return completion(assetId, .failure(FailedToReadVideoException().causedBy(error)))
184
209
  }
185
-
186
- let targetUrl = try generateUrl(withFileExtension: ".mov")
187
- try VideoUtils.tryCopyingVideo(at: videoUrl, to: targetUrl)
188
-
189
- guard let size = VideoUtils.readSizeFrom(url: targetUrl) else {
190
- return completion(.failure(FailedToReadVideoSizeException()))
210
+
211
+ // In case of passthrough, we want original file extension, mp4 otherwise
212
+ // TODO: (barthap) Support other file extensions?
213
+ let transcodeFileType = AVFileType.mp4
214
+ let transcodeFileExtension = ".mp4"
215
+ let originalExtension = ".\(videoUrl.pathExtension)"
216
+
217
+ // We need to copy the result into a place that we control, because the picker
218
+ // can remove the original file during conversion.
219
+ // Also, the transcoding may need a separate url - one of these will be used as a final result
220
+ let assetUrl = try generateUrl(withFileExtension: originalExtension)
221
+ let transcodedUrl = try generateUrl(withFileExtension: transcodeFileExtension)
222
+ try VideoUtils.tryCopyingVideo(at: videoUrl, to: assetUrl)
223
+
224
+ VideoUtils.transcodeVideoAsync(sourceAssetUrl: assetUrl,
225
+ destinationUrl: transcodedUrl,
226
+ outputFileType: transcodeFileType,
227
+ exportPreset: options.videoExportPreset) { result in
228
+ switch result {
229
+ case .failure(let exception):
230
+ return completion(assetId, .failure(exception))
231
+ case .success(let targetUrl):
232
+ let fileName = itemProvider.suggestedName.map { $0 + transcodeFileExtension }
233
+ let videoResult = buildVideoResult(for: targetUrl, withName: fileName)
234
+ return completion(assetId, videoResult)
235
+ }
191
236
  }
192
-
193
- let duration = VideoUtils.readDurationFrom(url: targetUrl)
194
-
195
- let result = VideoInfo(uri: targetUrl.absoluteString,
196
- width: size.width,
197
- height: size.height,
198
- duration: duration)
199
- completion(.success(result))
200
237
  } catch let exception as Exception {
201
- return completion(.failure(exception))
238
+ return completion(assetId, .failure(exception))
202
239
  } catch {
203
- return completion(.failure(UnexpectedException(error)))
240
+ return completion(assetId, .failure(UnexpectedException(error)))
204
241
  }
205
242
  }
206
243
  }
@@ -218,6 +255,32 @@ internal struct MediaHandler {
218
255
  let url = URL(fileURLWithPath: path)
219
256
  return url
220
257
  }
258
+
259
+ private func buildVideoResult(for videoUrl: URL, withName fileName: String? = nil) -> SelectedMediaResult {
260
+ guard let size = VideoUtils.readSizeFrom(url: videoUrl) else {
261
+ return .failure(FailedToReadVideoSizeException())
262
+ }
263
+ let duration = VideoUtils.readDurationFrom(url: videoUrl)
264
+ let fileSize = getFileSize(from: videoUrl)
265
+
266
+ let result = VideoInfo(uri: videoUrl.absoluteString,
267
+ width: size.width,
268
+ height: size.height,
269
+ fileName: fileName,
270
+ fileSize: fileSize,
271
+ duration: duration)
272
+ return .success(result)
273
+ }
274
+
275
+ private func getFileSize(from fileUrl: URL) -> Int? {
276
+ do {
277
+ let resources = try fileUrl.resourceValues(forKeys: [.fileSizeKey])
278
+ return resources.fileSize
279
+ } catch {
280
+ log.error("Failed to get file size for \(fileUrl.absoluteString)")
281
+ return nil
282
+ }
283
+ }
221
284
  }
222
285
 
223
286
  private struct ImageUtils {
@@ -502,4 +565,45 @@ private struct VideoUtils {
502
565
  return mediaInfo[.mediaURL] as? URL
503
566
  ?? mediaInfo[.referenceURL] as? URL
504
567
  }
568
+
569
+ /**
570
+ Asynchronously transcodes asset provided as `sourceAssetUrl` according to `exportPreset`.
571
+ Result URL is returned to the `completion` closure.
572
+ Transcoded video is saved at `destinationUrl`, unless `exportPreset` is set to `passthrough`.
573
+ In this case, `sourceAssetUrl` is returned.
574
+ */
575
+ static func transcodeVideoAsync(sourceAssetUrl: URL,
576
+ destinationUrl: URL,
577
+ outputFileType: AVFileType,
578
+ exportPreset: VideoExportPreset,
579
+ completion: @escaping (Result<URL, Exception>) -> Void) {
580
+ if case .passthrough = exportPreset {
581
+ return completion(.success((sourceAssetUrl)))
582
+ }
583
+
584
+ let asset = AVURLAsset(url: sourceAssetUrl)
585
+ let preset = exportPreset.toAVAssetExportPreset()
586
+ AVAssetExportSession.determineCompatibility(ofExportPreset: preset,
587
+ with: asset,
588
+ outputFileType: outputFileType) { canBeTranscoded in
589
+ guard canBeTranscoded else {
590
+ return completion(.failure(UnsupportedVideoExportPresetException(preset.description)))
591
+ }
592
+ guard let exportSession = AVAssetExportSession(asset: asset,
593
+ presetName: preset) else {
594
+ return completion(.failure(FailedToTranscodeVideoException()))
595
+ }
596
+ exportSession.outputFileType = outputFileType
597
+ exportSession.outputURL = destinationUrl
598
+ exportSession.exportAsynchronously {
599
+ switch exportSession.status {
600
+ case .failed:
601
+ let error = exportSession.error
602
+ completion(.failure(FailedToTranscodeVideoException().causedBy(error)))
603
+ default:
604
+ completion(.success((destinationUrl)))
605
+ }
606
+ }
607
+ }
608
+ }
505
609
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-image-picker",
3
- "version": "13.2.0",
3
+ "version": "13.2.1",
4
4
  "description": "Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.",
5
5
  "main": "build/ImagePicker.js",
6
6
  "types": "build/ImagePicker.d.ts",
@@ -46,5 +46,5 @@
46
46
  "peerDependencies": {
47
47
  "expo": "*"
48
48
  },
49
- "gitHead": "e893ff2b01e108cf246cec02318c0df9d6bc603c"
49
+ "gitHead": "8151bf48e683a50e942ef213f7978b35c41f5e11"
50
50
  }
@@ -232,6 +232,19 @@ export type ImageInfo = {
232
232
  * The type of the asset.
233
233
  */
234
234
  type?: 'image' | 'video';
235
+ /**
236
+ * Preferred filename to use when saving this item. This might be `null` when the name is unavailable
237
+ * or user gave limited permission to access the media library.
238
+ *
239
+ * @platform ios
240
+ */
241
+ fileName?: string | null;
242
+ /**
243
+ * File size of the picked image or video, in bytes.
244
+ *
245
+ * @platform ios
246
+ */
247
+ fileSize?: number;
235
248
  /**
236
249
  * The `exif` field is included if the `exif` option is truthy, and is an object containing the
237
250
  * image's EXIF data. The names of this object's properties are EXIF tags and the values are the
@@ -363,6 +376,25 @@ export type ImagePickerOptions = {
363
376
  * @platform web
364
377
  */
365
378
  allowsMultipleSelection?: boolean;
379
+ /**
380
+ * The maximum number of items that user can select. Applicable when `allowsMultipleSelection` is enabled.
381
+ * Setting the value to `0` sets the selection limit to the maximum that the system supports.
382
+ *
383
+ * @platform ios 14+
384
+ * @default 0
385
+ */
386
+ selectionLimit?: number;
387
+ /**
388
+ * Whether to display number badges when assets are selected. The badges are numbered
389
+ * in selection order. Assets are then returned in the exact same order they were selected.
390
+ *
391
+ * > Assets should be returned in the selection order regardless of this option,
392
+ * > but there is no guarantee that it is always true when this option is disabled.
393
+ *
394
+ * @platform ios 15+
395
+ * @default false
396
+ */
397
+ orderedSelection?: boolean;
366
398
  /**
367
399
  * Maximum duration, in seconds, for video recording. Setting this to `0` disables the limit.
368
400
  * Defaults to `0` (no limit).