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

Bugfix issue 341 save to photo gallery - Fixes #341, fixes #577 #669

Merged

Conversation

PieterVanPoyer
Copy link
Contributor

@PieterVanPoyer PieterVanPoyer commented Sep 29, 2020

Platforms affected

  • Android

Motivation and Context

The saveToPhotoAlbum setting throws an exception while using the camera. (sourceType = CAMERA)
This results in a crash of the application.
The first bug was reported in september 2018.
This PR only tries to solve the issue for the sourceType Camera.PictureSourceType.CAMERA, not for when the sourceType is PHOTOLIBRARY.
A reproduction of the issue can be done with https://github.com/PieterVanPoyer/cordova-camera-plugin-testing-app repo.

Description

  • saveToPhotoAlbum feature fixed by taken into count content - uri. (writeUncompressedImage method) ( see: Cannot use saveToPhotoAlbum: true on Android 10 #611 (comment) )
  • make saveToPhotoAlbum future proof by using the MediaStore to insert the taken image
  • made a method to calculate the compressFormat based on the encodingType (JPEG or PNG)
  • layout of the performCrop method is adjusted
  • removed unused rotate variable inside processResultFromGallery method
  • added a GalleryPathVO (ValueObject) for more easy working with the path and imagename.
  • add extra VO class to the plugin.xml

Testing

I did run npm run test.
Tested on Android emulators from Android 5.1, 7, 10 and 11.
Tested on a real Samsung J7 device (Android 9), tested on a Samsung Galaxy tablet.

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

…om camera - Android

- saveToPhotoAlbum feature fixed by taken into count content - uri. (writeUncompressedImage method) ( see: apache#611 (comment) )
- make saveToPhotoAlbum future proof by using the MediaStore to insert the taken image
- made a method to calculate the compressFormat based on the encodingType (JPEG or PNG)
- layout of the performCrop method is adjusted
- removed unused rotate variable inside processResultFromGallery method
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix/issue 341 save to photo gallery WIP Bugfix/issue 341 save to photo gallery #577 #341 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix/issue 341 save to photo gallery #577 #341 WIP Bugfix/issue 341 save to photo gallery#577#341 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix/issue 341 save to photo gallery#577#341 WIP Bugfix/issue 341 save to photo gallery fixes#577 fixes#341 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix/issue 341 save to photo gallery fixes#577 fixes#341 WIP Bugfix/issue 341 save to photo gallery - fixes #577, fixes #341 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix/issue 341 save to photo gallery - fixes #577, fixes #341 Bugfix issue 341 save to photo gallery - fixes #577, fixes #341 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title Bugfix issue 341 save to photo gallery - fixes #577, fixes #341 Bugfix issue 341 save to photo gallery - Fixes https://github.com/apache/cordova-plugin-camera#341, fixes https://github.com/apache/cordova-plugin-camera#577 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title Bugfix issue 341 save to photo gallery - Fixes https://github.com/apache/cordova-plugin-camera#341, fixes https://github.com/apache/cordova-plugin-camera#577 WIP Bugfix issue 341 save to photo gallery - Fixes https://github.com/apache/cordova-plugin-camera#341, fixes https://github.com/apache/cordova-plugin-camera#577 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix issue 341 save to photo gallery - Fixes https://github.com/apache/cordova-plugin-camera#341, fixes https://github.com/apache/cordova-plugin-camera#577 WIP Bugfix issue 341 save to photo gallery - Fixes #341, fixes #577 Sep 29, 2020
@PieterVanPoyer PieterVanPoyer changed the title WIP Bugfix issue 341 save to photo gallery - Fixes #341, fixes #577 Bugfix issue 341 save to photo gallery - Fixes #341, fixes #577 Sep 30, 2020
@PieterVanPoyer
Copy link
Contributor Author

PieterVanPoyer commented Sep 30, 2020

@erisu or @breautek can anybody review this PR, please?
The Travis build failed, but nothing was changed for the failed tests.

@breautek
Copy link
Contributor

Travis is failling on browser tests, and considering this PR changes nothing in the browser platform, I don't think it's a blocker. It seems to be a timeout issue, so I'll close/reopen this PR to retrigger travis. Maybe that's all it is.

I had a glance at this PR and I don't see anything wrong, but I would like to spend some time to actually test on a physical device, but I don't think I can do that this week.

@breautek breautek closed this Sep 30, 2020
@breautek breautek reopened this Sep 30, 2020
@PieterVanPoyer
Copy link
Contributor Author

@erisu Hey, I hate to disturb you, but can you find the time to review this PR. Kind regards.

@PieterVanPoyer
Copy link
Contributor Author

@breautek Hey it seems like erisu can not find the time to review this PR, maybe just merge it to the master? Or maybe we should request another reviewer?
Kind regards.

@breautek
Copy link
Contributor

breautek commented Oct 8, 2020

I'll give a 1 week call out.

If there are no objections by October 16 I'll merge.

@PieterVanPoyer
Copy link
Contributor Author

I'll give a 1 week call out.

If there are no objections by October 16 I'll merge.

Sound like a great plan! Thanks.

@breautek breautek merged commit ebe0517 into apache:master Oct 17, 2020
@breautek
Copy link
Contributor

Travis failures are unrelated to this PR. Merging now. Thank you @PieterVanPoyer for your time and effort in preparing this PR.

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.

SaveToPhotoAlbum does not save image on Android Save Photo To Album - Android (not tested on iOS)
3 participants