expo-image-picker 14.3.0 → 14.3.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,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 14.3.1 — 2023-07-04
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix manifest merger build fail on Android. ([#23191](https://github.com/expo/expo/pull/23191) by [@alexandrius](https://github.com/alexandrius))
18
+ - [Android] Fix backported photo picker crashing with null intent. ([#23224](https://github.com/expo/expo/pull/23224) by [@thespacemanatee](https://github.com/thespacemanatee))
19
+
13
20
  ## 14.3.0 — 2023-06-13
14
21
 
15
22
  ### 🎉 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 = '14.3.0'
6
+ version = '14.3.1'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -67,7 +67,7 @@ android {
67
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
68
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
69
  versionCode 22
70
- versionName "14.3.0"
70
+ versionName "14.3.1"
71
71
  }
72
72
  lintOptions {
73
73
  abortOnError false
@@ -85,7 +85,7 @@ dependencies {
85
85
  implementation "androidx.activity:activity-ktx:1.7.1"
86
86
  implementation "androidx.appcompat:appcompat:1.4.2"
87
87
  implementation "androidx.exifinterface:exifinterface:1.3.3"
88
- implementation "com.github.CanHub:Android-Image-Cropper:4.3.0"
88
+ implementation "com.github.CanHub:Android-Image-Cropper:4.3.1"
89
89
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
90
90
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3"
91
91
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3"
@@ -1,5 +1,4 @@
1
- <manifest xmlns:tools="http://schemas.android.com/tools"
2
- xmlns:android="http://schemas.android.com/apk/res/android">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
  <!-- Required for picking images from camera directly -->
4
3
  <uses-permission android:name="android.permission.CAMERA"/>
5
4
 
@@ -10,22 +9,10 @@
10
9
  <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
11
10
 
12
11
  <application>
13
- <!-- Trigger Google Play services to install the backported photo picker module. -->
14
- <service android:name="com.google.android.gms.metadata.ModuleDependencies"
15
- android:enabled="false"
16
- android:exported="false"
17
- tools:ignore="MissingClass">
18
- <intent-filter>
19
- <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
20
- </intent-filter>
21
- <meta-data android:name="photopicker_activity:0:required" android:value="" />
22
- </service>
23
-
24
-
25
12
  <activity
26
13
  android:name="com.canhub.cropper.CropImageActivity"
27
14
  android:theme="@style/Base.Theme.AppCompat"/>
28
- <!-- https://developer.android.com/guide/topics/manifest/provider-element.html -->
15
+ <!-- https://developer.android.com/guide/topics/manifest/provider-element.html -->
29
16
  <provider
30
17
  android:name=".fileprovider.ImagePickerFileProvider"
31
18
  android:authorities="${applicationId}.ImagePickerFileProvider"
@@ -33,41 +33,57 @@ internal class ImageLibraryContract(
33
33
  }.contentResolver
34
34
 
35
35
  override fun createIntent(context: Context, input: ImageLibraryContractOptions): Intent {
36
- val request = PickVisualMediaRequest.Builder()
37
- .setMediaType(
38
- when (input.options.mediaTypes) {
39
- MediaTypes.VIDEOS -> {
40
- PickVisualMedia.VideoOnly
41
- }
42
- MediaTypes.IMAGES -> {
43
- PickVisualMedia.ImageOnly
44
- }
45
- else -> {
46
- PickVisualMedia.ImageAndVideo
36
+ if (PickVisualMedia.isPhotoPickerAvailable(context)) {
37
+ val request = PickVisualMediaRequest.Builder()
38
+ .setMediaType(
39
+ when (input.options.mediaTypes) {
40
+ MediaTypes.VIDEOS -> {
41
+ PickVisualMedia.VideoOnly
42
+ }
43
+
44
+ MediaTypes.IMAGES -> {
45
+ PickVisualMedia.ImageOnly
46
+ }
47
+
48
+ else -> {
49
+ PickVisualMedia.ImageAndVideo
50
+ }
47
51
  }
48
- }
49
- ).build()
52
+ ).build()
50
53
 
51
- if (input.options.allowsMultipleSelection) {
52
- val selectionLimit = input.options.selectionLimit
54
+ if (input.options.allowsMultipleSelection) {
55
+ val selectionLimit = input.options.selectionLimit
53
56
 
54
- if (selectionLimit == 1) {
55
- // If multiple selection is allowed but the limit is 1, we should ignore
56
- // the multiple selection flag and just treat it as a single selection.
57
- return PickVisualMedia().createIntent(context, request)
58
- }
57
+ if (selectionLimit == 1) {
58
+ // If multiple selection is allowed but the limit is 1, we should ignore
59
+ // the multiple selection flag and just treat it as a single selection.
60
+ return PickVisualMedia().createIntent(context, request)
61
+ }
59
62
 
60
- if (selectionLimit > 1) {
61
- return PickMultipleVisualMedia(selectionLimit).createIntent(context, request)
62
- }
63
+ if (selectionLimit > 1) {
64
+ return PickMultipleVisualMedia(selectionLimit).createIntent(context, request)
65
+ }
63
66
 
64
- // If the selection limit is 0, it is the same as unlimited selection.
65
- if (selectionLimit == UNLIMITED_SELECTION) {
66
- return PickMultipleVisualMedia().createIntent(context, request)
67
+ // If the selection limit is 0, it is the same as unlimited selection.
68
+ if (selectionLimit == UNLIMITED_SELECTION) {
69
+ return PickMultipleVisualMedia().createIntent(context, request)
70
+ }
67
71
  }
72
+
73
+ return PickVisualMedia().createIntent(context, request)
68
74
  }
69
75
 
70
- return PickVisualMedia().createIntent(context, request)
76
+ return Intent(Intent.ACTION_GET_CONTENT)
77
+ .addCategory(Intent.CATEGORY_OPENABLE)
78
+ .setType(input.options.mediaTypes.toMimeType())
79
+ .apply {
80
+ if (input.options.allowsMultipleSelection) {
81
+ putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
82
+ }
83
+ if (input.options.mediaTypes == MediaTypes.ALL) {
84
+ putExtra(Intent.EXTRA_MIME_TYPES, arrayOf(MediaTypes.IMAGES.toMimeType(), MediaTypes.VIDEOS.toMimeType()))
85
+ }
86
+ }
71
87
  }
72
88
 
73
89
  override fun parseResult(input: ImageLibraryContractOptions, resultCode: Int, intent: Intent?) =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-image-picker",
3
- "version": "14.3.0",
3
+ "version": "14.3.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",
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "3ccd2edee9cbfed217557675cb50f0ba5e55a9e4"
47
+ "gitHead": "cf90d5c30c2a08a6493ebfa8aa3791aa70666759"
48
48
  }