react-native-okaycam 2.0.3 → 2.0.5
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 +99 -95
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/build.gradle +16 -12
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/innov8tif/{RNOkayCam → rnokaycam}/RNOkayCamModule.java +16 -24
- package/android/src/main/java/com/innov8tif/{RNOkayCam → rnokaycam}/RNOkayCamPackage.java +2 -3
- package/index.ts +2 -0
- package/package.json +5 -9
- package/react-native-okaycam.podspec +1 -1
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.9/gc.properties +0 -0
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# react-native-okaycam
|
|
2
2
|
|
|
3
3
|
## Requirements
|
|
4
|
+
|
|
4
5
|
### Android
|
|
6
|
+
|
|
5
7
|
- minSdkVersion >= 21
|
|
6
8
|
|
|
7
9
|
### iOS
|
|
8
|
-
- iOS 9+
|
|
9
|
-
- Swift 5
|
|
10
10
|
|
|
11
|
+
- iOS 15+
|
|
12
|
+
- Swift 5
|
|
11
13
|
|
|
12
14
|
## Getting started
|
|
13
15
|
|
|
@@ -19,36 +21,41 @@
|
|
|
19
21
|
2. Add the following code to Podfile
|
|
20
22
|
|
|
21
23
|
```
|
|
22
|
-
platform :ios, '
|
|
24
|
+
platform :ios, '15.0'
|
|
23
25
|
use_frameworks!
|
|
24
26
|
|
|
25
27
|
post_install do |installer|
|
|
26
28
|
installer.pods_project.targets.each do |target|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if target.name == "CryptoSwift"
|
|
30
|
+
puts "Enable module stability for CryptoSwift"
|
|
31
|
+
target.build_configurations.each do |config|
|
|
32
|
+
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
if (target.name&.eql?('FBReactNativeSpec'))
|
|
36
|
+
target.build_phases.each do |build_phase|
|
|
37
|
+
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
|
|
38
|
+
target.build_phases.move(build_phase, 0)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
target.build_configurations.each do |config|
|
|
43
|
+
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
|
|
44
|
+
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
|
|
45
|
+
end
|
|
33
46
|
end
|
|
34
47
|
end
|
|
35
48
|
```
|
|
36
|
-
|
|
49
|
+
|
|
50
|
+
3. Run command `pod install`
|
|
37
51
|
|
|
38
52
|
4. Add camera permission
|
|
39
53
|
|
|
40
54
|
#### Android Issue
|
|
41
55
|
|
|
42
|
-
|
|
56
|
+
Duplicate class org.hamcrest.xxx
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
-keep class org.pytorch.** { *; }
|
|
46
|
-
-keep class com.facebook.jni.** { *; }
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Duplicate class org.hamcrest.xxx**
|
|
50
|
-
|
|
51
|
-
If you encouter the errors above, you may exclude junit module in the `android/app/build.gradle`
|
|
58
|
+
If you encouter the errors above, you may exclude junit module.
|
|
52
59
|
|
|
53
60
|
```
|
|
54
61
|
configurations { compile.exclude group: "junit", module: "junit" }
|
|
@@ -56,15 +63,16 @@ configurations { compile.exclude group: "junit", module: "junit" }
|
|
|
56
63
|
|
|
57
64
|
#### iOS Issue
|
|
58
65
|
|
|
59
|
-
> Undefined symbol: __swift_FORCE_LOAD_
|
|
66
|
+
> Undefined symbol: \__swift_FORCE_LOAD_$\_swiftUniformTypeIdentifiers
|
|
60
67
|
|
|
61
|
-
> Undefined symbol: __swift_FORCE_LOAD_
|
|
68
|
+
> Undefined symbol: \__swift_FORCE_LOAD_$\_swiftCoreMIDI
|
|
62
69
|
|
|
63
70
|
If you encouter the errors above, you may create a new swift file called **Void.swift** without adding **bridging header**.
|
|
64
71
|
|
|
65
72
|
<img src="images/image1.png">
|
|
66
73
|
|
|
67
74
|
## License
|
|
75
|
+
|
|
68
76
|
Apply licenses for Android and iOS SDKs
|
|
69
77
|
|
|
70
78
|
```
|
|
@@ -75,50 +83,47 @@ const license = Platform.select({
|
|
|
75
83
|
```
|
|
76
84
|
|
|
77
85
|
## OkayCam Document
|
|
78
|
-
### Configuration
|
|
79
|
-
|
|
80
|
-
-| Property name | Description |Default value
|
|
81
|
-
|--|--|--|--|
|
|
82
|
-
|-|torchBtnEnabled|to show torch button. If set to true, it will only be shown if onFlash from captureConfig is set to false.|false|
|
|
83
|
-
|-|crop|crop the frame area|false|
|
|
84
|
-
|-|width|width to resize the image|original width|
|
|
85
|
-
|-|imageQuality|quality of image|1.0 (range from 0.0 to 1.0)|
|
|
86
|
-
|frame|size|size of the frame (width and height)|90% of screen width and height is scaled proportionally according to card ratio|
|
|
87
|
-
|frame|color|color of the frame|#ffffff|
|
|
88
|
-
|frame|content|content of the frame (able to display svg file within the frame for guidance|null|
|
|
89
|
-
|-|showOverlay|transparent black overlay|true|
|
|
90
|
-
|topLabel|text|text of the top label|""(empty string)|
|
|
91
|
-
|topLabel|color|color of the top label|#ffffff|
|
|
92
|
-
|topLabel|size|text size of the top label|20|
|
|
93
|
-
|bottomLabel|text|text of the bottom label|""(empty string)|
|
|
94
|
-
|bottomLabel|color|color of the bottom label|#ffffff|
|
|
95
|
-
|bottomLabel|size|text size of the bottom label|20|
|
|
96
|
-
|timer|backgroundColor|background of the count down timer|#ffa500|
|
|
97
|
-
|timer|textColor|text color of the count down timer|#ffffff|
|
|
98
|
-
|confirmBtnConfig|backgroundColor|background color of the confirm button|#ffa500|
|
|
99
|
-
|confirmBtnConfig|contentColor|content color of the confirm button|#ffffff|
|
|
100
|
-
|retakeBtnConfig|backgroundColor|background color of the retake button|#ffa500|
|
|
101
|
-
|retakeBtnConfig|contentColor|content color of the retake button|#ffffff|
|
|
102
|
-
|captureConfig|first|config for the first capture|delay:0s,onFlash:false,outputPath: null|
|
|
103
|
-
|captureConfig|second|config for the second capture|delay:5s,onFlash:true,outputPath: null|
|
|
104
|
-
|<sup>**New**</sup>captureConfig|first|config for the first capture|delay:0s,onFlash:false,outputPath:null,onImageQuality:false|
|
|
105
|
-
|<sup>**New**</sup>captureConfig|second|config for the second capture|delay:5s,onFlash:true,outputPath:null,onImageQuality:false|
|
|
106
|
-
|-|captureBtnColor|color of the capture button|#ffffff|
|
|
107
|
-
|-|firstPhotoConfig|config for the first capture|delay:0s,onFlash:false,outputPath: null|
|
|
108
|
-
|-|secondPhotoConfig|config for the second capture|delay:5s,onFlash:false,outputPath: null|
|
|
109
|
-
|preview |title|title on preview screen|""(empty string)|
|
|
110
|
-
|preview |refImg|ref image on preview screen|null|
|
|
111
|
-
|preview |instruction1|instruction on preview screen|""(empty string)|
|
|
112
|
-
|preview|instruction2|instruction on preview screen|""(empty string)|
|
|
113
|
-
|preview |instruction3|instruction on preview screen|""(empty string)|
|
|
114
|
-
|preview |backgroundColor|background color of preview screen|null|
|
|
115
|
-
|instruction <sup>**New**</sup> |title|Instruction's title on camera caputre screen|""(empty string)|
|
|
116
|
-
|instruction <sup>**New**</sup> |refImage1|Instruction's reference image 1|null|
|
|
117
|
-
|instruction <sup>**New**</sup> |refImage2|Instruction's reference image 2|null|
|
|
118
86
|
|
|
87
|
+
### Configuration
|
|
119
88
|
|
|
89
|
+
| - | Property name | Description | Default value |
|
|
90
|
+
| ------------------------------ | ---------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
91
|
+
| - | torchBtnEnabled | to show torch button. If set to true, it will only be shown if onFlash from captureConfig is set to false. | false |
|
|
92
|
+
| - | crop | crop the frame area | false |
|
|
93
|
+
| - | width | width to resize the image | original width |
|
|
94
|
+
| - | imageQuality | quality of image | 1.0 (range from 0.0 to 1.0) |
|
|
95
|
+
| frame | size | size of the frame (width and height) | 90% of screen width and height is scaled proportionally according to card ratio |
|
|
96
|
+
| frame | color | color of the frame | #ffffff |
|
|
97
|
+
| frame | content | content of the frame (able to display svg file within the frame for guidance | null |
|
|
98
|
+
| - | showOverlay | transparent black overlay | true |
|
|
99
|
+
| topLabel | text | text of the top label | ""(empty string) |
|
|
100
|
+
| topLabel | color | color of the top label | #ffffff |
|
|
101
|
+
| topLabel | size | text size of the top label | 20 |
|
|
102
|
+
| bottomLabel | text | text of the bottom label | ""(empty string) |
|
|
103
|
+
| bottomLabel | color | color of the bottom label | #ffffff |
|
|
104
|
+
| bottomLabel | size | text size of the bottom label | 20 |
|
|
105
|
+
| timer | backgroundColor | background of the count down timer | #ffa500 |
|
|
106
|
+
| timer | textColor | text color of the count down timer | #ffffff |
|
|
107
|
+
| confirmBtnConfig | backgroundColor | background color of the confirm button | #ffa500 |
|
|
108
|
+
| confirmBtnConfig | contentColor | content color of the confirm button | #ffffff |
|
|
109
|
+
| retakeBtnConfig | backgroundColor | background color of the retake button | #ffa500 |
|
|
110
|
+
| retakeBtnConfig | contentColor | content color of the retake button | #ffffff |
|
|
111
|
+
| - | captureBtnColor | color of the capture button | #ffffff |
|
|
112
|
+
| - | firstPhotoConfig | config for the first capture | delay:0s,onFlash:false,outputPath: null |
|
|
113
|
+
| - | secondPhotoConfig | config for the second capture | null |
|
|
114
|
+
| preview | title | title on preview screen | ""(empty string) |
|
|
115
|
+
| preview | refImg | ref image on preview screen | null |
|
|
116
|
+
| preview | instruction1 | instruction on preview screen | ""(empty string) |
|
|
117
|
+
| preview | instruction2 | instruction on preview screen | ""(empty string) |
|
|
118
|
+
| preview | instruction3 | instruction on preview screen | ""(empty string) |
|
|
119
|
+
| preview | backgroundColor | background color of preview screen | null |
|
|
120
|
+
| instruction <sup>**New**</sup> | title | Instruction's title on camera caputre screen | ""(empty string) |
|
|
121
|
+
| instruction <sup>**New**</sup> | refImage1 | Instruction's reference image 1 | null |
|
|
122
|
+
| instruction <sup>**New**</sup> | refImage2 | Instruction's reference image 2 | null |
|
|
123
|
+
| - | showPreviewInstruction | Show or hide preview instruction for captured photos | false |
|
|
120
124
|
|
|
121
125
|
## Usage
|
|
126
|
+
|
|
122
127
|
```
|
|
123
128
|
import { captureDocument } from "react-native-okaycam"
|
|
124
129
|
|
|
@@ -190,6 +195,7 @@ captureDocument(
|
|
|
190
195
|
img: require('./images/ref.png'),
|
|
191
196
|
},
|
|
192
197
|
},
|
|
198
|
+
showPreviewInstruction: false,
|
|
193
199
|
}
|
|
194
200
|
)
|
|
195
201
|
.then(result => {
|
|
@@ -200,39 +206,36 @@ captureDocument(
|
|
|
200
206
|
})
|
|
201
207
|
```
|
|
202
208
|
|
|
203
|
-
> **_NOTE:_** <br/>
|
|
204
|
-
Supported image format : JPG | PNG | SVG <br/>
|
|
205
|
-
Preffered size : less than 500KB
|
|
206
|
-
|
|
207
209
|
### Result
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|fullDocumentImage4|Original Image if it exist|
|
|
210
|
+
|
|
211
|
+
| Result | Description |
|
|
212
|
+
| ------------------ | -------------------------------------------------------------------------------- |
|
|
213
|
+
| fullDocumentImage | Result of firstPhotoConfig |
|
|
214
|
+
| fullDocumentImage2 | Result of secondPhotoConfig. Will only return if secondPhotoConfig is configured |
|
|
214
215
|
|
|
215
216
|
## OkayCam Selfie
|
|
217
|
+
|
|
216
218
|
### Configuration
|
|
217
219
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|topLabel|text|text of the top label|Please align your face within the frame|
|
|
223
|
-
|topLabel|color|color of the top label
|
|
224
|
-
|topLabel|size|text size of the top label|24|
|
|
225
|
-
|
|
226
|
-
|switchBtnConfig|color|color of the switch button
|
|
227
|
-
|switchBtnConfig|show|show or hide the camera switch button|true|
|
|
228
|
-
|confirmBtnConfig|backgroundColor|background color of the confirm button
|
|
229
|
-
|confirmBtnConfig|contentColor|content color of the confirm button
|
|
230
|
-
|retakeBtnConfig|backgroundColor|background color of the retake button
|
|
231
|
-
|retakeBtnConfig|contentColor|content color of the retake button
|
|
232
|
-
|
|
233
|
-
|
|
220
|
+
| - | Property name | Description | Default value |
|
|
221
|
+
| ---------------- | ------------------- | ----------------------------------------------------- | --------------------------------------- |
|
|
222
|
+
| | width | width to resize the image | null |
|
|
223
|
+
| - | imageQuality | quality of image | 1.0 (range from 0.0 to 1.0) |
|
|
224
|
+
| topLabel | text | text of the top label | Please align your face within the frame |
|
|
225
|
+
| topLabel | color | color of the top label | #FFFFFF |
|
|
226
|
+
| topLabel | size | text size of the top label | 24 |
|
|
227
|
+
| - | bottomFrameColor | color of the bottom frame | #EB6709 |
|
|
228
|
+
| switchBtnConfig | color | color of the switch button | #FFFFFF |
|
|
229
|
+
| switchBtnConfig | show | show or hide the camera switch button | true |
|
|
230
|
+
| confirmBtnConfig | backgroundColor | background color of the confirm button | #ffa500 |
|
|
231
|
+
| confirmBtnConfig | contentColor | content color of the confirm button | #ffffff |
|
|
232
|
+
| retakeBtnConfig | backgroundColor | background color of the retake button | #ffa500 |
|
|
233
|
+
| retakeBtnConfig | contentColor | content color of the retake button | #ffffff |
|
|
234
|
+
| - | captureBtnColor | color of the capture button | #FFFFFF |
|
|
235
|
+
| - | defaultCameraFacing | initial camera facing when the selfie cam is launched | CameraFacing.FRONT |
|
|
234
236
|
|
|
235
237
|
## Usage
|
|
238
|
+
|
|
236
239
|
```
|
|
237
240
|
import { captureSelfie } from "react-native-okaycam"
|
|
238
241
|
|
|
@@ -272,14 +275,15 @@ captureSelfie(
|
|
|
272
275
|
```
|
|
273
276
|
|
|
274
277
|
### Result
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
|
278
|
+
|
|
279
|
+
| Result | Description |
|
|
280
|
+
| ----------- | --------------------- |
|
|
281
|
+
| selfieImage | Captured selfie image |
|
|
278
282
|
|
|
279
283
|
## Error Codes
|
|
280
284
|
|
|
281
|
-
| Error
|
|
282
|
-
|
|
|
283
|
-
| invalid license
|
|
284
|
-
| camera permission denied
|
|
285
|
-
| cancel
|
|
285
|
+
| Error | Description |
|
|
286
|
+
| ------------------------ | ------------------------------------------------------------------------ |
|
|
287
|
+
| invalid license | The license is invalid |
|
|
288
|
+
| camera permission denied | The use did not grant the permission to access camera in order to do OCR |
|
|
289
|
+
| cancel | The user canceled during the scanning process |
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
2
|
-
gradle.version=6.
|
|
1
|
+
#Thu Jun 12 12:42:16 BDT 2025
|
|
2
|
+
gradle.version=6.8
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
ext.kotlin_version = '1.
|
|
2
|
+
ext.kotlin_version = '1.9.10'
|
|
3
3
|
repositories {
|
|
4
4
|
google()
|
|
5
5
|
jcenter()
|
|
@@ -7,18 +7,22 @@ buildscript {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
dependencies {
|
|
10
|
-
classpath
|
|
10
|
+
classpath("com.android.tools.build:gradle:8.5.0")
|
|
11
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
apply plugin: 'com.android.library'
|
|
16
|
+
apply plugin: 'com.facebook.react'
|
|
17
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
15
18
|
|
|
16
19
|
android {
|
|
17
|
-
|
|
20
|
+
namespace "com.innov8tif.rnokaycam"
|
|
21
|
+
compileSdkVersion 34
|
|
18
22
|
|
|
19
23
|
defaultConfig {
|
|
20
24
|
minSdkVersion 21
|
|
21
|
-
targetSdkVersion
|
|
25
|
+
targetSdkVersion 34
|
|
22
26
|
versionCode 1
|
|
23
27
|
versionName "1.0"
|
|
24
28
|
}
|
|
@@ -26,25 +30,25 @@ android {
|
|
|
26
30
|
abortOnError false
|
|
27
31
|
}
|
|
28
32
|
compileOptions {
|
|
29
|
-
sourceCompatibility JavaVersion.
|
|
30
|
-
targetCompatibility JavaVersion.
|
|
33
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
34
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
repositories {
|
|
35
39
|
google()
|
|
36
40
|
mavenCentral()
|
|
41
|
+
maven { url 'https://www.jitpack.io' }
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
dependencies {
|
|
40
|
-
implementation
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
implementation('com.innov8tif.okaycam:OkayCam:2.0.2@aar') {
|
|
45
|
+
implementation "com.facebook.react:react-android"
|
|
46
|
+
implementation('com.innov8tif.okaycam:OkayCam:2.0.8@aar') {
|
|
44
47
|
transitive = true
|
|
48
|
+
exclude group: "junit", module: "junit"
|
|
49
|
+
exclude group: "org.hamcrest", module: "hamcrest-core"
|
|
45
50
|
}
|
|
46
51
|
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
|
47
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib
|
|
52
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
48
53
|
implementation 'com.caverock:androidsvg-aar:1.4'
|
|
49
54
|
}
|
|
50
|
-
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
package com.innov8tif.RNOkayCam;
|
|
1
|
+
package com.innov8tif.rnokaycam;
|
|
3
2
|
|
|
4
3
|
import android.app.AlertDialog;
|
|
5
4
|
import android.content.DialogInterface;
|
|
@@ -80,11 +79,10 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
80
79
|
ReadableMap preview = userConfig.getMap("preview");
|
|
81
80
|
ReadableMap instruction = userConfig.getMap("instruction");
|
|
82
81
|
|
|
83
|
-
|
|
84
82
|
OkayCamConfig okayCamConfig = OkayCamConfig.init(this.getCurrentActivity());
|
|
85
83
|
|
|
86
84
|
okayCamConfig.setShowOverlay(userConfig.getBoolean("showOverlay"));
|
|
87
|
-
|
|
85
|
+
okayCamConfig.setShowPreviewInstruction(userConfig.getBoolean("showPreviewInstruction"));
|
|
88
86
|
okayCamConfig.setTorchBtnEnabled(userConfig.getBoolean("torchBtnEnabled"));
|
|
89
87
|
okayCamConfig.setCrop(userConfig.getBoolean("crop"));
|
|
90
88
|
|
|
@@ -99,6 +97,7 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
99
97
|
Color.parseColor(topLabel.getString("color")),
|
|
100
98
|
topLabel.getInt("size")
|
|
101
99
|
));
|
|
100
|
+
|
|
102
101
|
okayCamConfig.setBottomLabel(new OkayCamLabelConfig(
|
|
103
102
|
bottomLabel.getString("text"),
|
|
104
103
|
Color.parseColor(bottomLabel.getString("color")),
|
|
@@ -125,21 +124,20 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
125
124
|
));
|
|
126
125
|
|
|
127
126
|
okayCamConfig.setCaptureConfig(new CaptureConfigPair(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
firstPhoto != null ? new OkayCamCaptureConfig(
|
|
128
|
+
firstPhoto.getInt("delay"),
|
|
129
|
+
firstPhoto.getBoolean("onFlash"),
|
|
130
|
+
firstPhoto.getString("outputPath"),
|
|
131
|
+
firstPhoto.hasKey("onImageQuality") ? firstPhoto.getBoolean("onImageQuality") : false
|
|
132
|
+
) : null,
|
|
133
|
+
secondPhoto != null ? new OkayCamCaptureConfig(
|
|
134
|
+
secondPhoto.getInt("delay"),
|
|
135
|
+
secondPhoto.getBoolean("onFlash"),
|
|
136
|
+
secondPhoto.getString("outputPath"),
|
|
137
|
+
secondPhoto.hasKey("onImageQuality") ? secondPhoto.getBoolean("onImageQuality") : false
|
|
138
|
+
) : null
|
|
140
139
|
));
|
|
141
140
|
|
|
142
|
-
|
|
143
141
|
okayCamConfig.setPreview(getPreviewConfig(preview, frameConfig));
|
|
144
142
|
okayCamConfig.setInstruction(getInstructionConfig(instruction, frameConfig));
|
|
145
143
|
|
|
@@ -148,7 +146,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
148
146
|
if (success) {
|
|
149
147
|
JSONObject results = new JSONObject();
|
|
150
148
|
try {
|
|
151
|
-
|
|
152
149
|
results.put("fullDocumentImage", convertImgToBase64(base64, images.get(0)));
|
|
153
150
|
|
|
154
151
|
if (images.size() > 1) {
|
|
@@ -165,7 +162,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
165
162
|
|
|
166
163
|
promise.resolve(results.toString());
|
|
167
164
|
} catch (JSONException e) {
|
|
168
|
-
// TODO Auto-generated catch block
|
|
169
165
|
e.printStackTrace();
|
|
170
166
|
promise.reject(this.getError(e.getMessage()));
|
|
171
167
|
}
|
|
@@ -203,8 +199,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
203
199
|
}
|
|
204
200
|
|
|
205
201
|
private String getImageFromJs(String refImage, OkayCamFrameConfig frameConfig, String fileName) {
|
|
206
|
-
|
|
207
|
-
|
|
208
202
|
Size size = frameConfig.getSize();
|
|
209
203
|
int frameWidth = size.getWidth();
|
|
210
204
|
int frameHeight = size.getHeight();
|
|
@@ -212,7 +206,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
212
206
|
Bitmap contentBmp = null;
|
|
213
207
|
try {
|
|
214
208
|
if (refImage != null) {
|
|
215
|
-
|
|
216
209
|
// In debug, the image is returned as URL
|
|
217
210
|
if (BuildConfig.DEBUG) {
|
|
218
211
|
InputStream inputStream = new URL(refImage).openStream();
|
|
@@ -290,7 +283,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
290
283
|
Bitmap contentBmp = null;
|
|
291
284
|
try {
|
|
292
285
|
if (refImage != null) {
|
|
293
|
-
|
|
294
286
|
// In debug, the image is returned as URL
|
|
295
287
|
if (BuildConfig.DEBUG) {
|
|
296
288
|
InputStream inputStream = new URL(refImage).openStream();
|
|
@@ -561,4 +553,4 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
|
|
|
561
553
|
}
|
|
562
554
|
return new Exception(errorString);
|
|
563
555
|
}
|
|
564
|
-
}
|
|
556
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
package com.innov8tif.RNOkayCam;
|
|
1
|
+
package com.innov8tif.rnokaycam;
|
|
3
2
|
|
|
4
3
|
import java.util.Arrays;
|
|
5
4
|
import java.util.Collections;
|
|
@@ -26,4 +25,4 @@ public class RNOkayCamPackage implements ReactPackage {
|
|
|
26
25
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
27
26
|
return Collections.emptyList();
|
|
28
27
|
}
|
|
29
|
-
}
|
|
28
|
+
}
|
package/index.ts
CHANGED
|
@@ -180,6 +180,7 @@ export const captureDocument = (
|
|
|
180
180
|
imageQuality = 1.0,
|
|
181
181
|
preview = defaultPreview,
|
|
182
182
|
instruction = defaultInstruction,
|
|
183
|
+
showPreviewInstruction = false,
|
|
183
184
|
}
|
|
184
185
|
) => {
|
|
185
186
|
if (topLabel.text == undefined) {
|
|
@@ -321,6 +322,7 @@ export const captureDocument = (
|
|
|
321
322
|
imageQuality: imageQuality,
|
|
322
323
|
preview: resultedPreview,
|
|
323
324
|
instruction: formatInstruction(instruction),
|
|
325
|
+
showPreviewInstruction: showPreviewInstruction,
|
|
324
326
|
},
|
|
325
327
|
})
|
|
326
328
|
.then((result) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-okaycam",
|
|
3
3
|
"title": "React Native OkayCam",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.5",
|
|
5
5
|
"description": "React-Native version of OkayCam",
|
|
6
6
|
"main": "index.ts",
|
|
7
7
|
"files": [
|
|
@@ -30,15 +30,11 @@
|
|
|
30
30
|
"licenseFilename": "LICENSE",
|
|
31
31
|
"readmeFilename": "README.md",
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"react": "^
|
|
34
|
-
"react-native": ">=0.
|
|
33
|
+
"react": "^18.0.2",
|
|
34
|
+
"react-native": ">=0.75.2 <1.0.x"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"react": "^
|
|
38
|
-
"react-native": "^0.
|
|
39
|
-
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@types/react-native": "^0.71.3",
|
|
42
|
-
"react-native-codegen": "^0.0.7"
|
|
37
|
+
"react": "^18.0.2",
|
|
38
|
+
"react-native": "^0.75.2"
|
|
43
39
|
}
|
|
44
40
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|