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

GitToTheHub pushed a commit to branch pr-ios-reset-pending-state-on-stop
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git

commit c013e4318b2d63aa20d3da8048eb85e500ed3e17
Author: Manuel Beck <[email protected]>
AuthorDate: Fri Jul 31 12:38:10 2026 +0200

    fix(ios): reset pending state after `stop` call
    
    - stop and release location updates during stop cleanup
    - reuse the same cleanup path whether a picker is presented or not
    - no files need to be cleaned up. These are intended to be removed via 
`cleanup` call.
---
 src/ios/CDVCamera.m | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index c94b5ae..7e72e81 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -99,6 +99,8 @@ static NSString* MIME_JPEG    = @"image/jpeg";
 // CDVViewController when a plugin has a pending operation.
 @property (readwrite, assign) BOOL hasPendingOperation;
 
+- (void)resetPendingState;
+
 @end
 
 @implementation CDVCamera
@@ -238,14 +240,14 @@ static NSString* MIME_JPEG    = @"image/jpeg";
     dispatch_async(dispatch_get_main_queue(), ^{
         UIViewController* presentedViewController = 
self.viewController.presentedViewController;
         if (presentedViewController == nil) {
+            [self resetPendingState];
             CDVPluginResult* result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK];
             [self.commandDelegate sendPluginResult:result 
callbackId:command.callbackId];
             return;
         }
 
         [presentedViewController dismissViewControllerAnimated:YES 
completion:^{
-            self.hasPendingOperation = NO;
-            self.cdvUIImagePickerController = nil;
+            [self resetPendingState];
 
             CDVPluginResult* result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK];
             [self.commandDelegate sendPluginResult:result 
callbackId:command.callbackId];
@@ -253,6 +255,16 @@ static NSString* MIME_JPEG    = @"image/jpeg";
     });
 }
 
+- (void)resetPendingState
+{
+    [self.locationManager stopUpdatingLocation];
+    self.locationManager = nil;
+    self.tempImageDataForLocationManager = nil;
+    self.metadata = nil;
+    self.hasPendingOperation = NO;
+    self.cdvUIImagePickerController = nil;
+}
+
 - (void)sendNoPermissionResult:(NSString*)callbackId
 {
     CDVPluginResult* result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"has no access to 
camera"];   // error callback expects string ATM


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

Reply via email to