GitToTheHub commented on code in PR #937:
URL: 
https://github.com/apache/cordova-plugin-camera/pull/937#discussion_r2603284990


##########
src/ios/CDVCamera.m:
##########
@@ -212,6 +226,15 @@ - (void)showCameraPicker:(NSString*)callbackId 
withOptions:(CDVPictureOptions *)
 {
     // Perform UI operations on the main thread
     dispatch_async(dispatch_get_main_queue(), ^{
+        // Use PHPickerViewController for photo library on iOS 14+
+        if (@available(iOS 14, *)) {
+            if (pictureOptions.sourceType == 
UIImagePickerControllerSourceTypePhotoLibrary) {
+                [self showPHPicker:callbackId withOptions:pictureOptions];
+                return;
+            }
+        }

Review Comment:
   I added a compile time check for iOS SDK 14



##########
src/ios/CDVCamera.h:
##########
@@ -104,12 +129,23 @@ typedef NSUInteger CDVMediaType;
 - (void)cleanup:(CDVInvokedUrlCommand*)command;
 - (void)repositionPopover:(CDVInvokedUrlCommand*)command;
 
+// UIImagePickerControllerDelegate methods
 - (void)imagePickerController:(UIImagePickerController*)picker 
didFinishPickingMediaWithInfo:(NSDictionary*)info;
 - (void)imagePickerController:(UIImagePickerController*)picker 
didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;
 - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker;
+
+// UINavigationControllerDelegate method
 - (void)navigationController:(UINavigationController *)navigationController 
willShowViewController:(UIViewController *)viewController 
animated:(BOOL)animated;
 
+// CLLocationManagerDelegate methods
 - (void)locationManager:(CLLocationManager*)manager 
didUpdateToLocation:(CLLocation*)newLocation 
fromLocation:(CLLocation*)oldLocation;
 - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError 
*)error;
 
+// PHPickerViewController specific methods (iOS 14+)
+- (void)showPHPicker:(NSString*)callbackId 
withOptions:(CDVPictureOptions*)pictureOptions API_AVAILABLE(ios(14));
+- (void)processPHPickerImage:(UIImage*)image 
assetIdentifier:(NSString*)assetIdentifier callbackId:(NSString*)callbackId 
options:(CDVPictureOptions*)options API_AVAILABLE(ios(14));
+- (void)finalizePHPickerImage:(UIImage*)image metadata:(NSDictionary*)metadata 
callbackId:(NSString*)callbackId options:(CDVPictureOptions*)options 
API_AVAILABLE(ios(14));
+// PHPickerViewControllerDelegate method
+- (void)picker:(PHPickerViewController *)picker 
didFinishPicking:(NSArray<PHPickerResult *> *)results API_AVAILABLE(ios(14));

Review Comment:
   I added a compile time check for iOS SDK 14



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to