capacitor-plugin-camera-forked 3.0.95 → 3.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -542,7 +542,7 @@ public class CameraPreviewPlugin extends Plugin {
542
542
 
543
543
  } catch (Exception e) {
544
544
  e.printStackTrace();
545
- call.reject(e.getMessage());
545
+ call.resolve();
546
546
  }
547
547
  }
548
548
  call.resolve();
@@ -550,22 +550,34 @@ public class CameraPreviewPlugin extends Plugin {
550
550
 
551
551
  @PluginMethod
552
552
  public void setFocus(PluginCall call) {
553
+
554
+ JSObject response = new JSObject();
553
555
  if (!call.hasOption("x") || !call.hasOption("y")) {
554
- call.reject("Invalid focus coordinates - x and y are required");
556
+ response.put("success", false);
557
+ call.resolve(response);
555
558
  return;
556
559
  }
557
560
 
558
561
  Float x = call.getFloat("x");
559
562
  Float y = call.getFloat("y");
560
563
 
564
+ // Check for null values
565
+ if (x == null || y == null) {
566
+ response.put("success", false);
567
+ call.resolve(response);
568
+ return;
569
+ }
570
+
561
571
  // Validate coordinate ranges (should be 0-1 for normalized coordinates)
562
572
  if (x < 0.0f || x > 1.0f || y < 0.0f || y > 1.0f) {
563
- call.reject("Focus coordinates must be normalized values between 0.0 and 1.0");
573
+ response.put("success", false);
574
+ call.resolve(response);
564
575
  return;
565
576
  }
566
577
 
567
578
  if (previewView == null || camera == null) {
568
- call.reject("Camera preview is not initialized");
579
+ response.put("success", false);
580
+ call.resolve(response);
569
581
  return;
570
582
  }
571
583
 
@@ -634,7 +646,9 @@ public class CameraPreviewPlugin extends Plugin {
634
646
 
635
647
  } catch (Exception e) {
636
648
  Log.e("Camera", "Error setting focus", e);
637
- call.reject("Error setting focus: " + e.getMessage());
649
+ response.put("success", false);
650
+ response.put("error", e.getMessage());
651
+ call.resolve(response);
638
652
  }
639
653
  }
640
654
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-camera-forked",
3
- "version": "3.0.95",
3
+ "version": "3.0.96",
4
4
  "description": "A capacitor camera plugin - A custom Capacitor camera plugin with additional features.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",