Commit Graph
16 Commits
Author SHA1 Message Date
Manuel BeckandGitHub a7cd05b20c chore(CDVCamera): refactor code when returning image after getting the location (#969)
- Renamed property `data` to `tempImageDataForLocationManager` since it is only used when getting location data for an image after capturing it
- Renamed method `imagePickerControllerReturnImageResult` to `returnImageAfterLocationUpdate` since it is only called, when a location was fetched, or an error ocurred while fetching one.
2026-07-30 08:49:41 +02:00
エリスandGitHub 571f1169fd chore(license): update header formatting (#958) 2026-03-24 13:52:15 +09:00
Manuel BeckandGitHub 1848db07ef ios: rename property pickerController to cdvUIImagePickerController (#949)
- Make clear that is a `CDVUIImagePickerController`
2026-01-30 19:19:49 +01:00
Manuel BeckandGitHub 77e85f2f08 ios! rename CDVCameraPicker to CDVUIImagePickerController (#948)
- Rename to `CDVUIImagePickerController ` since it inherits from `UIImagePickerController` and is not only for taking pictures
- This is a breaking change because it renames an externally visible interface.
2026-01-30 18:41:01 +01:00
Manuel BeckandGitHub b75cff893e ios: rename method finalizePHPickerImage: and document it (#947)
- Rename to `processPHPickerImage:` since it does rotating, scaling and cropping and prepare the metadata
- Document the method and code
2026-01-30 17:49:52 +01:00
Manuel BeckandGitHub d731cb9ad3 fix(ios): don't copy temporary video file on main thread and cleanup (#942)
- A user commented that`window.resolveLocalFileSystemURL` will fail when using the uri result for picking a video with PHPicker: https://github.com/apache/cordova-plugin-camera/issues/935#issuecomment-3742776758. The temporary video file provided by PHPickerViewController gets deleted when the completion handler exits. The copying of the video file was wrongly done on the main thread, rather than on the completion handler background thread.
- Report error to webview, if the video file could not successful copied to the temp directory

* Code refactoring and documentation

- Renamed `createTmpVideo` to `copyFileToTemp`, since it has no special code for just video files
- Log errors, if something is wrong in `copyFileToTemp `
- Document property `hasPendingOperation`
- Remove `dispatch_async` for returning `CDVPluginResult`. Internally, `CDVCommandDelegate` has a queue of plugin messages to send and it ensures that those are always sent to the webview on the main thread.
- Only use `dispatch_async(dispatch_get_main_queue(), ...` for UI operations
- Some minor code formatting for calling `CDVPluginResult` initializer
- Removed method `urlTransformer` which was deprecated in cordova-ios 8 and has no use anymore
- Removed unused method `integerValueForKey`: This method is legacy and was nowhere used
- Resolve method `processPHPickerImage`. This extra method is not needed
- Replace `IsAtLeastiOSVersion` with `@available`, `IsAtLeastiOSVersion` is deprecated
- Remove `IsAtLeastiOSVersion(@"8.0")` check for [locationManager requestWhenInUseAuthorization]. This plugins supports minimum iOS 11.
- Documentation and small refactoring regarding gettting GPS location for capturing JPEGs
- Use modern code for working with dictionaries
- fix: deprecation of `requestImageDataForAsset:options:resultHandler:`, which was deprecated in iOS 13. Replaced with `requestImageDataAndOrientationForAsset:options:resultHandler:`, which was introduced in iOS 11.

* Some cleanup regarding temporary file handling

- Renamed `createTmpVideo`to `copyFileToTemp` and keep the method generic, since it has no special code for video files
- Renamed `tempFilePath` to `tempFilePathForExtension`, since it creates unique path only for a file extension
- Document `tempFilePathForExtension`
- Refactoring and documentation of method `cleanup:`
- Moved `cleanup`, `tempFilePath` and `copyFileToTemp` at one place, since they are related
- creating unique temporary files with milliseconds: This is more precise than just using seconds
2026-01-29 14:08:55 +01:00
Manuel BeckandGitHub 90ad137398 fix(ios)! remove iPadOS popover code (#941)
- On iPadOS it was possible to configure a popover for setting the position, width and arrow position of the popover.  The code used the deprecated `UIPopoverController`, which would have to be fixed. To keep the plugin also maintainable, this was removed.
- The popover could repositioned with a `CameraPopoverHandle` on a `window.onorientationchange`. This was removed also.
- Removed documentation for popover from `README.md`
2026-01-15 17:26:37 +01:00
Manuel BeckandGitHub dc682b2532 feat(ios): use PHPickerViewController for iOS 14+ (#937)
- 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
2026-01-13 08:33:59 +01:00
jcesarmobileandGitHub 0333d001c7 breaking: remove NATIVE_URI DestinationType (#637) 2020-08-07 14:38:05 +02:00
Andrew Grieve 2a0735d551 CB-8351 Unbreak build from previous commit 2015-01-27 10:19:46 -05:00
Shazron Abdullah 35c653d24d CB-7937 - Re-factor iOS Camera plugin so that it is testable (closes #52)
Signed-off-by: Shazron Abdullah <shazron@apache.org>
2015-01-09 15:39:29 -08:00
Shazron AbdullahandAnis Kadri ae22820046 CB-4003 - Add config option to not use location information in Camera plugin (and default to not use it) 2014-09-05 11:08:15 -07:00
Shazron Abdullah 42bf5d2983 CB-7180 - Update Camera plugin to support generic plugin webView UIView (which can be either a UIWebView or WKWebView) 2014-08-11 23:13:15 -07:00
Andrew Grieve 1650dce693 ios: Delete postImage (dead code) 2014-06-27 13:49:56 -04:00
Steven Gill 0b6342e56c updated plugin.xml, native src files 2013-05-23 14:51:18 -07:00
hermwong fc2c9bd082 add iOS classes to plugin 2013-05-21 12:10:15 -07:00