capacitor-camera-multicapture 0.12.2
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.
- package/CameraMultiCapture.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +551 -0
- package/android/build.gradle +69 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/CameraConfig.java +45 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/CameraConfigMapper.java +98 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/CameraMultiCapture.java +10 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/CameraMultiCapturePlugin.java +1340 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/ExifWrapper.java +108 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/GenericUploadWorker.java +173 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/ImageUtils.java +215 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/PluginVersion.java +6 -0
- package/android/src/main/java/dev/hemang/cameramulticapture/ThumbnailGenerator.java +48 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/esm/controllers/camera-controller.d.ts +127 -0
- package/dist/esm/controllers/camera-controller.js +388 -0
- package/dist/esm/controllers/camera-controller.js.map +1 -0
- package/dist/esm/controllers/gallery-controller.d.ts +66 -0
- package/dist/esm/controllers/gallery-controller.js +333 -0
- package/dist/esm/controllers/gallery-controller.js.map +1 -0
- package/dist/esm/definitions.d.ts +372 -0
- package/dist/esm/definitions.js +6 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/overlay-manager.d.ts +124 -0
- package/dist/esm/overlay-manager.js +732 -0
- package/dist/esm/overlay-manager.js.map +1 -0
- package/dist/esm/overlay.d.ts +2 -0
- package/dist/esm/overlay.js +39 -0
- package/dist/esm/overlay.js.map +1 -0
- package/dist/esm/registration.d.ts +5 -0
- package/dist/esm/registration.js +8 -0
- package/dist/esm/registration.js.map +1 -0
- package/dist/esm/types/ui-types.d.ts +78 -0
- package/dist/esm/types/ui-types.js +2 -0
- package/dist/esm/types/ui-types.js.map +1 -0
- package/dist/esm/ui/capture-gesture-handler.d.ts +15 -0
- package/dist/esm/ui/capture-gesture-handler.js +87 -0
- package/dist/esm/ui/capture-gesture-handler.js.map +1 -0
- package/dist/esm/ui/default-styles.d.ts +27 -0
- package/dist/esm/ui/default-styles.js +134 -0
- package/dist/esm/ui/default-styles.js.map +1 -0
- package/dist/esm/ui/image-editor.d.ts +10 -0
- package/dist/esm/ui/image-editor.js +103 -0
- package/dist/esm/ui/image-editor.js.map +1 -0
- package/dist/esm/ui/layout-manager.d.ts +42 -0
- package/dist/esm/ui/layout-manager.js +199 -0
- package/dist/esm/ui/layout-manager.js.map +1 -0
- package/dist/esm/ui/media-viewer.d.ts +2 -0
- package/dist/esm/ui/media-viewer.js +267 -0
- package/dist/esm/ui/media-viewer.js.map +1 -0
- package/dist/esm/ui/pinch-zoom-handler.d.ts +37 -0
- package/dist/esm/ui/pinch-zoom-handler.js +118 -0
- package/dist/esm/ui/pinch-zoom-handler.js.map +1 -0
- package/dist/esm/ui/ui-factory.d.ts +39 -0
- package/dist/esm/ui/ui-factory.js +272 -0
- package/dist/esm/ui/ui-factory.js.map +1 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/esm/web.d.ts +69 -0
- package/dist/esm/web.js +122 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +6274 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +6276 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/CameraMultiCapturePlugin/CameraMultiCapture.swift +8 -0
- package/ios/Sources/CameraMultiCapturePlugin/CameraMultiCapturePlugin.swift +1551 -0
- package/ios/Sources/CameraMultiCapturePlugin/PluginVersion.swift +2 -0
- package/ios/Tests/CameraMultiCapturePluginTests/CameraMultiCapturePluginTests.swift +15 -0
- package/package.json +93 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package dev.hemang.cameramulticapture;
|
|
2
|
+
|
|
3
|
+
import android.util.Size;
|
|
4
|
+
import android.view.Surface;
|
|
5
|
+
import androidx.camera.core.CameraSelector;
|
|
6
|
+
import androidx.camera.core.ImageCapture;
|
|
7
|
+
import com.getcapacitor.JSObject;
|
|
8
|
+
import android.view.ViewGroup;
|
|
9
|
+
|
|
10
|
+
public class CameraConfig {
|
|
11
|
+
public int lensFacing;
|
|
12
|
+
public int captureMode;
|
|
13
|
+
public Size resolution;
|
|
14
|
+
public float zoomRatio;
|
|
15
|
+
public int jpegQuality;
|
|
16
|
+
public boolean autoFocus;
|
|
17
|
+
public int targetRotation;
|
|
18
|
+
public int previewWidth;
|
|
19
|
+
public int previewHeight;
|
|
20
|
+
public int previewX;
|
|
21
|
+
public int previewY;
|
|
22
|
+
public int flashMode;
|
|
23
|
+
public boolean enableSaving;
|
|
24
|
+
public String galleryAlbumName;
|
|
25
|
+
public int maxRecordingDurationSeconds;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
public CameraConfig() {
|
|
29
|
+
this.lensFacing = CameraSelector.LENS_FACING_BACK;
|
|
30
|
+
this.captureMode = ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY;
|
|
31
|
+
this.resolution = new Size(1280, 720);
|
|
32
|
+
this.zoomRatio = 1.0f;
|
|
33
|
+
this.jpegQuality = 85;
|
|
34
|
+
this.autoFocus = true;
|
|
35
|
+
this.targetRotation = Surface.ROTATION_0;
|
|
36
|
+
this.previewWidth = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
37
|
+
this.previewHeight = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
38
|
+
this.previewX = 0;
|
|
39
|
+
this.previewY = 0;
|
|
40
|
+
this.flashMode = ImageCapture.FLASH_MODE_OFF;
|
|
41
|
+
this.enableSaving = false;
|
|
42
|
+
this.galleryAlbumName = "Camera";
|
|
43
|
+
this.maxRecordingDurationSeconds = 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
package dev.hemang.cameramulticapture;
|
|
2
|
+
|
|
3
|
+
import android.util.Size;
|
|
4
|
+
import android.view.Surface;
|
|
5
|
+
import androidx.camera.core.CameraSelector;
|
|
6
|
+
import androidx.camera.core.ImageCapture;
|
|
7
|
+
import com.getcapacitor.JSObject;
|
|
8
|
+
import android.view.ViewGroup;
|
|
9
|
+
|
|
10
|
+
public class CameraConfigMapper {
|
|
11
|
+
public static CameraConfig fromJSObject(JSObject data) {
|
|
12
|
+
CameraConfig config = new CameraConfig();
|
|
13
|
+
|
|
14
|
+
String direction = data.getString("direction", "back");
|
|
15
|
+
config.lensFacing = "front".equals(direction)
|
|
16
|
+
? CameraSelector.LENS_FACING_FRONT
|
|
17
|
+
: CameraSelector.LENS_FACING_BACK;
|
|
18
|
+
|
|
19
|
+
String captureMode = data.getString("captureMode", "minimizeLatency");
|
|
20
|
+
config.captureMode = "maxQuality".equals(captureMode)
|
|
21
|
+
? ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY
|
|
22
|
+
: ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY;
|
|
23
|
+
|
|
24
|
+
JSObject resolution = data.getJSObject("resolution");
|
|
25
|
+
if (resolution != null) {
|
|
26
|
+
int width = resolution.getInteger("width", 1280);
|
|
27
|
+
int height = resolution.getInteger("height", 720);
|
|
28
|
+
config.resolution = new Size(width, height);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
config.zoomRatio = data.has("zoom") ? (float) data.getDouble("zoom") : 1.0f;
|
|
33
|
+
} catch (Exception e) {
|
|
34
|
+
config.zoomRatio = 1.0f;
|
|
35
|
+
}
|
|
36
|
+
config.jpegQuality = data.has("quality") ? data.getInteger("quality") : 85;
|
|
37
|
+
config.autoFocus = data.getBoolean("autoFocus", true);
|
|
38
|
+
|
|
39
|
+
// Handle flash mode
|
|
40
|
+
String flashMode = data.getString("flash", "off");
|
|
41
|
+
switch (flashMode) {
|
|
42
|
+
case "on":
|
|
43
|
+
config.flashMode = ImageCapture.FLASH_MODE_ON;
|
|
44
|
+
break;
|
|
45
|
+
case "auto":
|
|
46
|
+
config.flashMode = ImageCapture.FLASH_MODE_AUTO;
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
config.flashMode = ImageCapture.FLASH_MODE_OFF;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Handle rotation/orientation - use provided rotation or auto-detect from device
|
|
54
|
+
if (data.has("rotation")) {
|
|
55
|
+
int rotation = data.getInteger("rotation");
|
|
56
|
+
switch (rotation) {
|
|
57
|
+
case 90:
|
|
58
|
+
config.targetRotation = Surface.ROTATION_90;
|
|
59
|
+
break;
|
|
60
|
+
case 180:
|
|
61
|
+
config.targetRotation = Surface.ROTATION_180;
|
|
62
|
+
break;
|
|
63
|
+
case 270:
|
|
64
|
+
config.targetRotation = Surface.ROTATION_270;
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
config.targetRotation = Surface.ROTATION_0;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
// Auto-detect device orientation if no rotation provided
|
|
72
|
+
// This will be set in the plugin when we have access to the activity
|
|
73
|
+
config.targetRotation = Surface.ROTATION_0; // Will be updated in plugin
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
JSObject previewRect = data.getJSObject("previewRect");
|
|
77
|
+
if (previewRect != null) {
|
|
78
|
+
if (previewRect.has("width")) {
|
|
79
|
+
config.previewWidth = previewRect.getInteger("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
|
80
|
+
}
|
|
81
|
+
if (previewRect.has("height")) {
|
|
82
|
+
config.previewHeight = previewRect.getInteger("height", ViewGroup.LayoutParams.MATCH_PARENT);
|
|
83
|
+
}
|
|
84
|
+
if (previewRect.has("x")) {
|
|
85
|
+
config.previewX = previewRect.getInteger("x", 0);
|
|
86
|
+
}
|
|
87
|
+
if (previewRect.has("y")) {
|
|
88
|
+
config.previewY = previewRect.getInteger("y", 0);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
config.enableSaving = data.getBoolean("enableSaving", false);
|
|
93
|
+
config.galleryAlbumName = data.getString("galleryAlbumName", "Camera");
|
|
94
|
+
config.maxRecordingDurationSeconds = data.getInteger("maxRecordingDuration", 0);
|
|
95
|
+
|
|
96
|
+
return config;
|
|
97
|
+
}
|
|
98
|
+
}
|