expo-image-picker 13.0.1 → 13.2.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 (49) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +46 -6
  3. package/android/build.gradle +4 -7
  4. package/android/src/main/AndroidManifest.xml +1 -1
  5. package/android/src/main/java/expo/modules/imagepicker/ImagePickerConstants.kt +154 -165
  6. package/android/src/main/java/expo/modules/imagepicker/ImagePickerExceptions.kt +35 -0
  7. package/android/src/main/java/expo/modules/imagepicker/ImagePickerModule.kt +144 -386
  8. package/android/src/main/java/expo/modules/imagepicker/ImagePickerOptions.kt +71 -53
  9. package/android/src/main/java/expo/modules/imagepicker/ImagePickerResponse.kt +43 -0
  10. package/android/src/main/java/expo/modules/imagepicker/ImagePickerUtils.kt +136 -58
  11. package/android/src/main/java/expo/modules/imagepicker/MediaHandler.kt +78 -0
  12. package/android/src/main/java/expo/modules/imagepicker/contracts/CameraContract.kt +47 -0
  13. package/android/src/main/java/expo/modules/imagepicker/contracts/ContractsUtils.kt +18 -0
  14. package/android/src/main/java/expo/modules/imagepicker/contracts/CropImageContract.kt +75 -0
  15. package/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt +41 -0
  16. package/android/src/main/java/expo/modules/imagepicker/exporters/CompressionImageExporter.kt +56 -46
  17. package/android/src/main/java/expo/modules/imagepicker/exporters/ImageExporter.kt +57 -7
  18. package/android/src/main/java/expo/modules/imagepicker/exporters/RawImageExporter.kt +15 -48
  19. package/android/src/main/java/expo/modules/imagepicker/{ImagePickerFileProvider.kt → fileprovider/ImagePickerFileProvider.kt} +1 -1
  20. package/build/ImagePicker.d.ts.map +1 -1
  21. package/build/ImagePicker.js +5 -0
  22. package/build/ImagePicker.js.map +1 -1
  23. package/build/ImagePicker.types.d.ts +18 -0
  24. package/build/ImagePicker.types.d.ts.map +1 -1
  25. package/build/ImagePicker.types.js.map +1 -1
  26. package/expo-module.config.json +3 -0
  27. package/ios/ImagePickerExceptions.swift +6 -0
  28. package/ios/ImagePickerHandler.swift +49 -0
  29. package/ios/ImagePickerModule.swift +78 -24
  30. package/ios/ImagePickerOptions.swift +17 -0
  31. package/ios/ImagePickerResponse.swift +48 -7
  32. package/ios/MediaHandler.swift +197 -39
  33. package/package.json +3 -3
  34. package/plugin/build/withImagePicker.d.ts +9 -7
  35. package/plugin/build/withImagePicker.js +58 -43
  36. package/plugin/src/withImagePicker.ts +80 -48
  37. package/src/ImagePicker.ts +7 -0
  38. package/src/ImagePicker.types.ts +18 -0
  39. package/tsconfig.json +1 -1
  40. package/android/src/main/java/expo/modules/imagepicker/ImagePickerPackage.kt +0 -8
  41. package/android/src/main/java/expo/modules/imagepicker/MediaTypes.kt +0 -16
  42. package/android/src/main/java/expo/modules/imagepicker/PendingPromise.kt +0 -38
  43. package/android/src/main/java/expo/modules/imagepicker/PickerResultsStore.kt +0 -108
  44. package/android/src/main/java/expo/modules/imagepicker/exporters/CropImageExporter.kt +0 -55
  45. package/android/src/main/java/expo/modules/imagepicker/fileproviders/CacheFileProvider.kt +0 -14
  46. package/android/src/main/java/expo/modules/imagepicker/fileproviders/CropFileProvider.kt +0 -8
  47. package/android/src/main/java/expo/modules/imagepicker/fileproviders/FileProvider.kt +0 -9
  48. package/android/src/main/java/expo/modules/imagepicker/tasks/ImageResultTask.kt +0 -129
  49. package/android/src/main/java/expo/modules/imagepicker/tasks/VideoResultTask.kt +0 -90
package/CHANGELOG.md CHANGED
@@ -10,6 +10,32 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 13.2.0 — 2022-07-07
14
+
15
+ ### 🎉 New features
16
+
17
+ - On iOS 14+ added support for selecting multiple images/videos. ([#18102](https://github.com/expo/expo/pull/18102) by [@barthap](https://github.com/barthap))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fix crash when picking a GIF image on iOS. ([#18135](https://github.com/expo/expo/pull/18135) by [@barthap](https://github.com/barthap))
22
+
23
+ ### 💡 Others
24
+
25
+ - On Android migrated to the new `registerForActivityResult` mechanism. ([#17671](https://github.com/expo/expo/pull/17671), ([#17987](https://github.com/expo/expo/pull/17987) by [@bbarthec](https://github.com/bbarthec))
26
+ - Native module on Android is now written in Kotlin using [Sweet API](https://docs.expo.dev/modules/module-api). ([#17668](https://github.com/expo/expo/pull/17668) by [@bbarthec](https://github.com/bbarthec))
27
+ - Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
28
+
29
+ ## 13.1.1 — 2022-04-27
30
+
31
+ _This version does not introduce any user-facing changes._
32
+
33
+ ## 13.1.0 — 2022-04-25
34
+
35
+ ### 🎉 New features
36
+
37
+ - [plugin] Added ability to disable permissions. ([#17168](https://github.com/expo/expo/pull/17168) by [@EvanBacon](https://github.com/EvanBacon))
38
+
13
39
  ## 13.0.1 — 2022-04-20
14
40
 
15
41
  _This version does not introduce any user-facing changes._
package/README.md CHANGED
@@ -23,6 +23,8 @@ expo install expo-image-picker
23
23
 
24
24
  ### Configure for iOS
25
25
 
26
+ > This is only required for usage in bare React Native apps.
27
+
26
28
  Add `NSPhotoLibraryUsageDescription`, `NSCameraUsageDescription`, and `NSMicrophoneUsageDescription` keys to your `Info.plist`:
27
29
 
28
30
  ```xml
@@ -38,6 +40,8 @@ Run `npx pod-install` after installing the npm package.
38
40
 
39
41
  ### Configure for Android
40
42
 
43
+ > This is only required for usage in bare React Native apps.
44
+
41
45
  This package automatically adds the `CAMERA`, `READ_EXTERNAL_STORAGE`, and `WRITE_EXTERNAL_STORAGE` permissions. They are used when picking images from the camera directly, or from the camera roll.
42
46
 
43
47
  ```xml
@@ -47,13 +51,49 @@ This package automatically adds the `CAMERA`, `READ_EXTERNAL_STORAGE`, and `WRIT
47
51
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
48
52
  ```
49
53
 
50
- In `AndroidManifest.xml` add the following `activity` within `application`:
54
+ ## Config Plugin
51
55
 
52
- ```xml
53
- <activity
54
- android:name="com.canhub.cropper.CropImageActivity"
55
- android:theme="@style/Base.Theme.AppCompat">
56
- </activity>
56
+ > This plugin is applied automatically in EAS Build, only add the config plugin if you want to pass in extra properties.
57
+
58
+ After installing this npm package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
59
+
60
+ ```json
61
+ {
62
+ "expo": {
63
+ "plugins": ["expo-image-picker"]
64
+ }
65
+ }
66
+ ```
67
+
68
+ Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
69
+
70
+ ### API
71
+
72
+ The plugin provides props for extra customization. Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app. If no extra properties are added, defaults will be used.
73
+
74
+ - `photosPermission` (_string | false_): Sets the iOS `NSPhotoLibraryUsageDescription` permission message to the `Info.plist`. Setting `false` will skip adding the permission on iOS and **does not** skip the permission on Android. Defaults to `Allow $(PRODUCT_NAME) to access your photos`.
75
+ - `cameraPermission` (_string | false_): Sets the iOS `NSCameraUsageDescription` permission message to the `Info.plist`. Setting `false` will skip adding the permission on iOS and **does not** skip the permission on Android. Defaults to `Allow $(PRODUCT_NAME) to access your camera`.
76
+ - `microphonePermission` (_string | false_): Sets the iOS `NSCameraUsageDescription` permission message to the `Info.plist`. Setting `false` will skip adding the permission on iOS and skips adding the `android.permission.RECORD_AUDIO` Android permission. Defaults to `Allow $(PRODUCT_NAME) to access your photos`.
77
+
78
+ ### Example
79
+
80
+ ```json
81
+ {
82
+ "expo": {
83
+ "plugins": [
84
+ [
85
+ "expo-image-picker",
86
+ {
87
+ "photosPermission": "custom photos permission",
88
+ "cameraPermission": "Allow $(PRODUCT_NAME) to open the camera",
89
+
90
+ "//": "Disables the microphone permission",
91
+ "microphonePermission": false
92
+ }
93
+ ]
94
+ ]
95
+ }
96
+ }
57
97
  ```
58
98
 
59
99
  # Contributing
@@ -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.0.1'
6
+ version = '13.2.0'
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.0.1"
77
+ versionName "13.2.0"
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -85,11 +85,8 @@ dependencies {
85
85
  implementation project(':expo-modules-core')
86
86
 
87
87
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
88
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")
89
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1")
88
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3")
89
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3")
90
90
  implementation "com.github.CanHub:Android-Image-Cropper:1.1.1"
91
91
  implementation "androidx.exifinterface:exifinterface:1.3.3"
92
- api "androidx.legacy:legacy-support-v4:1.0.0"
93
- api 'commons-codec:commons-codec:1.10'
94
- api 'commons-io:commons-io:2.6'
95
92
  }
@@ -14,7 +14,7 @@
14
14
  android:theme="@style/Base.Theme.AppCompat"/>
15
15
  <!-- https://developer.android.com/guide/topics/manifest/provider-element.html -->
16
16
  <provider
17
- android:name=".ImagePickerFileProvider"
17
+ android:name=".fileprovider.ImagePickerFileProvider"
18
18
  android:authorities="${applicationId}.ImagePickerFileProvider"
19
19
  android:exported="false"
20
20
  android:grantUriPermissions="true">
@@ -4,172 +4,161 @@ import androidx.exifinterface.media.ExifInterface
4
4
 
5
5
  object ImagePickerConstants {
6
6
  const val TAG = "ExponentImagePicker"
7
- const val REQUEST_LAUNCH_CAMERA = 1
8
- const val REQUEST_LAUNCH_IMAGE_LIBRARY = 2
9
- const val DEFAULT_QUALITY = 100
7
+ const val MAXIMUM_QUALITY = 1.0
10
8
  const val CACHE_DIR_NAME = "ImagePicker"
11
- const val PENDING_RESULT_EVENT = "ExpoImagePicker.onPendingResult"
12
9
 
13
- const val ERR_MISSING_ACTIVITY = "ERR_MISSING_ACTIVITY"
14
- const val MISSING_ACTIVITY_MESSAGE = "Activity which was provided during module initialization is no longer available"
15
- const val ERR_CAN_NOT_DEDUCE_TYPE = "ERR_CAN_NOT_DEDUCE_TYPE"
16
- const val CAN_NOT_DEDUCE_TYPE_MESSAGE = "Can not deduce type of the returned file."
17
- const val ERR_CAN_NOT_SAVE_RESULT = "ERR_CAN_NOT_SAVE_RESULT"
18
- const val CAN_NOT_SAVE_RESULT_MESSAGE = "Can not save result to the file."
19
- const val ERR_CAN_NOT_EXTRACT_METADATA = "ERR_CAN_NOT_EXTRACT_METADATA"
20
- const val CAN_NOT_EXTRACT_METADATA_MESSAGE = "Can not extract metadata."
21
- const val ERR_INVALID_OPTION = "ERR_INVALID_OPTION"
22
- const val ERR_MISSING_URL = "ERR_MISSING_URL"
23
- const val MISSING_URL_MESSAGE = "Intent doesn't contain `url`."
24
- const val ERR_CAN_NOT_OPEN_CROP = "ERR_CAN_NOT_OPEN_CROP"
25
- const val CAN_NOT_OPEN_CROP_MESSAGE = "Can not open the crop tool."
26
- const val COROUTINE_CANCELED = "Coroutine canceled by module destruction."
27
- const val PROMISES_CANCELED = "Module destroyed, all promises canceled."
28
- const val UNKNOWN_EXCEPTION = "Unknown exception."
29
- const val ERR_CROPPING_FAILURE = "ERR_CROPPING_FAILURE"
30
- const val CROPPING_FAILURE_MESSAGE = "Cropping operation failed"
10
+ /**
11
+ * Expose List<Pair<Type, Exif>> as [Iterable] for easier access.
12
+ */
13
+ val EXIF_TAGS = object : Iterable<Pair<String, String>> {
14
+ /**
15
+ * Map { "string" | "double" | "int" -> List<String> } into List<"string" | "double" | "int", String>
16
+ */
17
+ override fun iterator(): Iterator<Pair<String, String>> =
18
+ typeToTags
19
+ .flatMap { (type, tags) -> tags.map { tag -> type to tag } }
20
+ .iterator()
31
21
 
32
- const val OPTION_QUALITY = "quality"
33
- const val OPTION_ALLOWS_EDITING = "allowsEditing"
34
- const val OPTION_MEDIA_TYPES = "mediaTypes"
35
- const val OPTION_ASPECT = "aspect"
36
- const val OPTION_BASE64 = "base64"
37
- const val OPTION_EXIF = "exif"
38
- const val OPTION_VIDEO_MAX_DURATION = "videoMaxDuration"
39
-
40
- val exifTags = arrayOf(
41
- arrayOf("string", ExifInterface.TAG_ARTIST),
42
- arrayOf("int", ExifInterface.TAG_BITS_PER_SAMPLE),
43
- arrayOf("int", ExifInterface.TAG_COMPRESSION),
44
- arrayOf("string", ExifInterface.TAG_COPYRIGHT),
45
- arrayOf("string", ExifInterface.TAG_DATETIME),
46
- arrayOf("string", ExifInterface.TAG_IMAGE_DESCRIPTION),
47
- arrayOf("int", ExifInterface.TAG_IMAGE_LENGTH),
48
- arrayOf("int", ExifInterface.TAG_IMAGE_WIDTH),
49
- arrayOf("int", ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT),
50
- arrayOf("int", ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH),
51
- arrayOf("string", ExifInterface.TAG_MAKE),
52
- arrayOf("string", ExifInterface.TAG_MODEL),
53
- arrayOf("int", ExifInterface.TAG_ORIENTATION),
54
- arrayOf("int", ExifInterface.TAG_PHOTOMETRIC_INTERPRETATION),
55
- arrayOf("int", ExifInterface.TAG_PLANAR_CONFIGURATION),
56
- arrayOf("double", ExifInterface.TAG_PRIMARY_CHROMATICITIES),
57
- arrayOf("double", ExifInterface.TAG_REFERENCE_BLACK_WHITE),
58
- arrayOf("int", ExifInterface.TAG_RESOLUTION_UNIT),
59
- arrayOf("int", ExifInterface.TAG_ROWS_PER_STRIP),
60
- arrayOf("int", ExifInterface.TAG_SAMPLES_PER_PIXEL),
61
- arrayOf("string", ExifInterface.TAG_SOFTWARE),
62
- arrayOf("int", ExifInterface.TAG_STRIP_BYTE_COUNTS),
63
- arrayOf("int", ExifInterface.TAG_STRIP_OFFSETS),
64
- arrayOf("int", ExifInterface.TAG_TRANSFER_FUNCTION),
65
- arrayOf("double", ExifInterface.TAG_WHITE_POINT),
66
- arrayOf("double", ExifInterface.TAG_X_RESOLUTION),
67
- arrayOf("double", ExifInterface.TAG_Y_CB_CR_COEFFICIENTS),
68
- arrayOf("int", ExifInterface.TAG_Y_CB_CR_POSITIONING),
69
- arrayOf("int", ExifInterface.TAG_Y_CB_CR_SUB_SAMPLING),
70
- arrayOf("double", ExifInterface.TAG_Y_RESOLUTION),
71
- arrayOf("double", ExifInterface.TAG_APERTURE_VALUE),
72
- arrayOf("double", ExifInterface.TAG_BRIGHTNESS_VALUE),
73
- arrayOf("string", ExifInterface.TAG_CFA_PATTERN),
74
- arrayOf("int", ExifInterface.TAG_COLOR_SPACE),
75
- arrayOf("string", ExifInterface.TAG_COMPONENTS_CONFIGURATION),
76
- arrayOf("double", ExifInterface.TAG_COMPRESSED_BITS_PER_PIXEL),
77
- arrayOf("int", ExifInterface.TAG_CONTRAST),
78
- arrayOf("int", ExifInterface.TAG_CUSTOM_RENDERED),
79
- arrayOf("string", ExifInterface.TAG_DATETIME_DIGITIZED),
80
- arrayOf("string", ExifInterface.TAG_DATETIME_ORIGINAL),
81
- arrayOf("string", ExifInterface.TAG_DEVICE_SETTING_DESCRIPTION),
82
- arrayOf("double", ExifInterface.TAG_DIGITAL_ZOOM_RATIO),
83
- arrayOf("string", ExifInterface.TAG_EXIF_VERSION),
84
- arrayOf("double", ExifInterface.TAG_EXPOSURE_BIAS_VALUE),
85
- arrayOf("double", ExifInterface.TAG_EXPOSURE_INDEX),
86
- arrayOf("int", ExifInterface.TAG_EXPOSURE_MODE),
87
- arrayOf("int", ExifInterface.TAG_EXPOSURE_PROGRAM),
88
- arrayOf("double", ExifInterface.TAG_EXPOSURE_TIME),
89
- arrayOf("double", ExifInterface.TAG_F_NUMBER),
90
- arrayOf("string", ExifInterface.TAG_FILE_SOURCE),
91
- arrayOf("int", ExifInterface.TAG_FLASH),
92
- arrayOf("double", ExifInterface.TAG_FLASH_ENERGY),
93
- arrayOf("string", ExifInterface.TAG_FLASHPIX_VERSION),
94
- arrayOf("double", ExifInterface.TAG_FOCAL_LENGTH),
95
- arrayOf("int", ExifInterface.TAG_FOCAL_LENGTH_IN_35MM_FILM),
96
- arrayOf("int", ExifInterface.TAG_FOCAL_PLANE_RESOLUTION_UNIT),
97
- arrayOf("double", ExifInterface.TAG_FOCAL_PLANE_X_RESOLUTION),
98
- arrayOf("double", ExifInterface.TAG_FOCAL_PLANE_Y_RESOLUTION),
99
- arrayOf("int", ExifInterface.TAG_GAIN_CONTROL),
100
- arrayOf("int", ExifInterface.TAG_ISO_SPEED_RATINGS),
101
- arrayOf("string", ExifInterface.TAG_IMAGE_UNIQUE_ID),
102
- arrayOf("int", ExifInterface.TAG_LIGHT_SOURCE),
103
- arrayOf("string", ExifInterface.TAG_MAKER_NOTE),
104
- arrayOf("double", ExifInterface.TAG_MAX_APERTURE_VALUE),
105
- arrayOf("int", ExifInterface.TAG_METERING_MODE),
106
- arrayOf("int", ExifInterface.TAG_NEW_SUBFILE_TYPE),
107
- arrayOf("string", ExifInterface.TAG_OECF),
108
- arrayOf("int", ExifInterface.TAG_PIXEL_X_DIMENSION),
109
- arrayOf("int", ExifInterface.TAG_PIXEL_Y_DIMENSION),
110
- arrayOf("string", ExifInterface.TAG_RELATED_SOUND_FILE),
111
- arrayOf("int", ExifInterface.TAG_SATURATION),
112
- arrayOf("int", ExifInterface.TAG_SCENE_CAPTURE_TYPE),
113
- arrayOf("string", ExifInterface.TAG_SCENE_TYPE),
114
- arrayOf("int", ExifInterface.TAG_SENSING_METHOD),
115
- arrayOf("int", ExifInterface.TAG_SHARPNESS),
116
- arrayOf("double", ExifInterface.TAG_SHUTTER_SPEED_VALUE),
117
- arrayOf("string", ExifInterface.TAG_SPATIAL_FREQUENCY_RESPONSE),
118
- arrayOf("string", ExifInterface.TAG_SPECTRAL_SENSITIVITY),
119
- arrayOf("int", ExifInterface.TAG_SUBFILE_TYPE),
120
- arrayOf("string", ExifInterface.TAG_SUBSEC_TIME),
121
- arrayOf("string", ExifInterface.TAG_SUBSEC_TIME_DIGITIZED),
122
- arrayOf("string", ExifInterface.TAG_SUBSEC_TIME_ORIGINAL),
123
- arrayOf("int", ExifInterface.TAG_SUBJECT_AREA),
124
- arrayOf("double", ExifInterface.TAG_SUBJECT_DISTANCE),
125
- arrayOf("int", ExifInterface.TAG_SUBJECT_DISTANCE_RANGE),
126
- arrayOf("int", ExifInterface.TAG_SUBJECT_LOCATION),
127
- arrayOf("string", ExifInterface.TAG_USER_COMMENT),
128
- arrayOf("int", ExifInterface.TAG_WHITE_BALANCE),
129
- arrayOf("double", ExifInterface.TAG_GPS_ALTITUDE),
130
- arrayOf("int", ExifInterface.TAG_GPS_ALTITUDE_REF),
131
- arrayOf("string", ExifInterface.TAG_GPS_AREA_INFORMATION),
132
- arrayOf("double", ExifInterface.TAG_GPS_DOP),
133
- arrayOf("string", ExifInterface.TAG_GPS_DATESTAMP),
134
- arrayOf("double", ExifInterface.TAG_GPS_DEST_BEARING),
135
- arrayOf("string", ExifInterface.TAG_GPS_DEST_BEARING_REF),
136
- arrayOf("double", ExifInterface.TAG_GPS_DEST_DISTANCE),
137
- arrayOf("string", ExifInterface.TAG_GPS_DEST_DISTANCE_REF),
138
- arrayOf("double", ExifInterface.TAG_GPS_DEST_LATITUDE),
139
- arrayOf("string", ExifInterface.TAG_GPS_DEST_LATITUDE_REF),
140
- arrayOf("double", ExifInterface.TAG_GPS_DEST_LONGITUDE),
141
- arrayOf("string", ExifInterface.TAG_GPS_DEST_LONGITUDE_REF),
142
- arrayOf("int", ExifInterface.TAG_GPS_DIFFERENTIAL),
143
- arrayOf("string", ExifInterface.TAG_GPS_H_POSITIONING_ERROR),
144
- arrayOf("double", ExifInterface.TAG_GPS_IMG_DIRECTION),
145
- arrayOf("string", ExifInterface.TAG_GPS_IMG_DIRECTION_REF),
146
- arrayOf("double", ExifInterface.TAG_GPS_LATITUDE),
147
- arrayOf("string", ExifInterface.TAG_GPS_LATITUDE_REF),
148
- arrayOf("double", ExifInterface.TAG_GPS_LONGITUDE),
149
- arrayOf("string", ExifInterface.TAG_GPS_LONGITUDE_REF),
150
- arrayOf("string", ExifInterface.TAG_GPS_MAP_DATUM),
151
- arrayOf("string", ExifInterface.TAG_GPS_MEASURE_MODE),
152
- arrayOf("string", ExifInterface.TAG_GPS_PROCESSING_METHOD),
153
- arrayOf("string", ExifInterface.TAG_GPS_SATELLITES),
154
- arrayOf("double", ExifInterface.TAG_GPS_SPEED),
155
- arrayOf("string", ExifInterface.TAG_GPS_SPEED_REF),
156
- arrayOf("string", ExifInterface.TAG_GPS_STATUS),
157
- arrayOf("string", ExifInterface.TAG_GPS_TIMESTAMP),
158
- arrayOf("double", ExifInterface.TAG_GPS_TRACK),
159
- arrayOf("string", ExifInterface.TAG_GPS_TRACK_REF),
160
- arrayOf("string", ExifInterface.TAG_GPS_VERSION_ID),
161
- arrayOf("string", ExifInterface.TAG_INTEROPERABILITY_INDEX),
162
- arrayOf("int", ExifInterface.TAG_THUMBNAIL_IMAGE_LENGTH),
163
- arrayOf("int", ExifInterface.TAG_THUMBNAIL_IMAGE_WIDTH),
164
- arrayOf("int", ExifInterface.TAG_DNG_VERSION),
165
- arrayOf("int", ExifInterface.TAG_DEFAULT_CROP_SIZE),
166
- arrayOf("int", ExifInterface.TAG_ORF_PREVIEW_IMAGE_START),
167
- arrayOf("int", ExifInterface.TAG_ORF_PREVIEW_IMAGE_LENGTH),
168
- arrayOf("int", ExifInterface.TAG_ORF_ASPECT_FRAME),
169
- arrayOf("int", ExifInterface.TAG_RW2_SENSOR_BOTTOM_BORDER),
170
- arrayOf("int", ExifInterface.TAG_RW2_SENSOR_LEFT_BORDER),
171
- arrayOf("int", ExifInterface.TAG_RW2_SENSOR_RIGHT_BORDER),
172
- arrayOf("int", ExifInterface.TAG_RW2_SENSOR_TOP_BORDER),
173
- arrayOf("int", ExifInterface.TAG_RW2_ISO)
174
- )
22
+ private val typeToTags = mapOf(
23
+ "string" to listOf(
24
+ ExifInterface.TAG_ARTIST,
25
+ ExifInterface.TAG_CFA_PATTERN,
26
+ ExifInterface.TAG_COMPONENTS_CONFIGURATION,
27
+ ExifInterface.TAG_COPYRIGHT,
28
+ ExifInterface.TAG_DATETIME,
29
+ ExifInterface.TAG_DATETIME_DIGITIZED,
30
+ ExifInterface.TAG_DATETIME_ORIGINAL,
31
+ ExifInterface.TAG_DEVICE_SETTING_DESCRIPTION,
32
+ ExifInterface.TAG_EXIF_VERSION,
33
+ ExifInterface.TAG_FILE_SOURCE,
34
+ ExifInterface.TAG_FLASHPIX_VERSION,
35
+ ExifInterface.TAG_GPS_AREA_INFORMATION,
36
+ ExifInterface.TAG_GPS_DATESTAMP,
37
+ ExifInterface.TAG_GPS_DEST_BEARING_REF,
38
+ ExifInterface.TAG_GPS_DEST_DISTANCE_REF,
39
+ ExifInterface.TAG_GPS_DEST_LATITUDE_REF,
40
+ ExifInterface.TAG_GPS_DEST_LONGITUDE_REF,
41
+ ExifInterface.TAG_GPS_H_POSITIONING_ERROR,
42
+ ExifInterface.TAG_GPS_IMG_DIRECTION_REF,
43
+ ExifInterface.TAG_GPS_LATITUDE_REF,
44
+ ExifInterface.TAG_GPS_LONGITUDE_REF,
45
+ ExifInterface.TAG_GPS_MAP_DATUM,
46
+ ExifInterface.TAG_GPS_MEASURE_MODE,
47
+ ExifInterface.TAG_GPS_PROCESSING_METHOD,
48
+ ExifInterface.TAG_GPS_SATELLITES,
49
+ ExifInterface.TAG_GPS_SPEED_REF,
50
+ ExifInterface.TAG_GPS_STATUS,
51
+ ExifInterface.TAG_GPS_TIMESTAMP,
52
+ ExifInterface.TAG_GPS_TRACK_REF,
53
+ ExifInterface.TAG_GPS_VERSION_ID,
54
+ ExifInterface.TAG_IMAGE_DESCRIPTION,
55
+ ExifInterface.TAG_IMAGE_UNIQUE_ID,
56
+ ExifInterface.TAG_INTEROPERABILITY_INDEX,
57
+ ExifInterface.TAG_MAKE,
58
+ ExifInterface.TAG_MAKER_NOTE,
59
+ ExifInterface.TAG_MODEL,
60
+ ExifInterface.TAG_OECF,
61
+ ExifInterface.TAG_RELATED_SOUND_FILE,
62
+ ExifInterface.TAG_SCENE_TYPE,
63
+ ExifInterface.TAG_SOFTWARE,
64
+ ExifInterface.TAG_SPATIAL_FREQUENCY_RESPONSE,
65
+ ExifInterface.TAG_SPECTRAL_SENSITIVITY,
66
+ ExifInterface.TAG_SUBSEC_TIME,
67
+ ExifInterface.TAG_SUBSEC_TIME_DIGITIZED,
68
+ ExifInterface.TAG_SUBSEC_TIME_ORIGINAL,
69
+ ExifInterface.TAG_USER_COMMENT,
70
+ ),
71
+ "double" to listOf(
72
+ ExifInterface.TAG_APERTURE_VALUE,
73
+ ExifInterface.TAG_BRIGHTNESS_VALUE,
74
+ ExifInterface.TAG_COMPRESSED_BITS_PER_PIXEL,
75
+ ExifInterface.TAG_DIGITAL_ZOOM_RATIO,
76
+ ExifInterface.TAG_EXPOSURE_BIAS_VALUE,
77
+ ExifInterface.TAG_EXPOSURE_INDEX,
78
+ ExifInterface.TAG_EXPOSURE_TIME,
79
+ ExifInterface.TAG_FLASH_ENERGY,
80
+ ExifInterface.TAG_FOCAL_LENGTH,
81
+ ExifInterface.TAG_FOCAL_PLANE_X_RESOLUTION,
82
+ ExifInterface.TAG_FOCAL_PLANE_Y_RESOLUTION,
83
+ ExifInterface.TAG_F_NUMBER,
84
+ ExifInterface.TAG_GPS_ALTITUDE,
85
+ ExifInterface.TAG_GPS_DEST_BEARING,
86
+ ExifInterface.TAG_GPS_DEST_DISTANCE,
87
+ ExifInterface.TAG_GPS_DEST_LATITUDE,
88
+ ExifInterface.TAG_GPS_DEST_LONGITUDE,
89
+ ExifInterface.TAG_GPS_DOP,
90
+ ExifInterface.TAG_GPS_IMG_DIRECTION,
91
+ ExifInterface.TAG_GPS_LATITUDE,
92
+ ExifInterface.TAG_GPS_LONGITUDE,
93
+ ExifInterface.TAG_GPS_SPEED,
94
+ ExifInterface.TAG_GPS_TRACK,
95
+ ExifInterface.TAG_MAX_APERTURE_VALUE,
96
+ ExifInterface.TAG_PRIMARY_CHROMATICITIES,
97
+ ExifInterface.TAG_REFERENCE_BLACK_WHITE,
98
+ ExifInterface.TAG_SHUTTER_SPEED_VALUE,
99
+ ExifInterface.TAG_SUBJECT_DISTANCE,
100
+ ExifInterface.TAG_WHITE_POINT,
101
+ ExifInterface.TAG_X_RESOLUTION,
102
+ ExifInterface.TAG_Y_CB_CR_COEFFICIENTS,
103
+ ExifInterface.TAG_Y_RESOLUTION,
104
+ ),
105
+ "int" to listOf(
106
+ ExifInterface.TAG_BITS_PER_SAMPLE,
107
+ ExifInterface.TAG_COLOR_SPACE,
108
+ ExifInterface.TAG_COMPRESSION,
109
+ ExifInterface.TAG_CONTRAST,
110
+ ExifInterface.TAG_CUSTOM_RENDERED,
111
+ ExifInterface.TAG_DEFAULT_CROP_SIZE,
112
+ ExifInterface.TAG_DNG_VERSION,
113
+ ExifInterface.TAG_EXPOSURE_MODE,
114
+ ExifInterface.TAG_EXPOSURE_PROGRAM,
115
+ ExifInterface.TAG_FLASH,
116
+ ExifInterface.TAG_FOCAL_LENGTH_IN_35MM_FILM,
117
+ ExifInterface.TAG_FOCAL_PLANE_RESOLUTION_UNIT,
118
+ ExifInterface.TAG_GAIN_CONTROL,
119
+ ExifInterface.TAG_GPS_ALTITUDE_REF,
120
+ ExifInterface.TAG_GPS_DIFFERENTIAL,
121
+ ExifInterface.TAG_IMAGE_LENGTH,
122
+ ExifInterface.TAG_IMAGE_WIDTH,
123
+ ExifInterface.TAG_ISO_SPEED_RATINGS,
124
+ ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT,
125
+ ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
126
+ ExifInterface.TAG_LIGHT_SOURCE,
127
+ ExifInterface.TAG_METERING_MODE,
128
+ ExifInterface.TAG_NEW_SUBFILE_TYPE,
129
+ ExifInterface.TAG_ORF_ASPECT_FRAME,
130
+ ExifInterface.TAG_ORF_PREVIEW_IMAGE_LENGTH,
131
+ ExifInterface.TAG_ORF_PREVIEW_IMAGE_START,
132
+ ExifInterface.TAG_ORIENTATION,
133
+ ExifInterface.TAG_PHOTOMETRIC_INTERPRETATION,
134
+ ExifInterface.TAG_PIXEL_X_DIMENSION,
135
+ ExifInterface.TAG_PIXEL_Y_DIMENSION,
136
+ ExifInterface.TAG_PLANAR_CONFIGURATION,
137
+ ExifInterface.TAG_RESOLUTION_UNIT,
138
+ ExifInterface.TAG_ROWS_PER_STRIP,
139
+ ExifInterface.TAG_RW2_ISO,
140
+ ExifInterface.TAG_RW2_SENSOR_BOTTOM_BORDER,
141
+ ExifInterface.TAG_RW2_SENSOR_LEFT_BORDER,
142
+ ExifInterface.TAG_RW2_SENSOR_RIGHT_BORDER,
143
+ ExifInterface.TAG_RW2_SENSOR_TOP_BORDER,
144
+ ExifInterface.TAG_SAMPLES_PER_PIXEL,
145
+ ExifInterface.TAG_SATURATION,
146
+ ExifInterface.TAG_SCENE_CAPTURE_TYPE,
147
+ ExifInterface.TAG_SENSING_METHOD,
148
+ ExifInterface.TAG_SHARPNESS,
149
+ ExifInterface.TAG_STRIP_BYTE_COUNTS,
150
+ ExifInterface.TAG_STRIP_OFFSETS,
151
+ ExifInterface.TAG_SUBFILE_TYPE,
152
+ ExifInterface.TAG_SUBJECT_AREA,
153
+ ExifInterface.TAG_SUBJECT_DISTANCE_RANGE,
154
+ ExifInterface.TAG_SUBJECT_LOCATION,
155
+ ExifInterface.TAG_THUMBNAIL_IMAGE_LENGTH,
156
+ ExifInterface.TAG_THUMBNAIL_IMAGE_WIDTH,
157
+ ExifInterface.TAG_TRANSFER_FUNCTION,
158
+ ExifInterface.TAG_WHITE_BALANCE,
159
+ ExifInterface.TAG_Y_CB_CR_POSITIONING,
160
+ ExifInterface.TAG_Y_CB_CR_SUB_SAMPLING,
161
+ )
162
+ )
163
+ }
175
164
  }
@@ -0,0 +1,35 @@
1
+ package expo.modules.imagepicker
2
+
3
+ import androidx.core.net.toUri
4
+ import expo.modules.kotlin.exception.CodedException
5
+ import java.io.File
6
+
7
+ internal class FailedToDeduceTypeException :
8
+ CodedException("Can not deduce type of the returned file")
9
+
10
+ internal class FailedToCreateFileException(path: String, cause: Throwable? = null) :
11
+ CodedException("Failed to create the file '$path'", cause)
12
+
13
+ internal class FailedToExtractVideoMetadataException(file: File? = null, cause: Throwable? = null) :
14
+ CodedException("Failed to extract metadata from video file '${file?.toUri()?.toString() ?: ""}'", cause)
15
+
16
+ internal class FailedToWriteExifDataToFileException(file: File, cause: Throwable) :
17
+ CodedException("Failed to write EXIF data to file '${file.toUri()}", cause)
18
+
19
+ internal class FailedToWriteFileException(file: File? = null, cause: Throwable? = null) :
20
+ CodedException("Failed to write a file '${file?.toUri()?.toString() ?: ""}'", cause)
21
+
22
+ internal class FailedToReadFileException(file: File, cause: Throwable? = null) :
23
+ CodedException("Failed to read a file '${file.toUri()}", cause)
24
+
25
+ internal class MissingActivityToHandleIntent(intentType: String?) :
26
+ CodedException("Failed to resolve activity to handle the intent of type '$intentType'")
27
+
28
+ internal class MissingCurrentActivityException :
29
+ CodedException("Activity which was provided during module initialization is no longer available")
30
+
31
+ internal class MissingModuleException(moduleName: String) :
32
+ CodedException("Module '$moduleName' not found. Are you sure all modules are linked correctly?")
33
+
34
+ internal class UserRejectedPermissionsException :
35
+ CodedException("User rejected permissions")