You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/01/30 18:28:43 UTC

(cordova-plugin-camera) branch pr-ios-rename-variables-cameraPicker-to-cdvUIImagePickerController created (now 6f77735)

This is an automated email from the ASF dual-hosted git repository.

manuelbeck pushed a change to branch pr-ios-rename-variables-cameraPicker-to-cdvUIImagePickerController
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git


      at 6f77735  ios: Rename variables `cameraPicker` to `cdvUIImagePickerController`

This branch includes the following new commits:

     new 6f77735  ios: Rename variables `cameraPicker` to `cdvUIImagePickerController`

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


(cordova-plugin-camera) 01/01: ios: Rename variables `cameraPicker` to `cdvUIImagePickerController`

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

manuelbeck pushed a commit to branch pr-ios-rename-variables-cameraPicker-to-cdvUIImagePickerController
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git

commit 6f77735f799762b26b01aa771ad09378f8b039c1
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Fri Jan 30 19:28:33 2026 +0100

    ios: Rename variables `cameraPicker` to `cdvUIImagePickerController`
    
    - Make clear, that `CDVUIImagePickerController` is used for these variables
    - When it's used as weak variable, it's renamed to `weakCDVUIImagePickerController`
---
 src/ios/CDVCamera.m | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index 0cdf306..fb31de7 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -938,7 +938,7 @@ static NSString* MIME_JPEG    = @"image/jpeg";
 
 - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
 {
-    __weak CDVUIImagePickerController* cameraPicker = (CDVUIImagePickerController*)picker;
+    __weak CDVUIImagePickerController* weakCDVUIImagePickerController = (CDVUIImagePickerController*)picker;
     __weak CDVCamera* weakSelf = self;
 
     dispatch_block_t invoke = ^(void) {
@@ -948,9 +948,9 @@ static NSString* MIME_JPEG    = @"image/jpeg";
         
         // Image selected
         if ([mediaType isEqualToString:(NSString*)kUTTypeImage]) {
-            [weakSelf resultForImage:cameraPicker.pictureOptions info:info completion:^(CDVPluginResult* res) {
+            [weakSelf resultForImage:weakCDVUIImagePickerController.pictureOptions info:info completion:^(CDVPluginResult* res) {
                 if (![self usesGeolocation] || picker.sourceType != UIImagePickerControllerSourceTypeCamera) {
-                    [weakSelf.commandDelegate sendPluginResult:res callbackId:cameraPicker.callbackId];
+                    [weakSelf.commandDelegate sendPluginResult:res callbackId:weakCDVUIImagePickerController.callbackId];
                     weakSelf.hasPendingOperation = NO;
                     weakSelf.cdvUIImagePickerController = nil;
                 }
@@ -959,13 +959,13 @@ static NSString* MIME_JPEG    = @"image/jpeg";
             // Video selected
         } else {
             result = [weakSelf resultForVideo:info];
-            [weakSelf.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId];
+            [weakSelf.commandDelegate sendPluginResult:result callbackId:weakCDVUIImagePickerController.callbackId];
             weakSelf.hasPendingOperation = NO;
             weakSelf.cdvUIImagePickerController = nil;
         }
     };
 
-    [[cameraPicker presentingViewController] dismissViewControllerAnimated:YES completion:invoke];
+    [[weakCDVUIImagePickerController presentingViewController] dismissViewControllerAnimated:YES completion:invoke];
 }
 
 // older api calls newer didFinishPickingMediaWithInfo
@@ -980,7 +980,7 @@ static NSString* MIME_JPEG    = @"image/jpeg";
 
 - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker
 {
-    __weak CDVUIImagePickerController* cameraPicker = (CDVUIImagePickerController*)picker;
+    __weak CDVUIImagePickerController* weakCDVUIImagePickerController = (CDVUIImagePickerController*)picker;
     __weak CDVCamera* weakSelf = self;
 
     dispatch_block_t invoke = ^ (void) {
@@ -992,13 +992,13 @@ static NSString* MIME_JPEG    = @"image/jpeg";
         }
 
 
-        [weakSelf.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId];
+        [weakSelf.commandDelegate sendPluginResult:result callbackId:weakCDVUIImagePickerController.callbackId];
 
         weakSelf.hasPendingOperation = NO;
         weakSelf.cdvUIImagePickerController = nil;
     };
 
-    [[cameraPicker presentingViewController] dismissViewControllerAnimated:YES completion:invoke];
+    [[weakCDVUIImagePickerController presentingViewController] dismissViewControllerAnimated:YES completion:invoke];
 }
 
 #pragma mark CLLocationManager
@@ -1203,24 +1203,24 @@ static NSString* MIME_JPEG    = @"image/jpeg";
 
 + (instancetype)createFromPictureOptions:(CDVPictureOptions*)pictureOptions
 {
-    CDVUIImagePickerController* cameraPicker = [[CDVUIImagePickerController alloc] init];
-    cameraPicker.pictureOptions = pictureOptions;
-    cameraPicker.sourceType = pictureOptions.sourceType;
-    cameraPicker.allowsEditing = pictureOptions.allowsEditing;
+    CDVUIImagePickerController* cdvUIImagePickerController = [[CDVUIImagePickerController alloc] init];
+    cdvUIImagePickerController.pictureOptions = pictureOptions;
+    cdvUIImagePickerController.sourceType = pictureOptions.sourceType;
+    cdvUIImagePickerController.allowsEditing = pictureOptions.allowsEditing;
 
-    if (cameraPicker.sourceType == UIImagePickerControllerSourceTypeCamera) {
+    if (cdvUIImagePickerController.sourceType == UIImagePickerControllerSourceTypeCamera) {
         // We only allow taking pictures (no video) in this API.
-        cameraPicker.mediaTypes = @[(NSString*)kUTTypeImage];
+        cdvUIImagePickerController.mediaTypes = @[(NSString*)kUTTypeImage];
         // We can only set the camera device if we're actually using the camera.
-        cameraPicker.cameraDevice = pictureOptions.cameraDirection;
+        cdvUIImagePickerController.cameraDevice = pictureOptions.cameraDirection;
     } else if (pictureOptions.mediaType == MediaTypeAll) {
-        cameraPicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:cameraPicker.sourceType];
+        cdvUIImagePickerController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:cdvUIImagePickerController.sourceType];
     } else {
         NSArray* mediaArray = @[(NSString*)(pictureOptions.mediaType == MediaTypeVideo ? kUTTypeMovie : kUTTypeImage)];
-        cameraPicker.mediaTypes = mediaArray;
+        cdvUIImagePickerController.mediaTypes = mediaArray;
     }
 
-    return cameraPicker;
+    return cdvUIImagePickerController;
 }
 
 @end


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org