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

fix(android): handle cancelled media capture intent (#291) #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bmarsaud
Copy link

@bmarsaud bmarsaud commented Apr 15, 2024

Platforms affected

Android

Motivation and Context

Fixes the #291 issue.

Description

In case of a cancelled image capture intent we onImageActivityResult anyway and check there if the writen image size is greater than 0.
This handle the case where the intent is cancelled but the image is available.

Testing

Can someone explain how to run the tests?

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

@ath0mas
Copy link
Contributor

ath0mas commented Jun 22, 2024

Do you consider this PR to be still relevant? after your comment and sort of resolution through AndroidLaunchMode and singleInstance vs. singleTask, #291 (comment)

@bmarsaud
Copy link
Author

Still relevant for apps that uses singleInstance instead of singleTask. I don't know if this within the scope of this plugin to be resilient to these cases, I let you decide.

// Result received okay
if (resultCode == Activity.RESULT_OK) {
// Result received okay or the capture image intent has been cancelled
if (resultCode == Activity.RESULT_OK || (req.action == CAPTURE_IMAGE && intent == null)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why specifically CAPTURE_IMAGE? It may be the case for audio and video capture too?

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

Successfully merging this pull request may close these issues.

2 participants