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

refactor(android): remove query img usage #907

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

breautek
Copy link
Contributor

@breautek breautek commented Oct 25, 2024

Will rebase after #906 & #902 is merged.

Platforms affected

Android

Motivation and Context

fixes #891
closes #725
closes #660

This code existed since the beginning of time and it does not appear to be relevant anymore.
Duplicates does not occur, even with using DATA_URL or creating modifications via scaling.

Additionally querying the media store on API 28 and lower requires broad READ_EXTERNAL_STORAGE permission. If we can remove numpics and the usage of queryImgDb then we can make READ/WRITE_EXTERNAL_STORAGE optional.

With this change, on API 29+ no permissions are necessary to use the plugin, except for CAMERA if it's declared (that workaround is still necessary).

On API 28 and lower, WRITE_EXTERNAL_PERMISSION is optional, but will be required if saveToPhotoAlbum option is enabled, which is a change I plan to make in another PR soon.

Additionally, the way it was detecting and attempting to remove duplicate images is dangerous, as media store objects can be inserted at any time by other applications. There is no guarantee that the image selected as the duplicate was actually the duplicate, or if there was a duplicate to begin with.

Description

Removed numpics and all code related to managing numpics

Testing

Manual test on API 24
Paramedic test passes

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@breautek breautek added this to the 8.0.0 milestone Oct 25, 2024
@breautek breautek force-pushed the refactor/remove-query-img-usage branch 2 times, most recently from c181067 to 1ad86f6 Compare October 28, 2024 15:44
@breautek breautek force-pushed the refactor/remove-query-img-usage branch from 1ad86f6 to 3617e39 Compare October 28, 2024 15:47
@breautek breautek requested a review from erisu October 28, 2024 16:16
@breautek breautek marked this pull request as ready for review October 28, 2024 16:16
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

LGTM

  • Tested Mobile Spec
  • Tested getPicture with
    • sourceType=CAMERA, destinationType=DATA_URL
    • sourceType=CAMERA, destinationType=DATA_URL, saveToPhotoAlbum=true

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