react-native-okaycam 2.0.4 → 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 CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ### iOS
10
10
 
11
- - iOS 12+
11
+ - iOS 15+
12
12
  - Swift 5
13
13
 
14
14
  ## Getting started
@@ -21,17 +21,28 @@
21
21
  2. Add the following code to Podfile
22
22
 
23
23
  ```
24
- platform :ios, '12.0'
24
+ platform :ios, '15.0'
25
25
  use_frameworks!
26
26
 
27
27
  post_install do |installer|
28
28
  installer.pods_project.targets.each do |target|
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
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
35
46
  end
36
47
  end
37
48
  ```
@@ -42,16 +53,9 @@ end
42
53
 
43
54
  #### Android Issue
44
55
 
45
- **Add following rules for proguard in the `android/app/proguard-rules.pro`**
56
+ Duplicate class org.hamcrest.xxx
46
57
 
47
- ```
48
- -keep class org.pytorch.** { *; }
49
- -keep class com.facebook.jni.** { *; }
50
- ```
51
-
52
- **Duplicate class org.hamcrest.xxx**
53
-
54
- 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.
55
59
 
56
60
  ```
57
61
  configurations { compile.exclude group: "junit", module: "junit" }
@@ -82,44 +86,41 @@ const license = Platform.select({
82
86
 
83
87
  ### Configuration
84
88
 
85
- | - | Property name | Description | Default value |
86
- | ------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
87
- | - | torchBtnEnabled | to show torch button. If set to true, it will only be shown if onFlash from captureConfig is set to false. | false |
88
- | - | crop | crop the frame area | false |
89
- | - | width | width to resize the image | original width |
90
- | - | imageQuality | quality of image | 1.0 (range from 0.0 to 1.0) |
91
- | frame | size | size of the frame (width and height) | 90% of screen width and height is scaled proportionally according to card ratio |
92
- | frame | color | color of the frame | #ffffff |
93
- | frame | content | content of the frame (able to display svg file within the frame for guidance | null |
94
- | - | showOverlay | transparent black overlay | true |
95
- | topLabel | text | text of the top label | ""(empty string) |
96
- | topLabel | color | color of the top label | #ffffff |
97
- | topLabel | size | text size of the top label | 20 |
98
- | bottomLabel | text | text of the bottom label | ""(empty string) |
99
- | bottomLabel | color | color of the bottom label | #ffffff |
100
- | bottomLabel | size | text size of the bottom label | 20 |
101
- | timer | backgroundColor | background of the count down timer | #ffa500 |
102
- | timer | textColor | text color of the count down timer | #ffffff |
103
- | confirmBtnConfig | backgroundColor | background color of the confirm button | #ffa500 |
104
- | confirmBtnConfig | contentColor | content color of the confirm button | #ffffff |
105
- | retakeBtnConfig | backgroundColor | background color of the retake button | #ffa500 |
106
- | retakeBtnConfig | contentColor | content color of the retake button | #ffffff |
107
- | captureConfig | first | config for the first capture | delay:0s,onFlash:false,outputPath: null |
108
- | captureConfig | second | config for the second capture | delay:5s,onFlash:true,outputPath: null |
109
- | <sup>**New**</sup>captureConfig | first | config for the first capture | delay:0s,onFlash:false,outputPath:null,onImageQuality:false |
110
- | <sup>**New**</sup>captureConfig | second | config for the second capture | delay:5s,onFlash:true,outputPath:null,onImageQuality:false |
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 | delay:5s,onFlash:false,outputPath: 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 |
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 |
123
124
 
124
125
  ## Usage
125
126
 
@@ -194,6 +195,7 @@ captureDocument(
194
195
  img: require('./images/ref.png'),
195
196
  },
196
197
  },
198
+ showPreviewInstruction: false,
197
199
  }
198
200
  )
199
201
  .then(result => {
@@ -204,18 +206,12 @@ captureDocument(
204
206
  })
205
207
  ```
206
208
 
207
- > **_NOTE:_** <br/>
208
- > Supported image format : JPG | PNG | SVG <br/>
209
- > Preffered size : less than 500KB
210
-
211
209
  ### Result
212
210
 
213
- | Result | Description |
214
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
215
- | fullDocumentImage | Result of firstPhotoConfig |
216
- | fullDocumentImage2 | Result of secondPhotoConfig. Will only return if secondPhotoConfig is configured. if secondPhotoConfig is not configured, it will be original image of fullDocumentImage |
217
- | fullDocumentImage3 | Original Image if it exist |
218
- | fullDocumentImage4 | Original Image if it exist |
211
+ | Result | Description |
212
+ | ------------------ | -------------------------------------------------------------------------------- |
213
+ | fullDocumentImage | Result of firstPhotoConfig |
214
+ | fullDocumentImage2 | Result of secondPhotoConfig. Will only return if secondPhotoConfig is configured |
219
215
 
220
216
  ## OkayCam Selfie
221
217
 
@@ -1,2 +1,2 @@
1
- #Mon May 06 09:35:00 BDT 2024
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,18 +7,22 @@ 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
24
  minSdkVersion 21
21
- targetSdkVersion 33
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.VERSION_1_8
30
- targetCompatibility JavaVersion.VERSION_1_8
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('com.facebook.react:react-native:+'){
41
- exclude module: 'fbjni-java-only'
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-jdk7:$kotlin_version"
52
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
48
53
  implementation 'com.caverock:androidsvg-aar:1.4'
49
54
  }
50
-
@@ -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,21 +124,20 @@ 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));
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",
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": "^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
  }
@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
22
22
  s.requires_arc = true
23
23
  s.static_framework = true
24
24
  s.dependency "React"
25
- s.dependency "OkayCam", "2.0.11"
25
+ s.dependency "OkayCam", "2.0.18"
26
26
  end
27
27
 
28
28
 
File without changes