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

bug: Original image is lost if choosing not to edit for Camera plugin on Android #2020

Closed
1 of 4 tasks
domoosterloo opened this issue Oct 2, 2019 · 5 comments
Closed
1 of 4 tasks

Comments

@domoosterloo
Copy link

domoosterloo commented Oct 2, 2019

Bug Report

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 1.2.1

@capacitor/core: 1.2.1

@capacitor/android: 1.2.1

@capacitor/ios: 1.2.1

Installed Dependencies:

@capacitor/cli 1.2.1

@capacitor/ios 1.2.1

@capacitor/android 1.2.1

@capacitor/core 1.2.1

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

On Android device:
Open camera using Camera plugin.
Take picture
Accept picture -> navigates to edit screen
Try and continue without editing picture
No image is returned

Expected Behavior

If no edit is performed, original image should be returned

Sample Code or Sample Application Repo

const image = await Camera.getPhoto({
quality: 90,
allowEditing: true,
resultType: CameraResultType.Uri,
source: "CAMERA"
});

Reproduction Steps

On Android device:
Open camera using Camera plugin.
Take picture
Accept picture -> navigates to edit screen
Try and continue without editing picture
No image is returned

Other Technical Details

Issue is in com.getcapacitor.plugin.Camera
handleOnActivityResult
if (requestCode == REQUEST_IMAGE_EDIT)
....
Needs to check result code is either Activity.RESULT_OK or Activity.RESULT_CANCELLED.
and only go to processImage if resultCode == Activity.RESULT_OK.
If Activity.RESULT_CANCELLED || data == null && originalImageUri exists
return original image.

Other Information

@JhonArlex
Copy link
Contributor

Good day.
I will work on this issue. I would like to know from which branch I must clone to perform the task. @jcesarmobile

@jcesarmobile
Copy link
Member

jcesarmobile commented Jan 20, 2020

From master.

But create your own branch to work, and when you send the pull request, mark the “allow commits from maintainers” checkbox just in case we need to make some changes

@jcesarmobile
Copy link
Member

closing since the PR was merged

@vycoder
Copy link

vycoder commented Mar 31, 2020

Hi, I badly needed this fix. Just wondering on when will this fix be available. Thanks!

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants