react-native-okaycam 1.1.30 → 1.2.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/README.md +1 -5
- package/android/build.gradle +15 -14
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/innov8tif/RNOkayCam/RNOkayCamModule.java +2 -4
- package/index.ts +9 -159
- package/ios/RNOkayCam.swift +2 -2
- package/package.json +2 -6
- package/react-native-okaycam.podspec +1 -1
package/README.md
CHANGED
|
@@ -92,13 +92,9 @@ const license = Platform.select({
|
|
|
92
92
|
|confirmBtnConfig|contentColor|content color of the confirm button|#ffffff|
|
|
93
93
|
|retakeBtnConfig|backgroundColor|background color of the retake button|#ffa500|
|
|
94
94
|
|retakeBtnConfig|contentColor|content color of the retake button|#ffffff|
|
|
95
|
-
|captureConfig|first|config for the first capture|delay:0s,onFlash:false,outputPath: null|
|
|
96
|
-
|captureConfig|second|config for the second capture|delay:5s,onFlash:true,outputPath: null|
|
|
97
|
-
|<sup>**New**</sup>captureConfig|first|config for the first capture|delay:0s,onFlash:false,outputPath:null,onImageQuality:false|
|
|
98
|
-
|<sup>**New**</sup>captureConfig|second|config for the second capture|delay:5s,onFlash:true,outputPath:null,onImageQuality:false|
|
|
99
95
|
|-|captureBtnColor|color of the capture button|#ffffff|
|
|
100
96
|
|-|firstPhotoConfig|config for the first capture|delay:0s,onFlash:false,outputPath: null|
|
|
101
|
-
|-|secondPhotoConfig|config for the second capture|
|
|
97
|
+
|-|secondPhotoConfig|config for the second capture|null|
|
|
102
98
|
|preview |title|title on preview screen|""(empty string)|
|
|
103
99
|
|preview |refImg|ref image on preview screen|null|
|
|
104
100
|
|preview |instruction1|instruction on preview screen|""(empty string)|
|
package/android/build.gradle
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
buildscript {
|
|
2
2
|
ext.kotlin_version = '1.4.21'
|
|
3
3
|
repositories {
|
|
4
|
-
google()
|
|
5
4
|
jcenter()
|
|
6
5
|
mavenCentral()
|
|
6
|
+
google()
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
dependencies {
|
|
@@ -14,11 +14,12 @@ buildscript {
|
|
|
14
14
|
apply plugin: 'com.android.library'
|
|
15
15
|
|
|
16
16
|
android {
|
|
17
|
-
compileSdkVersion
|
|
17
|
+
compileSdkVersion 23
|
|
18
|
+
buildToolsVersion "23.0.3"
|
|
18
19
|
|
|
19
20
|
defaultConfig {
|
|
20
21
|
minSdkVersion 21
|
|
21
|
-
targetSdkVersion
|
|
22
|
+
targetSdkVersion 22
|
|
22
23
|
versionCode 1
|
|
23
24
|
versionName "1.0"
|
|
24
25
|
}
|
|
@@ -29,28 +30,28 @@ android {
|
|
|
29
30
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
30
31
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
repositories {
|
|
35
|
+
// jcenter({ url "https://dl.bintray.com/innov8tifekyc/OkayCam/" })
|
|
36
|
+
// maven { url "https://s01.oss.sonatype.org/content/repositories/cominnov8tif-1064" }
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
repositories {
|
|
35
|
-
google()
|
|
36
43
|
mavenCentral()
|
|
44
|
+
google()
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
dependencies {
|
|
40
|
-
implementation
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
implementation ('org.pytorch:pytorch_android_torchvision_lite:1.5.0'){
|
|
44
|
-
exclude module: 'fbjni-java-only'
|
|
45
|
-
}
|
|
46
|
-
implementation('com.facebook.react:react-native:+'){
|
|
47
|
-
exclude module: 'fbjni-java-only'
|
|
48
|
-
}
|
|
49
|
-
implementation('com.innov8tif.okaycam:OkayCam:1.1.17@aar') {
|
|
48
|
+
implementation 'com.facebook.react:react-native:+'
|
|
49
|
+
implementation('com.innov8tif.okaycam:OkayCam:1.2.2@aar') {
|
|
50
50
|
transitive = true
|
|
51
51
|
}
|
|
52
52
|
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
|
53
53
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
54
|
+
|
|
54
55
|
implementation 'com.caverock:androidsvg-aar:1.4'
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
6
|
|
|
@@ -128,14 +128,12 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
128
128
|
firstPhoto != null ? new OkayCamCaptureConfig(
|
|
129
129
|
firstPhoto.getInt("delay"),
|
|
130
130
|
firstPhoto.getBoolean("onFlash"),
|
|
131
|
-
firstPhoto.getString("outputPath")
|
|
132
|
-
firstPhoto.getBoolean("onImageQuality")
|
|
131
|
+
firstPhoto.getString("outputPath")
|
|
133
132
|
) : null,
|
|
134
133
|
secondPhoto != null ? new OkayCamCaptureConfig(
|
|
135
134
|
secondPhoto.getInt("delay"),
|
|
136
135
|
secondPhoto.getBoolean("onFlash"),
|
|
137
|
-
secondPhoto.getString("outputPath")
|
|
138
|
-
secondPhoto.getBoolean("onImageQuality")
|
|
136
|
+
secondPhoto.getString("outputPath")
|
|
139
137
|
) : null
|
|
140
138
|
));
|
|
141
139
|
|
package/index.ts
CHANGED
|
@@ -61,7 +61,6 @@ interface CaptureConfig {
|
|
|
61
61
|
delay: number;
|
|
62
62
|
onFlash: Boolean;
|
|
63
63
|
outputPath?: string;
|
|
64
|
-
onImageQuality: Boolean;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
interface SwitchBtnConfig {
|
|
@@ -76,13 +75,6 @@ const defaultColor = "#ffffff";
|
|
|
76
75
|
const defaultColor2 = "#ffa500";
|
|
77
76
|
const imageResizedWidth = -1;
|
|
78
77
|
|
|
79
|
-
const imageResolvedAssetSource: ImageResolvedAssetSource = {
|
|
80
|
-
height: 0,
|
|
81
|
-
width: 0,
|
|
82
|
-
scale: 0,
|
|
83
|
-
uri: "",
|
|
84
|
-
};
|
|
85
|
-
|
|
86
78
|
const labelConfig: LabelConfig = {
|
|
87
79
|
text: "",
|
|
88
80
|
color: defaultColor,
|
|
@@ -95,7 +87,7 @@ const defaultFrame: Frame = {
|
|
|
95
87
|
height: (screenWidth * 54) / 85,
|
|
96
88
|
},
|
|
97
89
|
color: defaultColor,
|
|
98
|
-
content:
|
|
90
|
+
content: null,
|
|
99
91
|
};
|
|
100
92
|
|
|
101
93
|
const timerConfig: TimerConfig = {
|
|
@@ -113,37 +105,31 @@ const defaultCaptureBtnColor: string = defaultColor;
|
|
|
113
105
|
const captureConfigFirst: CaptureConfig = {
|
|
114
106
|
delay: 0,
|
|
115
107
|
onFlash: false,
|
|
116
|
-
outputPath:
|
|
117
|
-
onImageQuality: false,
|
|
108
|
+
outputPath: null,
|
|
118
109
|
};
|
|
119
110
|
|
|
120
|
-
const defaultPreview: OkayCamPreviewConfig = null
|
|
111
|
+
const defaultPreview: OkayCamPreviewConfig = null;
|
|
121
112
|
|
|
122
|
-
const defaultInstruction: OkayCamInstruction = null
|
|
113
|
+
const defaultInstruction: OkayCamInstruction = null;
|
|
123
114
|
|
|
124
|
-
const captureConfigSecond: CaptureConfig =
|
|
125
|
-
delay: 5,
|
|
126
|
-
onFlash: false,
|
|
127
|
-
outputPath: "",
|
|
128
|
-
onImageQuality: false,
|
|
129
|
-
};
|
|
115
|
+
const captureConfigSecond: CaptureConfig = null;
|
|
130
116
|
|
|
131
117
|
const formatImage = (img: ImageResolvedAssetSource) => {
|
|
132
|
-
|
|
133
|
-
return img;
|
|
118
|
+
return Image.resolveAssetSource(img).uri;
|
|
119
|
+
// return img;
|
|
134
120
|
};
|
|
135
121
|
|
|
136
122
|
const formatInstruction = (
|
|
137
123
|
instruction: OkayCamInstruction
|
|
138
124
|
): OkayCamInstruction => {
|
|
139
|
-
if (instruction == null) return null
|
|
125
|
+
if (instruction == null) return null;
|
|
140
126
|
|
|
141
127
|
const ref1: OkaycamInstructionRefImg = {
|
|
142
128
|
...instruction.refImage1,
|
|
143
129
|
img: formatImage(instruction.refImage1.img),
|
|
144
130
|
};
|
|
145
131
|
|
|
146
|
-
let ref2: OkaycamInstructionRefImg = null
|
|
132
|
+
let ref2: OkaycamInstructionRefImg = null;
|
|
147
133
|
if (instruction.refImage2 != null) {
|
|
148
134
|
ref2 = {
|
|
149
135
|
...instruction.refImage2,
|
|
@@ -182,98 +168,10 @@ export const captureDocument = (
|
|
|
182
168
|
instruction = defaultInstruction,
|
|
183
169
|
}
|
|
184
170
|
) => {
|
|
185
|
-
if (topLabel.text == undefined) {
|
|
186
|
-
topLabel.text = labelConfig.text;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (topLabel.color == undefined) {
|
|
190
|
-
topLabel.color = labelConfig.color;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (topLabel.size == undefined) {
|
|
194
|
-
topLabel.size = labelConfig.size;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (bottomLabel.text == undefined) {
|
|
198
|
-
bottomLabel.text = labelConfig.text;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (bottomLabel.color == undefined) {
|
|
202
|
-
bottomLabel.color = labelConfig.color;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (bottomLabel.size == undefined) {
|
|
206
|
-
bottomLabel.size = labelConfig.size;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
171
|
if (frame.size == undefined) {
|
|
210
172
|
frame.size = defaultFrame.size;
|
|
211
173
|
}
|
|
212
174
|
|
|
213
|
-
if (timer.backgroundColor == undefined || timer.textColor == undefined) {
|
|
214
|
-
timer.backgroundColor = timerConfig.backgroundColor;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (timer.textColor == undefined) {
|
|
218
|
-
timer.textColor = timerConfig.textColor;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (confirmBtnConfig.backgroundColor == undefined) {
|
|
222
|
-
confirmBtnConfig.backgroundColor = okayCamBtnConfig.backgroundColor;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (confirmBtnConfig.contentColor == undefined) {
|
|
226
|
-
confirmBtnConfig.contentColor = okayCamBtnConfig.contentColor;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (retakeBtnConfig.backgroundColor == undefined) {
|
|
230
|
-
retakeBtnConfig.backgroundColor = okayCamBtnConfig.backgroundColor;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (retakeBtnConfig.contentColor == undefined) {
|
|
234
|
-
retakeBtnConfig.contentColor = okayCamBtnConfig.contentColor;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (captureBtnColor == undefined) {
|
|
238
|
-
captureBtnColor = defaultCaptureBtnColor;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (firstPhotoConfig.delay == undefined) {
|
|
242
|
-
firstPhotoConfig.delay = captureConfigFirst.delay;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (firstPhotoConfig.onFlash == undefined) {
|
|
246
|
-
firstPhotoConfig.onFlash = captureConfigFirst.onFlash;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (firstPhotoConfig.onImageQuality == undefined) {
|
|
250
|
-
firstPhotoConfig.onImageQuality = captureConfigFirst.onImageQuality;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (firstPhotoConfig.outputPath == undefined) {
|
|
254
|
-
firstPhotoConfig.outputPath = captureConfigFirst.outputPath;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (secondPhotoConfig.delay == undefined) {
|
|
258
|
-
secondPhotoConfig.delay = captureConfigSecond.delay;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (secondPhotoConfig.onFlash == undefined) {
|
|
262
|
-
secondPhotoConfig.onFlash = captureConfigSecond.onFlash;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (secondPhotoConfig.onImageQuality == undefined) {
|
|
266
|
-
secondPhotoConfig.onImageQuality = captureConfigSecond.onImageQuality;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (secondPhotoConfig.outputPath == undefined) {
|
|
270
|
-
secondPhotoConfig.outputPath = captureConfigSecond.outputPath;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (width == undefined) {
|
|
274
|
-
width = imageResizedWidth;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
175
|
const resultedPreview =
|
|
278
176
|
preview == null
|
|
279
177
|
? null
|
|
@@ -355,54 +253,6 @@ export const captureSelfie = (
|
|
|
355
253
|
imageQuality = 1.0,
|
|
356
254
|
}
|
|
357
255
|
) => {
|
|
358
|
-
if (topLabel.text == undefined) {
|
|
359
|
-
topLabel.text = labelConfig.text;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (topLabel.color == undefined) {
|
|
363
|
-
topLabel.color = labelConfig.color;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (topLabel.size == undefined) {
|
|
367
|
-
topLabel.size = labelConfig.size;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
if (switchBtnConfig.color == undefined) {
|
|
371
|
-
switchBtnConfig.color = defaultSwitchBtnConfig.color;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (switchBtnConfig.show == undefined) {
|
|
375
|
-
switchBtnConfig.show = defaultSwitchBtnConfig.show;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
if (confirmBtnConfig.backgroundColor == undefined) {
|
|
379
|
-
confirmBtnConfig.backgroundColor = okayCamBtnConfig.backgroundColor;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (confirmBtnConfig.contentColor == undefined) {
|
|
383
|
-
confirmBtnConfig.contentColor = okayCamBtnConfig.contentColor;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (retakeBtnConfig.backgroundColor == undefined) {
|
|
387
|
-
retakeBtnConfig.backgroundColor = okayCamBtnConfig.backgroundColor;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (retakeBtnConfig.contentColor == undefined) {
|
|
391
|
-
retakeBtnConfig.contentColor = okayCamBtnConfig.contentColor;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (defaultCameraFacing == undefined) {
|
|
395
|
-
defaultCameraFacing = cameraFacing;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if (captureBtnColor == undefined) {
|
|
399
|
-
captureBtnColor = defaultCaptureBtnColor;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (width == undefined) {
|
|
403
|
-
width = imageResizedWidth;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
256
|
return new Promise(function (resolve, reject) {
|
|
407
257
|
RNOkayCam.captureSelfie({
|
|
408
258
|
license: license,
|
package/ios/RNOkayCam.swift
CHANGED
|
@@ -106,12 +106,12 @@ class RNOkayCam: NSObject {
|
|
|
106
106
|
okayCamConfig.captureConfigPair = CaptureConfigPair(
|
|
107
107
|
firstPhoto: OkayCamCaptureConfig(
|
|
108
108
|
timeOut: firstPhoto.object(forKey: "delay") as! Int,
|
|
109
|
-
onFlash: firstPhoto.object(forKey: "onFlash") as! Bool,
|
|
109
|
+
onFlash: firstPhoto.object(forKey: "onFlash") as! Bool,
|
|
110
110
|
outputPath: (firstPhotoPath != nil) ? URL(string: (firstPhoto.object(forKey: "outputPath") as? String)!) : nil
|
|
111
111
|
),
|
|
112
112
|
secondPhoto: (secondPhoto != nil) ? OkayCamCaptureConfig(
|
|
113
113
|
timeOut: secondPhoto?.object(forKey: "delay") as? Int ?? 0,
|
|
114
|
-
onFlash: secondPhoto?.object(forKey: "onFlash") as? Bool ?? false,
|
|
114
|
+
onFlash: secondPhoto?.object(forKey: "onFlash") as? Bool ?? false,
|
|
115
115
|
outputPath: (secondPhotoPath != nil) ? URL(string: (secondPhoto?.object(forKey: "outputPath") as! String?)!) : nil
|
|
116
116
|
) : nil
|
|
117
117
|
)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-okaycam",
|
|
3
3
|
"title": "React Native OkayCam",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "React-Native version of OkayCam",
|
|
6
6
|
"main": "index.ts",
|
|
7
7
|
"files": [
|
|
@@ -35,10 +35,6 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"react": "^16.9.0",
|
|
38
|
-
"react-native": "^0.
|
|
39
|
-
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@types/react-native": "^0.71.3",
|
|
42
|
-
"react-native-codegen": "^0.0.7"
|
|
38
|
+
"react-native": "^0.61.5"
|
|
43
39
|
}
|
|
44
40
|
}
|