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(camera)!: Use Android Photo Picker instead of ACTION_PICK intent #1833

Merged
merged 4 commits into from
Nov 6, 2023

Conversation

jcesarmobile
Copy link
Member

@jcesarmobile jcesarmobile commented Oct 6, 2023

Setting it as breaking because the component change might cause unknown behaviour changes.
Also because it no longer requires permissions for picking pictures from the gallery on Android.

I have not tested the changes in a fragment, so not sure if somebody with a sample app that uses fragments could test it and make sure this code is correct
https://github.com/ionic-team/capacitor-plugins/pull/1833/files#diff-40c8474750f8a1fbb312900f646eca6a86067853007cdfe292b428bf0e48bddfR322-R334
I made it similar to how fragment.registerForActivityResult works.

@jcesarmobile jcesarmobile changed the title feat!(camera): Use Android Photo Picker instead of ACTION_PICK intent feat(camera)!: Use Android Photo Picker instead of ACTION_PICK intent Oct 6, 2023
@carlpoole
Copy link
Member

Setting it as breaking because the component change might cause unknown behaviour changes. Also because it no longer requires permissions for picking pictures from the gallery on Android.

I have not tested the changes in a fragment, so not sure if somebody with a sample app that uses fragments could test it and make sure this code is correct https://github.com/ionic-team/capacitor-plugins/pull/1833/files#diff-40c8474750f8a1fbb312900f646eca6a86067853007cdfe292b428bf0e48bddfR322-R334 I made it similar to how fragment.registerForActivityResult works.

@jcesarmobile tested this in the Portals Ecommerce App and it seems to be working as expected.

image

@bhandaribhuminpfizer

This comment was marked as off-topic.

Copy link

github-actions bot commented Nov 6, 2023

Released dev build of camera with dev version: 5.0.8-dev-1833-20231106T142057.0

@jcesarmobile jcesarmobile merged commit dd8f5d2 into main Nov 6, 2023
11 checks passed
@jcesarmobile jcesarmobile deleted the photo-picker branch November 6, 2023 14:51
LaravelFreelancerNL pushed a commit to dennis-wedevise/capacitor-plugins that referenced this pull request Dec 19, 2023
NetEvolutions added a commit to werktools/capacitor-plugins that referenced this pull request Jan 30, 2024
…ols/capacitor-plugins into ios-location-aware-camera

* 'ios-location-aware-camera' of https://github.com/werktools/capacitor-plugins: (24 commits)
  fix(keyboard): distribute the new SPM files (ionic-team#1895)
  chore: only lint plugins that changed (ionic-team#1880)
  feat(google-maps)!: Update iOS dependencies (ionic-team#1890)
  chore: update Podfile paths (ionic-team#1891)
  chore(ios): fix verify script (ionic-team#1892)
  chore(release): publish [skip ci]
  docs(README): Update note for Capacitor 6 (ionic-team#1883)
  chore: update dependencies to use next tag (ionic-team#1889)
  chore: bump version to 6.0.0-alpha.0 (ionic-team#1888)
  feat(app,haptics,status-bar,keyboard): Supporting Swift Package Manager (ionic-team#1886)
  chore(android): upgrade gradle wrapper and plugin to 8.2.x (ionic-team#1885)
  refactor(ios): remove removeAllListeners methods (ionic-team#1867)
  feat(camera)!: Use Android Photo Picker instead of ACTION_PICK intent (ionic-team#1833)
  fix(share): Address Android 14 changes (ionic-team#1849)
  chore: Remove lerna bootstrap form scripts (ionic-team#1875)
  chore: fix toggle-local npm script (ionic-team#1847)
  feat(filesystem): add removeAllListeners method (ionic-team#1862)
  docs(google-maps/geolocation)!: Removing deprecated usage descriptions for iOS (ionic-team#1855)
  chore: use the new addListener return type (ionic-team#1846)
  chore: ci release dev for non-draft PR's (ionic-team#1854)
  ...
@webfletch
Copy link

Setting it as breaking because the component change might cause unknown behaviour changes. Also because it no longer requires permissions for picking pictures from the gallery on Android.

This does cause unknown behaviour changes and various differences to how it works depending on the Android version and device being used, including breaking the functionality for selecting multiple images on some devices, as outlined in the following issue: #2199

Due to the amount of uncertainty around how different devices/versions would be affected by this change, I think this would have benefitted from having an option for "UseLegacyMode" to allow people to not be forced to use the Android Photo Picker and continue using the previous image picker.

Due to the issues outlined above it means that we cannot upgrade to this version of Capacitor until we change to use a different image picker that provides a consistent interface and functionality across different Android versions.

@jcesarmobile
Copy link
Member Author

Sadly Google is requiring to use the Photo Picker for apps whose main purpose isn't handling images, so there was no option for us to keep backward compatible code as it could lead to app rejections if the code was detected even if not used by all users.

And sadly the Photo Picker is half backed, same thing happened when they forced to use the Android 12 Splash Screen API.

You can try updating the androidxActivityVersion variable in variables.gradle to 1.10.0-alpha02 and see if it solves your problems, it supposedly has fixed several problems with 3rd party pickers.

If you still find issues you can report them to Google

The deadline to not use the Photo Picker already expired, they started asking for additional information when requesting the photos permission and you have to send the information before October 31, 2024.
You can ask for an extension and if they grant it you could still use the old API until January 22, 2025, but then you'll have to use the Photo Picker.

@webfletch
Copy link

@jcesarmobile Thank you for the detailed explanation as to the reasons you were forced to make this change.

We tried 1.10.0-alpha02 and it resolved some issues (i.e. multiple select worked on Android 9 again) but still didn't fix the strange issue of a completely different photo picker being used on a Pixel 4 (Android 12) emulator.

As you mentioned it seems that the Photo Picker does need a lot of work before it is fit for purpose on all devices, there are already a lot of reported issues with Google I found from following your link.

Our App is one that has been approved as having a main purpose of handling images so we are not forced to use the Photo Picker, therefore, I think the best solution for us for the time being is going to be to use a forked version of Capacitor/Camera where we have reverted back the changes forcing the use of Photo Picker, then just wait until they have brought out the relevant updates to fix the backwards compatibility issues or wait until our userbase have updated their devices to newer versions.

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

Successfully merging this pull request may close these issues.

6 participants