react-native-capture-studio 0.1.0
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/LICENSE +20 -0
- package/README.md +86 -0
- package/android/build.gradle +139 -0
- package/android/generated/java/com/capturestudio/NativeCaptureStudioSpec.java +48 -0
- package/android/generated/jni/CMakeLists.txt +31 -0
- package/android/generated/jni/RNCaptureStudioSpec-generated.cpp +44 -0
- package/android/generated/jni/RNCaptureStudioSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNCaptureStudioSpec/RNCaptureStudioSpecJSI.h +56 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +13 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/capturestudio/CaptureStudioModule.kt +177 -0
- package/android/src/main/java/com/capturestudio/CaptureStudioPackage.kt +33 -0
- package/android/src/main/java/com/capturestudio/data/CameraRepository.kt +43 -0
- package/android/src/main/java/com/capturestudio/data/processing/ImageProcessingWorker.kt +126 -0
- package/android/src/main/java/com/capturestudio/data/processing/ImageProcessor.kt +244 -0
- package/android/src/main/java/com/capturestudio/domain/CaptureOptions.kt +0 -0
- package/android/src/main/java/com/capturestudio/domain/model/ImageProcessingItem.kt +18 -0
- package/android/src/main/java/com/capturestudio/domain/model/ProcessingResult.kt +14 -0
- package/android/src/main/java/com/capturestudio/ui/camera/CameraActivity.kt +55 -0
- package/android/src/main/java/com/capturestudio/ui/camera/CameraUiState.kt +7 -0
- package/android/src/main/java/com/capturestudio/ui/camera/CameraViewModel.kt +34 -0
- package/android/src/main/java/com/capturestudio/ui/camera/CameraViewModelFactory.kt +17 -0
- package/android/src/main/res/layout/activity_camera.xml +10 -0
- package/ios/CaptureStudio.h +7 -0
- package/ios/CaptureStudio.mm +186 -0
- package/ios/ImageProcessor.h +22 -0
- package/ios/ImageProcessor.mm +383 -0
- package/ios/generated/Package.swift +59 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.mm +40 -0
- package/ios/generated/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.h +16 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.mm +51 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.mm +30 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
- package/ios/generated/ReactCodegen/RNCaptureStudioSpec/RNCaptureStudioSpec-generated.mm +53 -0
- package/ios/generated/ReactCodegen/RNCaptureStudioSpec/RNCaptureStudioSpec.h +70 -0
- package/ios/generated/ReactCodegen/RNCaptureStudioSpecJSI.h +56 -0
- package/ios/generated/ReactCodegen/ReactCodegen.podspec +110 -0
- package/lib/commonjs/NativeCaptureStudio.js +9 -0
- package/lib/commonjs/NativeCaptureStudio.js.map +1 -0
- package/lib/commonjs/index.js +20 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeCaptureStudio.js +5 -0
- package/lib/module/NativeCaptureStudio.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeCaptureStudio.d.ts +9 -0
- package/lib/typescript/commonjs/src/NativeCaptureStudio.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +19 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeCaptureStudio.d.ts +9 -0
- package/lib/typescript/module/src/NativeCaptureStudio.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +19 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +202 -0
- package/react-native-capture-studio.podspec +48 -0
- package/react-native.config.js +12 -0
- package/src/NativeCaptureStudio.ts +11 -0
- package/src/index.tsx +30 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
openCaptureStudio(options: Object): Promise<Object>;
|
|
4
|
+
processImages(images: Object[]): Promise<string>;
|
|
5
|
+
fetchProcessingResult(operationId: string): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: Spec;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=NativeCaptureStudio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeCaptureStudio.d.ts","sourceRoot":"","sources":["../../../../src/NativeCaptureStudio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D;;AAED,wBAAuE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CaptureOptions = {
|
|
2
|
+
multiple?: boolean;
|
|
3
|
+
maxCount?: number;
|
|
4
|
+
edit?: boolean;
|
|
5
|
+
compress?: {
|
|
6
|
+
quality?: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type ImageProcessingItem = {
|
|
10
|
+
localPath: string;
|
|
11
|
+
timeStamp: string;
|
|
12
|
+
isForOnlyWatermark?: boolean;
|
|
13
|
+
compressJpegImage?: boolean;
|
|
14
|
+
replaceOriginal?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function openCaptureStudio(options?: CaptureOptions): Promise<any>;
|
|
17
|
+
export declare function processImages(images: ImageProcessingItem[]): Promise<string>;
|
|
18
|
+
export declare function fetchProcessingResult(operationId: string): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAE5E;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5E;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
openCaptureStudio(options: Object): Promise<Object>;
|
|
4
|
+
processImages(images: Object[]): Promise<string>;
|
|
5
|
+
fetchProcessingResult(operationId: string): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: Spec;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=NativeCaptureStudio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeCaptureStudio.d.ts","sourceRoot":"","sources":["../../../../src/NativeCaptureStudio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D;;AAED,wBAAuE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CaptureOptions = {
|
|
2
|
+
multiple?: boolean;
|
|
3
|
+
maxCount?: number;
|
|
4
|
+
edit?: boolean;
|
|
5
|
+
compress?: {
|
|
6
|
+
quality?: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type ImageProcessingItem = {
|
|
10
|
+
localPath: string;
|
|
11
|
+
timeStamp: string;
|
|
12
|
+
isForOnlyWatermark?: boolean;
|
|
13
|
+
compressJpegImage?: boolean;
|
|
14
|
+
replaceOriginal?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function openCaptureStudio(options?: CaptureOptions): Promise<any>;
|
|
17
|
+
export declare function processImages(images: ImageProcessingItem[]): Promise<string>;
|
|
18
|
+
export declare function fetchProcessingResult(operationId: string): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAE5E;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5E;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E"}
|
package/package.json
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-capture-studio",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Cross-platform native image capture, editing, and compression studio for React Native",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"react-native.config.js",
|
|
28
|
+
"!ios/build",
|
|
29
|
+
"!android/build",
|
|
30
|
+
"!android/gradle",
|
|
31
|
+
"!android/gradlew",
|
|
32
|
+
"!android/gradlew.bat",
|
|
33
|
+
"!android/local.properties",
|
|
34
|
+
"!**/__tests__",
|
|
35
|
+
"!**/__fixtures__",
|
|
36
|
+
"!**/__mocks__",
|
|
37
|
+
"!**/.*"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"example": "yarn workspace react-native-capture-studio-example",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"typecheck": "tsc",
|
|
43
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
44
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
45
|
+
"prepare": "bob build",
|
|
46
|
+
"release": "release-it"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react-native",
|
|
50
|
+
"ios",
|
|
51
|
+
"android"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/gandhi120/react-native-capture-studio.git"
|
|
56
|
+
},
|
|
57
|
+
"author": "varun-gandhi-digiqc <varungandhi120@gmail.com> (https://github.com/gandhi120)",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/gandhi120/react-native-capture-studio/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/gandhi120/react-native-capture-studio#readme",
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
68
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
69
|
+
"@react-native-community/cli": "20.0.0",
|
|
70
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
71
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
72
|
+
"@types/jest": "^29.5.5",
|
|
73
|
+
"@types/react": "^18.2.44",
|
|
74
|
+
"commitlint": "^17.0.2",
|
|
75
|
+
"del-cli": "^5.1.0",
|
|
76
|
+
"eslint": "^8.51.0",
|
|
77
|
+
"eslint-config-prettier": "^9.0.0",
|
|
78
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"prettier": "^3.0.3",
|
|
81
|
+
"react": "19.2.0",
|
|
82
|
+
"react-native": "0.83.1",
|
|
83
|
+
"react-native-builder-bob": "^0.32.0",
|
|
84
|
+
"release-it": "^17.10.0",
|
|
85
|
+
"turbo": "^1.10.7",
|
|
86
|
+
"typescript": "^5.2.2"
|
|
87
|
+
},
|
|
88
|
+
"resolutions": {
|
|
89
|
+
"@types/react": "^18.2.44"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*"
|
|
94
|
+
},
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"example"
|
|
97
|
+
],
|
|
98
|
+
"packageManager": "yarn@3.6.1",
|
|
99
|
+
"jest": {
|
|
100
|
+
"preset": "react-native",
|
|
101
|
+
"modulePathIgnorePatterns": [
|
|
102
|
+
"<rootDir>/example/node_modules",
|
|
103
|
+
"<rootDir>/lib/"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"commitlint": {
|
|
107
|
+
"extends": [
|
|
108
|
+
"@commitlint/config-conventional"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"release-it": {
|
|
112
|
+
"git": {
|
|
113
|
+
"commitMessage": "chore: release ${version}",
|
|
114
|
+
"tagName": "v${version}"
|
|
115
|
+
},
|
|
116
|
+
"npm": {
|
|
117
|
+
"publish": true
|
|
118
|
+
},
|
|
119
|
+
"github": {
|
|
120
|
+
"release": true
|
|
121
|
+
},
|
|
122
|
+
"plugins": {
|
|
123
|
+
"@release-it/conventional-changelog": {
|
|
124
|
+
"preset": "angular"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"eslintConfig": {
|
|
129
|
+
"root": true,
|
|
130
|
+
"extends": [
|
|
131
|
+
"@react-native",
|
|
132
|
+
"prettier"
|
|
133
|
+
],
|
|
134
|
+
"rules": {
|
|
135
|
+
"react/react-in-jsx-scope": "off",
|
|
136
|
+
"prettier/prettier": [
|
|
137
|
+
"error",
|
|
138
|
+
{
|
|
139
|
+
"quoteProps": "consistent",
|
|
140
|
+
"singleQuote": true,
|
|
141
|
+
"tabWidth": 2,
|
|
142
|
+
"trailingComma": "es5",
|
|
143
|
+
"useTabs": false
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"eslintIgnore": [
|
|
149
|
+
"node_modules/",
|
|
150
|
+
"lib/"
|
|
151
|
+
],
|
|
152
|
+
"prettier": {
|
|
153
|
+
"quoteProps": "consistent",
|
|
154
|
+
"singleQuote": true,
|
|
155
|
+
"tabWidth": 2,
|
|
156
|
+
"trailingComma": "es5",
|
|
157
|
+
"useTabs": false
|
|
158
|
+
},
|
|
159
|
+
"react-native-builder-bob": {
|
|
160
|
+
"source": "src",
|
|
161
|
+
"output": "lib",
|
|
162
|
+
"targets": [
|
|
163
|
+
[
|
|
164
|
+
"commonjs",
|
|
165
|
+
{
|
|
166
|
+
"esm": true
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
"module",
|
|
171
|
+
{
|
|
172
|
+
"esm": true
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"typescript",
|
|
177
|
+
{
|
|
178
|
+
"project": "tsconfig.build.json",
|
|
179
|
+
"esm": true
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"codegenConfig": {
|
|
185
|
+
"name": "RNCaptureStudioSpec",
|
|
186
|
+
"type": "modules",
|
|
187
|
+
"jsSrcsDir": "src",
|
|
188
|
+
"outputDir": {
|
|
189
|
+
"ios": "ios/generated",
|
|
190
|
+
"android": "android/generated"
|
|
191
|
+
},
|
|
192
|
+
"android": {
|
|
193
|
+
"javaPackageName": "com.capturestudio"
|
|
194
|
+
},
|
|
195
|
+
"includesGeneratedCode": true
|
|
196
|
+
},
|
|
197
|
+
"create-react-native-library": {
|
|
198
|
+
"type": "turbo-module",
|
|
199
|
+
"languages": "kotlin-objc",
|
|
200
|
+
"version": "0.46.0"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-capture-studio"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/gandhi120/react-native-capture-studio.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
# Include main source files and the generated spec files
|
|
18
|
+
s.source_files = [
|
|
19
|
+
"ios/*.{h,m,mm,cpp}",
|
|
20
|
+
"ios/generated/ReactCodegen/RNCaptureStudioSpec/*.{h,mm}"
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Frameworks required for image processing
|
|
24
|
+
s.frameworks = "CoreGraphics", "ImageIO", "CoreImage", "UIKit", "UniformTypeIdentifiers"
|
|
25
|
+
|
|
26
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
27
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
28
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
29
|
+
install_modules_dependencies(s)
|
|
30
|
+
else
|
|
31
|
+
s.dependency "React-Core"
|
|
32
|
+
|
|
33
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
34
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
35
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
36
|
+
s.pod_target_xcconfig = {
|
|
37
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
38
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
39
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
40
|
+
}
|
|
41
|
+
s.dependency "React-Codegen"
|
|
42
|
+
s.dependency "RCT-Folly"
|
|
43
|
+
s.dependency "RCTRequired"
|
|
44
|
+
s.dependency "RCTTypeSafety"
|
|
45
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
openCaptureStudio(options: Object): Promise<Object>;
|
|
6
|
+
// Image processing methods
|
|
7
|
+
processImages(images: Object[]): Promise<string>;
|
|
8
|
+
fetchProcessingResult(operationId: string): Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('CaptureStudio');
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import CaptureStudio from './NativeCaptureStudio';
|
|
2
|
+
|
|
3
|
+
export type CaptureOptions = {
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
maxCount?: number;
|
|
6
|
+
edit?: boolean;
|
|
7
|
+
compress?: {
|
|
8
|
+
quality?: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ImageProcessingItem = {
|
|
13
|
+
localPath: string;
|
|
14
|
+
timeStamp: string;
|
|
15
|
+
isForOnlyWatermark?: boolean;
|
|
16
|
+
compressJpegImage?: boolean;
|
|
17
|
+
replaceOriginal?: boolean; // true = override original, false = create new file (default: true)
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function openCaptureStudio(options: CaptureOptions = {}): Promise<any> {
|
|
21
|
+
return CaptureStudio.openCaptureStudio(options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function processImages(images: ImageProcessingItem[]): Promise<string> {
|
|
25
|
+
return CaptureStudio.processImages(images);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function fetchProcessingResult(operationId: string): Promise<string> {
|
|
29
|
+
return CaptureStudio.fetchProcessingResult(operationId);
|
|
30
|
+
}
|