react-native-okaycam 2.0.3 → 3.0.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 CHANGED
@@ -1,17 +1,19 @@
1
1
  # react-native-okaycam
2
2
 
3
3
  ## Requirements
4
+
4
5
  ### Android
5
- - minSdkVersion >= 21
6
+
7
+ - minSdkVersion >= 30
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
 
14
- `$ react-native install react-native-okaycam`
16
+ `$ yarn add react-native-okaycam@3.x.x`
15
17
 
16
18
  ### iOS
17
19
 
@@ -19,36 +21,41 @@
19
21
  2. Add the following code to Podfile
20
22
 
21
23
  ```
22
- platform :ios, '11.0'
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
- if target.name == "CryptoSwift"
28
- puts "Enable module stability for CryptoSwift"
29
- target.build_configurations.each do |config|
30
- config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
31
- end
32
- end
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
- 3. Run command `Pod install`
49
+
50
+ 3. Run command `pod install`
37
51
 
38
52
  4. Add camera permission
39
53
 
40
54
  #### Android Issue
41
55
 
42
- **Add following rules for proguard in the `android/app/proguard-rules.pro`**
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_$_swiftUniformTypeIdentifiers
66
+ > Undefined symbol: \__swift_FORCE_LOAD_$\_swiftUniformTypeIdentifiers
60
67
 
61
- > Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreMIDI
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,48 @@ 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 |
124
+ | - | autoCapture <sup>**New**</sup> | Boolean to auto capture document | false |
120
125
 
121
126
  ## Usage
127
+
122
128
  ```
123
129
  import { captureDocument } from "react-native-okaycam"
124
130
 
@@ -190,6 +196,8 @@ captureDocument(
190
196
  img: require('./images/ref.png'),
191
197
  },
192
198
  },
199
+ showPreviewInstruction: false,
200
+ autoCapture: true
193
201
  }
194
202
  )
195
203
  .then(result => {
@@ -200,39 +208,36 @@ captureDocument(
200
208
  })
201
209
  ```
202
210
 
203
- > **_NOTE:_** <br/>
204
- Supported image format : JPG | PNG | SVG <br/>
205
- Preffered size : less than 500KB
206
-
207
211
  ### Result
208
- | Result | Description |
209
- |--|--|
210
- |fullDocumentImage|Result of firstPhotoConfig|
211
- |fullDocumentImage2|Result of secondPhotoConfig. Will only return if secondPhotoConfig is configured. if secondPhotoConfig is not configured, it will be original image of fullDocumentImage|
212
- |fullDocumentImage3|Original Image if it exist|
213
- |fullDocumentImage4|Original Image if it exist|
212
+
213
+ | Result | Description |
214
+ | ------------------ | -------------------------------------------------------------------------------- |
215
+ | fullDocumentImage | Result of firstPhotoConfig |
216
+ | fullDocumentImage2 | Result of secondPhotoConfig. Will only return if secondPhotoConfig is configured |
214
217
 
215
218
  ## OkayCam Selfie
219
+
216
220
  ### Configuration
217
221
 
218
- -| Property name | Description |Default value
219
- |--|--|--|--|
220
- ||width|width to resize the image|null|
221
- |-|imageQuality|quality of image|1.0 (range from 0.0 to 1.0)|
222
- |topLabel|text|text of the top label|Please align your face within the frame|
223
- |topLabel|color|color of the top label|#FFFFFF|
224
- |topLabel|size|text size of the top label|24|
225
- |-|bottomFrameColor|color of the bottom frame|#EB6709|
226
- |switchBtnConfig|color|color of the switch button|#FFFFFF|
227
- |switchBtnConfig|show|show or hide the camera switch button|true|
228
- |confirmBtnConfig|backgroundColor|background color of the confirm button|#ffa500|
229
- |confirmBtnConfig|contentColor|content color of the confirm button|#ffffff|
230
- |retakeBtnConfig|backgroundColor|background color of the retake button|#ffa500|
231
- |retakeBtnConfig|contentColor|content color of the retake button|#ffffff|
232
- |-|captureBtnColor|color of the capture button|#FFFFFF|
233
- |-|defaultCameraFacing|initial camera facing when the selfie cam is launched|CameraFacing.FRONT|
222
+ | - | Property name | Description | Default value |
223
+ | ---------------- | ------------------- | ----------------------------------------------------- | --------------------------------------- |
224
+ | | width | width to resize the image | null |
225
+ | - | imageQuality | quality of image | 1.0 (range from 0.0 to 1.0) |
226
+ | topLabel | text | text of the top label | Please align your face within the frame |
227
+ | topLabel | color | color of the top label | #FFFFFF |
228
+ | topLabel | size | text size of the top label | 24 |
229
+ | - | bottomFrameColor | color of the bottom frame | #EB6709 |
230
+ | switchBtnConfig | color | color of the switch button | #FFFFFF |
231
+ | switchBtnConfig | show | show or hide the camera switch button | true |
232
+ | confirmBtnConfig | backgroundColor | background color of the confirm button | #ffa500 |
233
+ | confirmBtnConfig | contentColor | content color of the confirm button | #ffffff |
234
+ | retakeBtnConfig | backgroundColor | background color of the retake button | #ffa500 |
235
+ | retakeBtnConfig | contentColor | content color of the retake button | #ffffff |
236
+ | - | captureBtnColor | color of the capture button | #FFFFFF |
237
+ | - | defaultCameraFacing | initial camera facing when the selfie cam is launched | CameraFacing.FRONT |
234
238
 
235
239
  ## Usage
240
+
236
241
  ```
237
242
  import { captureSelfie } from "react-native-okaycam"
238
243
 
@@ -272,14 +277,15 @@ captureSelfie(
272
277
  ```
273
278
 
274
279
  ### Result
275
- | Result | Description |
276
- |--|--|
277
- |selfieImage|Captured selfie image|
280
+
281
+ | Result | Description |
282
+ | ----------- | --------------------- |
283
+ | selfieImage | Captured selfie image |
278
284
 
279
285
  ## Error Codes
280
286
 
281
- | Error | Description |
282
- | ------------------------------------------- | ------------------------------------------------------------------------ |
283
- | invalid license | The license is invalid |
284
- | camera permission denied | The use did not grant the permission to access camera in order to do OCR |
285
- | cancel | The user canceled during the scanning process |
287
+ | Error | Description |
288
+ | ------------------------ | ------------------------------------------------------------------------ |
289
+ | invalid license | The license is invalid |
290
+ | camera permission denied | The use did not grant the permission to access camera in order to do OCR |
291
+ | cancel | The user canceled during the scanning process |
@@ -1,2 +1,2 @@
1
- #Fri Sep 29 11:21:20 BDT 2023
2
- gradle.version=6.9
1
+ #Thu Jun 12 12:42:16 BDT 2025
2
+ gradle.version=6.8
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.4.21'
2
+ ext.kotlin_version = '1.9.10'
3
3
  repositories {
4
4
  google()
5
5
  jcenter()
@@ -7,44 +7,49 @@ buildscript {
7
7
  }
8
8
 
9
9
  dependencies {
10
- classpath 'com.android.tools.build:gradle:4.0.1'
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
- compileSdkVersion 33
20
+ namespace "com.innov8tif.rnokaycam"
21
+ compileSdkVersion 34
18
22
 
19
23
  defaultConfig {
20
- minSdkVersion 21
21
- targetSdkVersion 33
24
+ minSdkVersion 30
25
+ targetSdkVersion 34
22
26
  versionCode 1
23
27
  versionName "1.0"
28
+ consumerProguardFiles("consumer-rules.pro")
24
29
  }
25
30
  lintOptions {
26
31
  abortOnError false
27
32
  }
28
33
  compileOptions {
29
- sourceCompatibility JavaVersion.VERSION_1_8
30
- targetCompatibility JavaVersion.VERSION_1_8
34
+ sourceCompatibility JavaVersion.VERSION_11
35
+ targetCompatibility JavaVersion.VERSION_11
31
36
  }
32
37
  }
33
38
 
34
39
  repositories {
35
40
  google()
36
41
  mavenCentral()
42
+ maven { url 'https://www.jitpack.io' }
37
43
  }
38
44
 
39
45
  dependencies {
40
- implementation('com.facebook.react:react-native:+'){
41
- exclude module: 'fbjni-java-only'
42
- }
43
- implementation('com.innov8tif.okaycam:OkayCam:2.0.2@aar') {
46
+ implementation "com.facebook.react:react-android"
47
+ implementation('com.innov8tif.okaycam:OkayCam:3.0.1@aar') {
44
48
  transitive = true
49
+ exclude group: "junit", module: "junit"
50
+ exclude group: "org.hamcrest", module: "hamcrest-core"
45
51
  }
46
52
  implementation 'com.googlecode.json-simple:json-simple:1.1.1'
47
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
53
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
48
54
  implementation 'com.caverock:androidsvg-aar:1.4'
49
- }
50
-
55
+ }
@@ -0,0 +1,132 @@
1
+ # This is a configuration file for ProGuard.
2
+ # http://proguard.sourceforge.net/index.html#manual/usage.html
3
+ #
4
+ # Starting with version 2.2 of the Android plugin for Gradle, this file is distributed together with
5
+ # the plugin and unpacked at build-time. The files in $ANDROID_HOME are no longer maintained and
6
+ # will be ignored by new version of the Android plugin for Gradle.
7
+
8
+ # Optimizations: If you don't want to optimize, use the proguard-android.txt configuration file
9
+ # instead of this one, which turns off the optimization flags.
10
+ # Adding optimization introduces certain risks, since for example not all optimizations performed by
11
+ # ProGuard works on all versions of Dalvik. The following flags turn off various optimizations
12
+ # known to have issues, but the list may not be complete or up to date. (The "arithmetic"
13
+ # optimization can be used if you are only targeting Android 2.0 or later.) Make sure you test
14
+ # thoroughly if you go this route.
15
+ -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
16
+ -optimizationpasses 5
17
+
18
+ -dontusemixedcaseclassnames
19
+ -dontskipnonpubliclibraryclasses
20
+ -verbose
21
+
22
+ # Preserve some attributes that may be required for reflection.
23
+ -keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
24
+
25
+ -keep public class com.google.vending.licensing.ILicensingService
26
+ -keep public class com.android.vending.licensing.ILicensingService
27
+ -keep public class com.google.android.vending.licensing.ILicensingService
28
+ -dontnote com.android.vending.licensing.ILicensingService
29
+ -dontnote com.google.vending.licensing.ILicensingService
30
+ -dontnote com.google.android.vending.licensing.ILicensingService
31
+
32
+ # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
33
+ -keepclasseswithmembernames,includedescriptorclasses class * {
34
+ native <methods>;
35
+ }
36
+
37
+ # Keep setters in Views so that animations can still work.
38
+ -keepclassmembers public class * extends android.view.View {
39
+ void set*(***);
40
+ *** get*();
41
+ }
42
+
43
+ # We want to keep methods in Activity that could be used in the XML attribute onClick.
44
+ -keepclassmembers class * extends android.app.Activity {
45
+ public void *(android.view.View);
46
+ }
47
+
48
+ # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
49
+ -keepclassmembers enum * {
50
+ public static **[] values();
51
+ public static ** valueOf(java.lang.String);
52
+ }
53
+
54
+ -keepclassmembers class * implements android.os.Parcelable {
55
+ public static final ** CREATOR;
56
+ }
57
+
58
+ # Preserve annotated Javascript interface methods.
59
+ -keepclassmembers class * {
60
+ @android.webkit.JavascriptInterface <methods>;
61
+ }
62
+
63
+ # The support libraries contains references to newer platform versions.
64
+ # Don't warn about those in case this app is linking against an older
65
+ # platform version. We know about them, and they are safe.
66
+ -dontnote android.support.**
67
+ -dontnote androidx.**
68
+ -dontwarn android.support.**
69
+ -dontwarn androidx.**
70
+
71
+ # This class is deprecated, but remains for backward compatibility.
72
+ -dontwarn android.util.FloatMath
73
+
74
+ # Understand the @Keep support annotation.
75
+ -keep class android.support.annotation.Keep
76
+ -keep class androidx.annotation.Keep
77
+
78
+ -keep @android.support.annotation.Keep class * {*;}
79
+ -keep @androidx.annotation.Keep class * {*;}
80
+
81
+ -keepclasseswithmembers class * {
82
+ @android.support.annotation.Keep <methods>;
83
+ }
84
+
85
+ -keepclasseswithmembers class * {
86
+ @androidx.annotation.Keep <methods>;
87
+ }
88
+
89
+ -keepclasseswithmembers class * {
90
+ @android.support.annotation.Keep <fields>;
91
+ }
92
+
93
+ -keepclasseswithmembers class * {
94
+ @androidx.annotation.Keep <fields>;
95
+ }
96
+
97
+ -keepclasseswithmembers class * {
98
+ @android.support.annotation.Keep <init>(...);
99
+ }
100
+
101
+ -keepclasseswithmembers class * {
102
+ @androidx.annotation.Keep <init>(...);
103
+ }
104
+
105
+ -keep class h5.** { *; }
106
+ -keep class p5.** { *; }
107
+ -keep class k5.** { *; }
108
+ -keep class n5.** { *; }
109
+ -keep class c6.** { *; }
110
+ -keep class x5.** { *; }
111
+
112
+ -keepnames class h5.**
113
+ -keepclassmembers class h5.** {
114
+ *;
115
+ }
116
+
117
+ -keep class com.google.mediapipe.proto.** { *; }
118
+ -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { *; }
119
+ -keep class com.google.common.flogger.** { *; }
120
+
121
+ # These classes are duplicated between android.jar and org.apache.http.legacy.jar.
122
+ -dontnote org.apache.http.**
123
+ -dontnote android.net.http.**
124
+
125
+ # These classes are duplicated between android.jar and core-lambda-stubs.jar.
126
+ -dontnote java.lang.invoke.**
127
+
128
+ # Don't warn about missing compile-only javax.lang.model.* classes
129
+ -dontwarn javax.lang.model.**
130
+ -dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
131
+ -dontwarn com.google.errorprone.annotations.CheckReturnValue
132
+ -dontwarn com.google.errorprone.annotations.MustBeClosed
@@ -1,6 +1,6 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
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
 
@@ -1,6 +1,5 @@
1
1
 
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.innov8tif.RNOkayCam">
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
3
 
5
4
  </manifest>
6
5
 
@@ -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,30 +124,29 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
125
124
  ));
126
125
 
127
126
  okayCamConfig.setCaptureConfig(new CaptureConfigPair(
128
- firstPhoto != null ? new OkayCamCaptureConfig(
129
- firstPhoto.getInt("delay"),
130
- firstPhoto.getBoolean("onFlash"),
131
- firstPhoto.getString("outputPath"),
132
- firstPhoto.getBoolean("onImageQuality")
133
- ) : null,
134
- secondPhoto != null ? new OkayCamCaptureConfig(
135
- secondPhoto.getInt("delay"),
136
- secondPhoto.getBoolean("onFlash"),
137
- secondPhoto.getString("outputPath"),
138
- secondPhoto.getBoolean("onImageQuality")
139
- ) : null
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));
143
+ okayCamConfig.setAutoCapture(userConfig.getBoolean("autoCapture"));
145
144
 
146
145
  OkayCamDoc.start(this.getCurrentActivity(), LICENSE_KEY, okayCamConfig, (success, images, exception) -> {
147
146
 
148
147
  if (success) {
149
148
  JSONObject results = new JSONObject();
150
149
  try {
151
-
152
150
  results.put("fullDocumentImage", convertImgToBase64(base64, images.get(0)));
153
151
 
154
152
  if (images.size() > 1) {
@@ -165,7 +163,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
165
163
 
166
164
  promise.resolve(results.toString());
167
165
  } catch (JSONException e) {
168
- // TODO Auto-generated catch block
169
166
  e.printStackTrace();
170
167
  promise.reject(this.getError(e.getMessage()));
171
168
  }
@@ -203,8 +200,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
203
200
  }
204
201
 
205
202
  private String getImageFromJs(String refImage, OkayCamFrameConfig frameConfig, String fileName) {
206
-
207
-
208
203
  Size size = frameConfig.getSize();
209
204
  int frameWidth = size.getWidth();
210
205
  int frameHeight = size.getHeight();
@@ -212,7 +207,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
212
207
  Bitmap contentBmp = null;
213
208
  try {
214
209
  if (refImage != null) {
215
-
216
210
  // In debug, the image is returned as URL
217
211
  if (BuildConfig.DEBUG) {
218
212
  InputStream inputStream = new URL(refImage).openStream();
@@ -290,7 +284,6 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
290
284
  Bitmap contentBmp = null;
291
285
  try {
292
286
  if (refImage != null) {
293
-
294
287
  // In debug, the image is returned as URL
295
288
  if (BuildConfig.DEBUG) {
296
289
  InputStream inputStream = new URL(refImage).openStream();
@@ -561,4 +554,4 @@ public class RNOkayCamModule extends ReactContextBaseJavaModule {
561
554
  }
562
555
  return new Exception(errorString);
563
556
  }
564
- }
557
+ }
@@ -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
@@ -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: imageResolvedAssetSource,
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
- // return Image.resolveAssetSource(img).uri;
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,
@@ -180,100 +166,14 @@ export const captureDocument = (
180
166
  imageQuality = 1.0,
181
167
  preview = defaultPreview,
182
168
  instruction = defaultInstruction,
169
+ showPreviewInstruction = false,
170
+ autoCapture = true,
183
171
  }
184
172
  ) => {
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
173
  if (frame.size == undefined) {
210
174
  frame.size = defaultFrame.size;
211
175
  }
212
176
 
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
177
  const resultedPreview =
278
178
  preview == null
279
179
  ? null
@@ -321,6 +221,8 @@ export const captureDocument = (
321
221
  imageQuality: imageQuality,
322
222
  preview: resultedPreview,
323
223
  instruction: formatInstruction(instruction),
224
+ showPreviewInstruction: showPreviewInstruction,
225
+ autoCapture: autoCapture,
324
226
  },
325
227
  })
326
228
  .then((result) => {
@@ -355,54 +257,6 @@ export const captureSelfie = (
355
257
  imageQuality = 1.0,
356
258
  }
357
259
  ) => {
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
260
  return new Promise(function (resolve, reject) {
407
261
  RNOkayCam.captureSelfie({
408
262
  license: license,
@@ -44,6 +44,7 @@ class RNOkayCam: NSObject {
44
44
  let torchBtnEnabled = rnOkayCamConfig.object(forKey: "torchBtnEnabled") as! Bool
45
45
  let width = rnOkayCamConfig.object(forKey: "width") as! Int
46
46
  let imageQuality = rnOkayCamConfig.object(forKey: "imageQuality") as! CGFloat
47
+ let autoCapture = rnOkayCamConfig.object(forKey: "autoCapture") as! Bool
47
48
 
48
49
  DispatchQueue.main.async {
49
50
  let rootViewController = (UIApplication.shared.keyWindow?.rootViewController)!
@@ -107,13 +108,11 @@ class RNOkayCam: NSObject {
107
108
  firstPhoto: OkayCamCaptureConfig(
108
109
  timeOut: firstPhoto.object(forKey: "delay") as! Int,
109
110
  onFlash: firstPhoto.object(forKey: "onFlash") as! Bool,
110
- onImageQuality: firstPhoto.object(forKey: "onImageQuality") as! Bool,
111
- outputPath: (firstPhotoPath != nil) ? URL(string: (firstPhoto.object(forKey: "outputPath") as? String)!) : nil
111
+ outputPath: (firstPhotoPath != nil) ? URL(string: (firstPhoto.object(forKey: "outputPath") as? String)!) : nil
112
112
  ),
113
113
  secondPhoto: (secondPhoto != nil) ? OkayCamCaptureConfig(
114
114
  timeOut: secondPhoto?.object(forKey: "delay") as? Int ?? 0,
115
115
  onFlash: secondPhoto?.object(forKey: "onFlash") as? Bool ?? false,
116
- onImageQuality: secondPhoto?.object(forKey: "onImageQuality") as! Bool,
117
116
  outputPath: (secondPhotoPath != nil) ? URL(string: (secondPhoto?.object(forKey: "outputPath") as! String?)!) : nil
118
117
  ) : nil
119
118
  )
@@ -134,6 +133,8 @@ class RNOkayCam: NSObject {
134
133
  let instructionConfig = rnOkayCamConfig.object(forKey: "instruction") as? NSDictionary
135
134
  okayCamConfig.instruction = self.getOkayCamInstruction(instructionConfig: instructionConfig)
136
135
 
136
+ okayCamConfig.autoCapture = autoCapture
137
+
137
138
  // start the SDK
138
139
  OkayCamDoc.start(
139
140
  okayCamConfig: okayCamConfig,
@@ -398,7 +399,12 @@ class RNOkayCam: NSObject {
398
399
  case .cameraPermission:
399
400
  reject("camera permission denied", "camera permission denied", nil)
400
401
  return
402
+ case .failedToCreateIADBundle:
403
+ reject("failed to create IAD bundle", "failed to create IAD bundle", nil)
404
+ return
405
+ @unknown default:
406
+ reject("no error", "no error", nil)
407
+ return
401
408
  }
402
409
  }
403
410
  }
404
-
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.3",
4
+ "version": "3.0.0",
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": "^16.8.1",
34
- "react-native": ">=0.60.0-rc.0 <1.0.x"
33
+ "react": "^18.0.2",
34
+ "react-native": ">=0.75.2 <1.0.x"
35
35
  },
36
36
  "devDependencies": {
37
- "react": "^16.9.0",
38
- "react-native": "^0.65.1"
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
  }
@@ -6,24 +6,38 @@ Pod::Spec.new do |s|
6
6
  s.name = "react-native-okaycam"
7
7
  s.version = package["version"]
8
8
  s.summary = package["description"]
9
- s.description = <<-DESC
10
- react-native-okaycam
11
- DESC
9
+ s.description = "React Native bridge for OkayCam iOS SDK"
12
10
  s.homepage = "https://gitlab.com/innov8tif-ekyc-product/okaycam/mobile/react-native-okaycam.git"
13
- # brief license entry:
14
11
  s.license = "MIT"
15
- # optional - use expanded license entry instead:
16
- # s.license = { :type => "MIT", :file => "LICENSE" }
17
- s.authors = { "Raymond Lau" => "raymond@innov8tif.com" }
18
- s.platforms = { :ios => "9.0" }
12
+ s.authors = { "Innov8tif" => "ekyc.team@innov8tif.com" }
13
+ s.platforms = { :ios => "15.0" }
19
14
  s.source = { :git => "https://gitlab.com/innov8tif-ekyc-product/okaycam/mobile/react-native-okaycam.git", :tag => "#{s.version}" }
20
15
 
21
- s.source_files = "ios/**/*.{h,c,m,swift}"
16
+ s.source_files = "ios/**/*.{h,m,swift}"
22
17
  s.requires_arc = true
23
18
  s.static_framework = true
24
- s.dependency "React"
25
- s.dependency "OkayCam", "2.0.9"
26
- end
19
+ s.swift_version = '5.0'
20
+ s.module_name = "ReactNativeOkayCam"
21
+
22
+ # ✅ Updated React Native dependencies for RN 0.72+
23
+ s.dependency "React-Core"
24
+ s.dependency "ReactCommon/turbomodule/core"
25
+
26
+ # If your native code emits events to JS
27
+ s.dependency "React-RCTAppDelegate"
28
+ s.dependency "React-RCTFabric"
27
29
 
30
+ # ✅ OkayCam dependencies
31
+ s.dependency "OkayCam", "3.0.3"
32
+ s.dependency "CryptoSwift", "1.8.2"
28
33
 
29
-
34
+ # ✅ Architecture exclusions
35
+ s.pod_target_xcconfig = {
36
+ 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64',
37
+ 'IPHONEOS_DEPLOYMENT_TARGET' => '15.0'
38
+ }
39
+
40
+ s.user_target_xcconfig = {
41
+ 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
42
+ }
43
+ end
File without changes