Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new PhotoPicker API for Android 13 Teramisu #1955

Conversation

vincent-paing
Copy link
Contributor

@vincent-paing vincent-paing commented Mar 12, 2022

  • Explain the motivation for making this change.
  • Provide a test plan demonstrating that the code is solid.
  • Match the code formatting of the rest of the codebase.
  • Target the master branch, NOT a "stable" branch.

Motivation (required)

Android 13 (codenamed Teramisu) introduces a new Photo Picker API that doesn't require the app to access full media libraries. Going forward, the photo picker will be the recommended way to access the user’s photos and videos. It also provides the API to select a specific amount of image/video to be selected instead of any number.

Test Plan (required)

  • Follow the doc to setup Android 13 emulator
  • Click Select Image, Select Video or mixed, and check if it pop up the new Photo picker UI
  • Play with 0, 1 and 3 values for selectionLimit to see if it correctly handles max, one and certain amount of limit cases.
  • Test the same thing with Android < 13 device

(Currently there is known bug where Android 13 emulator does not return correct SDK_INT, so you might need to remove the if/else check for OS version to test it)

NOTE: It might be too early to merge this PR, this is just a preemptive PR so that we can polish this and merge when Android 13 become stable

@vincent-paing vincent-paing changed the title Add new PhotoPicker API for Android Teramisu feat: add new PhotoPicker API for Android 13 Teramisu Mar 12, 2022
Comment on lines 4 to 8
compileSdkVersion "android-Tiramisu"

defaultConfig {
minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion
targetSdkVersion "Tiramisu"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I agree with this change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is not a good idea

@Johan-dutoit
Copy link
Collaborator

Great idea getting ahead with this PR. Barring the comment, the changes seem decent.
I agree that it might be too early. Let's keep it open and see how everything plays out.

@vincent-paing vincent-paing force-pushed the feat/android13photopicker branch 2 times, most recently from 6d3a543 to 7c31ec8 Compare June 13, 2022 14:30
@vincent-paing
Copy link
Contributor Author

Android 13 hits Platform stability and as such, I have updated the sdk versions to the stable version. After you have confirm the feature on pre Android 13 and a Android 13 device/emulator, then feel free to merge it.

@artyorsh
Copy link

artyorsh commented Jul 6, 2022

Android 13 hits Platform stability and as such, I have updated the sdk versions to the stable version. After you have confirm the feature on pre Android 13 and a Android 13 device/emulator, then feel free to merge it.

@Johan-dutoit given the above, can we have another round of PR review? I also agree it might be early to publish to stable channel, but we can use @next or @beta tag on npm in order to allow apps to test it (I personally would be happy to participate and give feedback 🙂 )

UPD: tested with installing @vincent-paing repo directly - works fine on Emulator with zero changes to the code base (see video)

build.gradle

  buildToolsVersion = "33.0.0"
  compileSdkVersion = 33
  targetSdkVersion = 33

@taher435
Copy link

Given the fact that Android 13 is now available on Pixel devices, it would be great if this change is available in the next release for an upgrade.

@Johan-dutoit Johan-dutoit merged commit 28aa402 into react-native-image-picker:main Aug 22, 2022
Johan-dutoit pushed a commit that referenced this pull request Aug 22, 2022
# [4.9.0](v4.8.5...v4.9.0) (2022-08-22)

### Features

* add new PhotoPicker API for Android 13 Teramisu ([#1955](#1955)) ([28aa402](28aa402))
@Johan-dutoit
Copy link
Collaborator

🎉 This PR is included in version 4.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@pierroo
Copy link

pierroo commented Dec 30, 2022

Quick question though, it seems that this new API no longer grants access to every folders unlike before.
Of course I did add the READ_MEDIA_IMAGES permission in manifest, but still, I can only access favorites / camera / screenshot / downloads, but not every other folders.
It was working fine in earlier versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants