Changes from #906 resulted in all gallery picker results being read in full into a byte array. This works fine when dealing with images, however when larger files (videos for example) are selected it will nearly always result in an out of memory error (reading too much data in one go). With videos no transformation is required, the URI simply need to be returned.
Co-authored-by: Alister Stevens <alister@pebblepad.co.uk>
- Does not need any permissions for reading images
- The PHPickerViewController class is an alternative to UIImagePickerController. PHPickerViewController improves stability and reliability, and includes several benefits to developers and users, such as the following:
- Deferred image loading and recovery UI
- Reliable handling of large and complex assets, like RAW and panoramic images
- User-selectable assets that aren’t available for UIImagePickerController
- Configuration of the picker to display only Live Photos
- Availability of PHLivePhoto objects without library access
- Stricter validations against invalid inputs
- See documentation of PHPickerViewController: https://developer.apple.com/documentation/photosui/phpickerviewcontroller?language=objc
- Added tests for PHPickerViewController in `CameraTest.m`
* Documentation and formatting
- Document `takePicture` and `showCameraPicker` in `CDVCamera.m`
- A pragmas for UIImagePickerControllerDelegate methods and CLLocationManager methods
- Format some long methods declarations to multi-line instead single-line for better readability
- Remove unnecessry `dispatch_async(dispatch_get_main_queue() ...` in `takePicture` before calling `showCameraPicker`. This is already done in `showCameraPicker`.
- Source out code for permission denied alert dialog when accessing the camera or UIImagePickerController on iOS < 14 for picking images
* feat(ios): proper formatting of methods
- Use linux brace style: A brace have to be on a new line for method declarations
- Remove unnecessary whitespaces in method declrations
* doc: readme update
- Better document usage descriptions
- `NSPhotoLibraryUsageDescription` not needed for iOS 14+ when only picking images
- Improve formatting for xml, js
- sourceType `SAVEDPHOTOALBUM` is the same as `PHOTOLIBRARY` on Android and iOS 14+
- Use `PHOTOLIBRARY` as sourceType instead of `SAVEDPHOTOALBUM` in photo picker example
* Android: Document `SAVEDPHOTOALBUM``
- Make clear that `SAVEDPHOTOALBUM` is the same like `PHOTOLIBRARY` and has only an effect on iOS < 14
- Format code when creating image chooser and document the request code parameter
* refactor(android): Rework permission management to make WRITE_EXTERNAL_STORAGE optional
* removed unused getPermissions API
* Proper error if WRITE_EXTERNAL_STORAGE is required but missing the declaration
* removed obsolete hasPermissions API
* feat(android)!: Android 13 support
* refactor(android): simplify getPermissions logic
* feat(android)!: bump cordova-android requirement to >=12.0.0
* feat(android): update saveAlbumPermission to include Android 9 and below use case
---------
Co-authored-by: ochakov <evgeny@ochakov.com>
* GH-665 - store the imageFilePath when the app is paused (onSaveInstance) and restore it back.
* Update src/android/CameraLauncher.java whitespace layout
Co-authored-by: Tim Brust <github@timbrust.de>
Co-authored-by: Tim Brust <github@timbrust.de>
* GH-341 - GH-577 Fixed the Save Photo To Album starting from camera - Android
- saveToPhotoAlbum feature fixed by taken into count content - uri. (writeUncompressedImage method) ( see: https://github.com/apache/cordova-plugin-camera/issues/611#issuecomment-700273405 )
- 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
* Add extra VO class to the plugin.xml
* added package declaration to new VO
* GH-341 - GH-577 https://github.com/apache/cordova-plugin-camera/pull/669#discussion_r504632953 listen to review
* CB-14097: (android) Fix crash when selecting some files with getPicture of urls with raw://
Handles both urls:
content://com.android.providers.downloads.documents/document/1111
content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Ffilename.pdf
* Optimization: Remove TextUtils dependency, return null when no id could be extracted
If someone had removed Pictures folder in android, plugin failed trying to move there the new photo. This happened because plugin did not check the existence of this folder, and if not, it did not complete the folder tree.
This closes#273
The plugin was checking whether camera permission was granted but then
actually requested permission for external storage.
Surprisingly enough this fixed CB-12368.