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

GitToTheHub pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d87f93  ios: rename variables `cameraPicker` to 
`cdvUIImagePickerController` (#950)
0d87f93 is described below

commit 0d87f93a2e06c62db6ee604384473dd7ac5ab883
Author: Manuel Beck <[email protected]>
AuthorDate: Mon Apr 20 18:18:10 2026 +0200

    ios: rename variables `cameraPicker` to `cdvUIImagePickerController` (#950)
    
    * 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`
    
    * fox(ios): Don't use `weak` in variable name
    
    - Rename `weakCDVUIImagePickerController` to `cdvUIImagePickerController`
    - It doesn't matter if it's a weak reference or not, it works like any 
other variable. The only reason `weakSelf` is a convention is because you need 
to explicitly create a variable to hold the weak reference.
---
 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 152905f..5795937 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -933,7 +933,7 @@ static NSString* MIME_JPEG    = @"image/jpeg";
 
 - (void)imagePickerController:(UIImagePickerController*)picker 
didFinishPickingMediaWithInfo:(NSDictionary*)info
 {
-    __weak CDVUIImagePickerController* cameraPicker = 
(CDVUIImagePickerController*)picker;
+    __weak CDVUIImagePickerController* cdvUIImagePickerController = 
(CDVUIImagePickerController*)picker;
     __weak CDVCamera* weakSelf = self;
 
     dispatch_block_t invoke = ^(void) {
@@ -943,9 +943,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:cdvUIImagePickerController.pictureOptions 
info:info completion:^(CDVPluginResult* res) {
                 if (![self usesGeolocation] || picker.sourceType != 
UIImagePickerControllerSourceTypeCamera) {
-                    [weakSelf.commandDelegate sendPluginResult:res 
callbackId:cameraPicker.callbackId];
+                    [weakSelf.commandDelegate sendPluginResult:res 
callbackId:cdvUIImagePickerController.callbackId];
                     weakSelf.hasPendingOperation = NO;
                     weakSelf.cdvUIImagePickerController = nil;
                 }
@@ -954,13 +954,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:cdvUIImagePickerController.callbackId];
             weakSelf.hasPendingOperation = NO;
             weakSelf.cdvUIImagePickerController = nil;
         }
     };
 
-    [[cameraPicker presentingViewController] dismissViewControllerAnimated:YES 
completion:invoke];
+    [[cdvUIImagePickerController presentingViewController] 
dismissViewControllerAnimated:YES completion:invoke];
 }
 
 // older api calls newer didFinishPickingMediaWithInfo
@@ -975,7 +975,7 @@ static NSString* MIME_JPEG    = @"image/jpeg";
 
 - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker
 {
-    __weak CDVUIImagePickerController* cameraPicker = 
(CDVUIImagePickerController*)picker;
+    __weak CDVUIImagePickerController* cdvUIImagePickerController = 
(CDVUIImagePickerController*)picker;
     __weak CDVCamera* weakSelf = self;
 
     dispatch_block_t invoke = ^ (void) {
@@ -987,13 +987,13 @@ static NSString* MIME_JPEG    = @"image/jpeg";
         }
 
 
-        [weakSelf.commandDelegate sendPluginResult:result 
callbackId:cameraPicker.callbackId];
+        [weakSelf.commandDelegate sendPluginResult:result 
callbackId:cdvUIImagePickerController.callbackId];
 
         weakSelf.hasPendingOperation = NO;
         weakSelf.cdvUIImagePickerController = nil;
     };
 
-    [[cameraPicker presentingViewController] dismissViewControllerAnimated:YES 
completion:invoke];
+    [[cdvUIImagePickerController presentingViewController] 
dismissViewControllerAnimated:YES completion:invoke];
 }
 
 #pragma mark CLLocationManager
@@ -1198,24 +1198,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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to