react-native-okaycam 1.1.10 → 1.1.22

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.
Files changed (138) hide show
  1. package/README.md +15 -1
  2. package/android/.DS_Store +0 -0
  3. package/android/.gradle/6.8/executionHistory/executionHistory.bin +0 -0
  4. package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
  5. package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/6.8/fileHashes/fileHashes.bin +0 -0
  7. package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/6.8/fileHashes/resourceHashesCache.bin +0 -0
  9. package/android/.gradle/6.8/gc.properties +0 -0
  10. package/android/.gradle/6.8/javaCompile/classAnalysis.bin +0 -0
  11. package/android/.gradle/6.8/javaCompile/jarAnalysis.bin +0 -0
  12. package/android/.gradle/6.8/javaCompile/javaCompile.lock +0 -0
  13. package/android/.gradle/6.8/javaCompile/taskHistory.bin +0 -0
  14. package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  15. package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
  16. package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
  17. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  18. package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
  19. package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
  20. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  21. package/android/.gradle/7.2/gc.properties +0 -0
  22. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  23. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  24. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  25. package/android/.gradle/checksums/checksums.lock +0 -0
  26. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  27. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  28. package/android/.idea/.gitignore +3 -0
  29. package/android/.idea/compiler.xml +6 -0
  30. package/android/.idea/gradle.xml +8 -4
  31. package/android/.idea/jarRepositories.xml +40 -0
  32. package/android/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml +13 -0
  33. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +11 -0
  34. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml +16 -0
  35. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml +13 -0
  36. package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +11 -0
  37. package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +13 -0
  38. package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +13 -0
  39. package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +11 -0
  40. package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml +16 -0
  41. package/android/.idea/libraries/Gradle__androidx_core_core_1_3_1_aar.xml +16 -0
  42. package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +13 -0
  43. package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +13 -0
  44. package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +13 -0
  45. package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +16 -0
  46. package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml +16 -0
  47. package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +13 -0
  48. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +13 -0
  49. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +13 -0
  50. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml +13 -0
  51. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml +11 -0
  52. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_1_0_aar.xml +13 -0
  53. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_1_0_aar.xml +13 -0
  54. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml +13 -0
  55. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml +13 -0
  56. package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +13 -0
  57. package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +13 -0
  58. package/android/.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml +16 -0
  59. package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +16 -0
  60. package/android/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_0_0_aar.xml +16 -0
  61. package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml +13 -0
  62. package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +13 -0
  63. package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +16 -0
  64. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +13 -0
  65. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +13 -0
  66. package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +13 -0
  67. package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +13 -0
  68. package/android/.idea/libraries/Gradle__com_caverock_androidsvg_aar_1_4_aar.xml +15 -0
  69. package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_0_8_1_aar.xml +15 -0
  70. package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_0_8_1_aar.xml +15 -0
  71. package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_0_8_1_aar.xml +15 -0
  72. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_0_8_1_aar.xml +16 -0
  73. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp_0_8_1_aar.xml +15 -0
  74. package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_20_1_aar.xml +19 -0
  75. package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_2_0.xml +13 -0
  76. package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_okhttp_1_2_0.xml +13 -0
  77. package/android/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_2_3.xml +13 -0
  78. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_0.xml +13 -0
  79. package/android/.idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml +13 -0
  80. package/android/.idea/libraries/Gradle__com_innov8tif_okaycam_OkayCam_1_1_9_aar.xml +15 -0
  81. package/android/.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0.xml +13 -0
  82. package/android/.idea/libraries/Gradle__com_parse_bolts_bolts_android_1_1_4.xml +13 -0
  83. package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_5_0.xml +13 -0
  84. package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_ws_2_5_0.xml +13 -0
  85. package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_6_0.xml +13 -0
  86. package/android/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml +13 -0
  87. package/android/.idea/libraries/Gradle__junit_junit_4_10.xml +13 -0
  88. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml +11 -0
  89. package/android/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml +13 -0
  90. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_21.xml +13 -0
  91. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_21.xml +13 -0
  92. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_21.xml +13 -0
  93. package/android/.idea/libraries/Gradle__org_webkit_android_jsc_r174650_aar.xml +11 -0
  94. package/android/.idea/misc.xml +1 -1
  95. package/android/.idea/modules/android.iml +93 -6
  96. package/android/build/generated/source/buildConfig/debug/com/innov8tif/RNOkayCam/BuildConfig.java +12 -0
  97. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +11 -0
  98. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +27 -0
  99. package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
  100. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  101. package/android/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
  102. package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
  103. package/android/build/intermediates/compile_symbol_list/debug/R.txt +3230 -0
  104. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  105. package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
  106. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  107. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  108. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  109. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -0
  110. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -0
  111. package/android/build/intermediates/javac/debug/classes/com/innov8tif/RNOkayCam/BuildConfig.class +0 -0
  112. package/android/build/intermediates/javac/debug/classes/com/innov8tif/RNOkayCam/RNOkayCamModule.class +0 -0
  113. package/android/build/intermediates/javac/debug/classes/com/innov8tif/RNOkayCam/RNOkayCamPackage.class +0 -0
  114. package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +11 -0
  115. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
  116. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +13 -0
  117. package/android/build/intermediates/merged_java_res/debug/out.jar +0 -0
  118. package/android/build/intermediates/merged_manifests/debug/output.json +27 -0
  119. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +2248 -0
  120. package/android/build/outputs/aar/android-debug.aar +0 -0
  121. package/android/build/outputs/logs/manifest-merger-debug-report.txt +37 -0
  122. package/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +6 -0
  123. package/android/build.gradle +13 -5
  124. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  125. package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  126. package/android/gradle.properties +2 -0
  127. package/android/gradlew +185 -0
  128. package/android/gradlew.bat +89 -0
  129. package/android/src/main/java/com/innov8tif/RNOkayCam/RNOkayCamModule.java +355 -248
  130. package/index.ts +182 -152
  131. package/ios/RNOkayCam.swift +49 -0
  132. package/ios/RNOkayCam.xcodeproj/project.pbxproj +55 -2
  133. package/ios/RNOkayCam.xcodeproj/xcuserdata/thet.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
  134. package/ios/RNOkayCam.xcworkspace/contents.xcworkspacedata +3 -0
  135. package/ios/RNOkayCam.xcworkspace/xcuserdata/thet.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  136. package/package.json +1 -1
  137. package/react-native-okaycam.podspec +1 -1
  138. package/android/.idea/workspace.xml +0 -44
package/index.ts CHANGED
@@ -1,204 +1,234 @@
1
- import { NativeModules, Dimensions, PixelRatio, Image, ImageResolvedAssetSource, Platform } from 'react-native';
1
+ import {
2
+ NativeModules,
3
+ Dimensions,
4
+ PixelRatio,
5
+ Image,
6
+ ImageResolvedAssetSource,
7
+ Platform,
8
+ } from "react-native";
2
9
 
3
10
  const { RNOkayCam } = NativeModules;
4
11
 
5
- const screenWidth = Dimensions.get("screen").width
12
+ const screenWidth = Dimensions.get("screen").width;
6
13
 
7
14
  interface LabelConfig {
8
- text: string,
9
- color: string,
10
- size: number
15
+ text: string;
16
+ color: string;
17
+ size: number;
18
+ }
19
+
20
+ interface OkayCamPreviewConfig {
21
+ title: LabelConfig;
22
+ refImage: ImageResolvedAssetSource;
23
+ instruction1: LabelConfig;
24
+ instruction2: LabelConfig;
25
+ instruction3: LabelConfig;
26
+ backgroundColor: string;
11
27
  }
12
28
 
13
29
  interface FrameSize {
14
- width: number,
15
- height: number
30
+ width: number;
31
+ height: number;
16
32
  }
17
33
 
18
34
  interface Frame {
19
- size: FrameSize,
20
- color: string,
21
- content: ImageResolvedAssetSource
35
+ size: FrameSize;
36
+ color: string;
37
+ content: ImageResolvedAssetSource;
22
38
  }
23
39
 
24
40
  interface TimerConfig {
25
- backgroundColor: string,
26
- textColor: string
41
+ backgroundColor: string;
42
+ textColor: string;
27
43
  }
28
44
 
29
45
  interface OkayCamBtnConfig {
30
- backgroundColor: string,
31
- contentColor: string
46
+ backgroundColor: string;
47
+ contentColor: string;
32
48
  }
33
49
 
34
50
  interface CaptureConfig {
35
- delay: number,
36
- onFlash: Boolean,
37
- outputPath?: string
51
+ delay: number;
52
+ onFlash: Boolean;
53
+ outputPath?: string;
38
54
  }
39
55
 
40
56
  interface SwitchBtnConfig {
41
- color: string,
42
- show: Boolean
57
+ color: string;
58
+ show: Boolean;
43
59
  }
44
60
 
45
- type cameraFacingType = "front" | "back"
61
+ type cameraFacingType = "front" | "back";
46
62
 
47
63
  // Set default values
48
- const defaultColor = "#ffffff"
49
- const defaultColor2 = "#ffa500"
50
- const imageResizedWidth = -1
64
+ const defaultColor = "#ffffff";
65
+ const defaultColor2 = "#ffa500";
66
+ const imageResizedWidth = -1;
51
67
 
52
68
  const labelConfig: LabelConfig = {
53
- text: "",
54
- color: defaultColor,
55
- size: 20
56
- }
69
+ text: "",
70
+ color: defaultColor,
71
+ size: 20,
72
+ };
57
73
 
58
74
  const defaultFrame: Frame = {
59
- size: {
60
- width: screenWidth * 0.9,
61
- height: screenWidth * 54 / 85
62
- },
63
- color: defaultColor,
64
- content: null
65
- }
75
+ size: {
76
+ width: screenWidth * 0.9,
77
+ height: (screenWidth * 54) / 85,
78
+ },
79
+ color: defaultColor,
80
+ content: null,
81
+ };
66
82
 
67
83
  const timerConfig: TimerConfig = {
68
- backgroundColor: defaultColor2,
69
- textColor: defaultColor
70
- }
84
+ backgroundColor: defaultColor2,
85
+ textColor: defaultColor,
86
+ };
71
87
 
72
88
  const okayCamBtnConfig: OkayCamBtnConfig = {
73
- backgroundColor: defaultColor2,
74
- contentColor: defaultColor
75
- }
89
+ backgroundColor: defaultColor2,
90
+ contentColor: defaultColor,
91
+ };
76
92
 
77
- const defaultCaptureBtnColor: string = defaultColor
93
+ const defaultCaptureBtnColor: string = defaultColor;
78
94
 
79
95
  const captureConfigFirst: CaptureConfig = {
80
- delay: 0,
81
- onFlash: false,
82
- outputPath: null
83
- }
96
+ delay: 0,
97
+ onFlash: false,
98
+ outputPath: null,
99
+ };
100
+
101
+ const defaultPreview: OkayCamPreviewConfig = null;
84
102
 
85
- const captureConfigSecond: CaptureConfig = null
103
+ const captureConfigSecond: CaptureConfig = null;
86
104
 
87
105
  // cal native capture document
88
106
  export const captureDocument = (
89
- license: string,
90
- base64: Boolean,
91
- {
92
- showOverlay = true,
93
- topLabel = labelConfig,
94
- bottomLabel = labelConfig,
95
- frame = defaultFrame,
96
- timer = timerConfig,
97
- torchBtnEnabled = false,
98
- confirmBtnConfig = okayCamBtnConfig,
99
- retakeBtnConfig = okayCamBtnConfig,
100
- captureBtnColor = defaultCaptureBtnColor,
101
- firstPhotoConfig = captureConfigFirst,
102
- secondPhotoConfig = captureConfigSecond,
103
- crop = false,
104
- width = imageResizedWidth,
105
- imageQuality = 1.0
106
- }
107
+ license: string,
108
+ base64: Boolean,
109
+ {
110
+ showOverlay = true,
111
+ topLabel = labelConfig,
112
+ bottomLabel = labelConfig,
113
+ frame = defaultFrame,
114
+ timer = timerConfig,
115
+ torchBtnEnabled = false,
116
+ confirmBtnConfig = okayCamBtnConfig,
117
+ retakeBtnConfig = okayCamBtnConfig,
118
+ captureBtnColor = defaultCaptureBtnColor,
119
+ firstPhotoConfig = captureConfigFirst,
120
+ secondPhotoConfig = captureConfigSecond,
121
+ crop = false,
122
+ width = imageResizedWidth,
123
+ imageQuality = 1.0,
124
+ preview = defaultPreview,
125
+ }
107
126
  ) => {
108
-
109
- if (frame.size == undefined) {
110
- frame.size = defaultFrame.size
111
- }
112
-
113
- return new Promise(function (resolve, reject) {
114
- RNOkayCam.captureDocument({
115
- license: license,
116
- base64: base64,
117
- config: {
118
- showOverlay: showOverlay,
119
- topLabel: topLabel,
120
- bottomLabel: bottomLabel,
121
- frame: {
122
- size: Platform.select({
123
- android: {
124
- width: PixelRatio.getPixelSizeForLayoutSize(frame.size.width),
125
- height: PixelRatio.getPixelSizeForLayoutSize(frame.size.height)
126
- },
127
- ios: {
128
- width: frame.size.width,
129
- height: frame.size.height
130
- }
131
- }),
132
- color: frame.color != null ? frame.color : defaultFrame.color,
133
- content: frame.content != null ? Image.resolveAssetSource(frame.content).uri : null
134
- },
135
- timer: timer,
136
- torchBtnEnabled: torchBtnEnabled,
137
- confirmBtnConfig: confirmBtnConfig,
138
- retakeBtnConfig: retakeBtnConfig,
139
- captureBtnColor: captureBtnColor,
140
- captureConfigPair: {
141
- firstPhoto: firstPhotoConfig,
142
- secondPhoto: secondPhotoConfig
143
- },
144
- crop: crop,
145
- width: width,
146
- imageQuality: imageQuality
147
- }
148
- })
149
- .then(result => {
150
- resolve(JSON.parse(result))
151
- })
152
- .catch(error => {
153
- reject(error)
154
- })
127
+ if (frame.size == undefined) {
128
+ frame.size = defaultFrame.size;
129
+ }
130
+
131
+ const resultedPreview =
132
+ preview == null
133
+ ? null
134
+ : {
135
+ ...preview,
136
+ refImage: Image.resolveAssetSource(preview.refImage).uri,
137
+ };
138
+
139
+ return new Promise(function (resolve, reject) {
140
+ RNOkayCam.captureDocument({
141
+ license: license,
142
+ base64: base64,
143
+ config: {
144
+ showOverlay: showOverlay,
145
+ topLabel: topLabel,
146
+ bottomLabel: bottomLabel,
147
+ frame: {
148
+ size: Platform.select({
149
+ android: {
150
+ width: PixelRatio.getPixelSizeForLayoutSize(frame.size.width),
151
+ height: PixelRatio.getPixelSizeForLayoutSize(frame.size.height),
152
+ },
153
+ ios: {
154
+ width: frame.size.width,
155
+ height: frame.size.height,
156
+ },
157
+ }),
158
+ color: frame.color != null ? frame.color : defaultFrame.color,
159
+ content:
160
+ frame.content != null
161
+ ? Image.resolveAssetSource(frame.content).uri
162
+ : null,
163
+ },
164
+ timer: timer,
165
+ torchBtnEnabled: torchBtnEnabled,
166
+ confirmBtnConfig: confirmBtnConfig,
167
+ retakeBtnConfig: retakeBtnConfig,
168
+ captureBtnColor: captureBtnColor,
169
+ captureConfigPair: {
170
+ firstPhoto: firstPhotoConfig,
171
+ secondPhoto: secondPhotoConfig,
172
+ },
173
+ crop: crop,
174
+ width: width,
175
+ imageQuality: imageQuality,
176
+ preview: resultedPreview,
177
+ },
155
178
  })
156
- }
179
+ .then((result) => {
180
+ resolve(JSON.parse(result));
181
+ })
182
+ .catch((error) => {
183
+ reject(error);
184
+ });
185
+ });
186
+ };
157
187
 
158
188
  const defaultSwitchBtnConfig: SwitchBtnConfig = {
159
- show: true,
160
- color: defaultColor
161
- }
189
+ show: true,
190
+ color: defaultColor,
191
+ };
162
192
 
163
- const cameraFacing: cameraFacingType = 'front'
193
+ const cameraFacing: cameraFacingType = "front";
164
194
 
165
195
  // call native capture selfie
166
196
  export const captureSelfie = (
167
- license: string,
168
- base64: Boolean,
169
- {
170
- topLabel = labelConfig,
171
- bottomFrameColor = defaultColor2,
172
- captureBtnColor = defaultColor,
173
- switchBtnConfig = defaultSwitchBtnConfig,
174
- confirmBtnConfig = okayCamBtnConfig,
175
- retakeBtnConfig = okayCamBtnConfig,
176
- defaultCameraFacing = cameraFacing,
177
- width = imageResizedWidth,
178
- imageQuality = 1.0
179
- }
197
+ license: string,
198
+ base64: Boolean,
199
+ {
200
+ topLabel = labelConfig,
201
+ bottomFrameColor = defaultColor2,
202
+ captureBtnColor = defaultColor,
203
+ switchBtnConfig = defaultSwitchBtnConfig,
204
+ confirmBtnConfig = okayCamBtnConfig,
205
+ retakeBtnConfig = okayCamBtnConfig,
206
+ defaultCameraFacing = cameraFacing,
207
+ width = imageResizedWidth,
208
+ imageQuality = 1.0,
209
+ }
180
210
  ) => {
181
- return new Promise(function (resolve, reject) {
182
- RNOkayCam.captureSelfie({
183
- license: license,
184
- base64: base64,
185
- config: {
186
- topLabel: topLabel,
187
- bottomFrameColor: bottomFrameColor,
188
- captureBtnColor: captureBtnColor,
189
- switchBtnConfig: switchBtnConfig,
190
- confirmBtnConfig: confirmBtnConfig,
191
- retakeBtnConfig: retakeBtnConfig,
192
- defaultCameraFacing: defaultCameraFacing,
193
- width: width,
194
- imageQuality: imageQuality
195
- }
196
- })
197
- .then(result => {
198
- resolve(JSON.parse(result))
199
- })
200
- .catch(error => {
201
- reject(error)
202
- })
211
+ return new Promise(function (resolve, reject) {
212
+ RNOkayCam.captureSelfie({
213
+ license: license,
214
+ base64: base64,
215
+ config: {
216
+ topLabel: topLabel,
217
+ bottomFrameColor: bottomFrameColor,
218
+ captureBtnColor: captureBtnColor,
219
+ switchBtnConfig: switchBtnConfig,
220
+ confirmBtnConfig: confirmBtnConfig,
221
+ retakeBtnConfig: retakeBtnConfig,
222
+ defaultCameraFacing: defaultCameraFacing,
223
+ width: width,
224
+ imageQuality: imageQuality,
225
+ },
203
226
  })
204
- }
227
+ .then((result) => {
228
+ resolve(JSON.parse(result));
229
+ })
230
+ .catch((error) => {
231
+ reject(error);
232
+ });
233
+ });
234
+ };
@@ -122,6 +122,12 @@ class RNOkayCam: NSObject {
122
122
  okayCamConfig.width = width
123
123
  }
124
124
 
125
+ // preview config
126
+
127
+ let previewConfig = rnOkayCamConfig.object(forKey: "preview") as? NSDictionary
128
+
129
+ okayCamConfig.preview = self.getOkaycamPreview(previewConfig: previewConfig)
130
+
125
131
  // start the SDK
126
132
  OkayCamDoc.start(
127
133
  okayCamConfig: okayCamConfig,
@@ -143,6 +149,14 @@ class RNOkayCam: NSObject {
143
149
  if (filePaths!.count > 1) {
144
150
  okayCamObject.setValue(self.convertImgToBase64(base64: base64, image: urls[1]), forKey: "fullDocumentImage2")
145
151
  }
152
+
153
+ if (filePaths!.count > 2) {
154
+ okayCamObject.setValue(self.convertImgToBase64(base64: base64, image: urls[2]), forKey: "fullDocumentImage3")
155
+ }
156
+
157
+ if (filePaths!.count > 3) {
158
+ okayCamObject.setValue(self.convertImgToBase64(base64: base64, image: urls[3]), forKey: "fullDocumentImage4")
159
+ }
146
160
 
147
161
  let jsonData = try JSONSerialization.data(withJSONObject: okayCamObject, options: .prettyPrinted)
148
162
  let jsonString = String(data: jsonData, encoding: String.Encoding.ascii)!
@@ -158,6 +172,41 @@ class RNOkayCam: NSObject {
158
172
  }
159
173
  }
160
174
 
175
+ func getOkaycamPreview(previewConfig: NSDictionary?) -> OkayCamPreviewConfig?{
176
+ if previewConfig == nil { return nil}
177
+
178
+
179
+ let title = configToOkayCamLabel(config: previewConfig?.object(forKey: "title") as! NSDictionary)
180
+
181
+ let instr1 = configToOkayCamLabel(config: previewConfig?.object(forKey: "instruction1") as! NSDictionary)
182
+
183
+ let instr2 = configToOkayCamLabel(config: previewConfig?.object(forKey: "instruction2") as! NSDictionary)
184
+
185
+ let instr3 = configToOkayCamLabel(config: previewConfig?.object(forKey: "instruction3") as! NSDictionary)
186
+
187
+ let bgColor = self.hexStringToUIColor(hex: previewConfig?.object(forKey: "backgroundColor") as! String)
188
+
189
+ // frame contet
190
+ let ref = previewConfig?.object(forKey: "refImage") as? String
191
+ var refUrl:URL? = nil
192
+ if (ref != nil) {
193
+ #if DEBUG
194
+ refUrl = URL(string: ref!)!
195
+ #else
196
+ refUrl = URL(fileURLWithPath: ref!.replacingOccurrences(of: "file:///", with: ""))
197
+ #endif
198
+ }
199
+
200
+ return OkayCamPreviewConfig(title: title, refImage: refUrl!, instruction1: instr1, instruction2: instr2, instruction3: instr3, backgroundColor: bgColor)
201
+ }
202
+
203
+ func configToOkayCamLabel(config:NSDictionary) -> OkayCamLabelConfig{
204
+ let text = config.object(forKey: "text") as! String
205
+ let color = self.hexStringToUIColor(hex: config.object(forKey: "color") as! String)
206
+ let size = CGFloat(config.object(forKey: "size") as! Int)
207
+ return OkayCamLabelConfig(text: text, color: color, size: size)
208
+ }
209
+
161
210
  @objc func captureSelfie(_ configs: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
162
211
 
163
212
  let license = configs.object(forKey: "license")! as! String
@@ -9,6 +9,7 @@
9
9
  /* Begin PBXBuildFile section */
10
10
  4D47E5C025C083810038D7EC /* RNOkayCam.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D47E5BF25C083810038D7EC /* RNOkayCam.swift */; };
11
11
  B3E7B58A1CC2AC0600A0062D /* RNOkayCam.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNOkayCam.m */; };
12
+ DB20EA94C7207FA4A153737A /* Pods_RNOkayCam.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF8168FCF180DE99D3443D56 /* Pods_RNOkayCam.framework */; };
12
13
  /* End PBXBuildFile section */
13
14
 
14
15
  /* Begin PBXCopyFilesBuildPhase section */
@@ -28,6 +29,9 @@
28
29
  4D47E5BD25C083530038D7EC /* RNOkayCam-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNOkayCam-Bridging-Header.h"; sourceTree = "<group>"; };
29
30
  4D47E5BF25C083810038D7EC /* RNOkayCam.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RNOkayCam.swift; sourceTree = "<group>"; };
30
31
  B3E7B5891CC2AC0600A0062D /* RNOkayCam.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNOkayCam.m; sourceTree = "<group>"; };
32
+ CB6B4CC187A245DF02C1905A /* Pods-RNOkayCam.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNOkayCam.release.xcconfig"; path = "Target Support Files/Pods-RNOkayCam/Pods-RNOkayCam.release.xcconfig"; sourceTree = "<group>"; };
33
+ FED8765FCB8A0E8CACFC386E /* Pods-RNOkayCam.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNOkayCam.debug.xcconfig"; path = "Target Support Files/Pods-RNOkayCam/Pods-RNOkayCam.debug.xcconfig"; sourceTree = "<group>"; };
34
+ FF8168FCF180DE99D3443D56 /* Pods_RNOkayCam.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RNOkayCam.framework; sourceTree = BUILT_PRODUCTS_DIR; };
31
35
  /* End PBXFileReference section */
32
36
 
33
37
  /* Begin PBXFrameworksBuildPhase section */
@@ -35,12 +39,23 @@
35
39
  isa = PBXFrameworksBuildPhase;
36
40
  buildActionMask = 2147483647;
37
41
  files = (
42
+ DB20EA94C7207FA4A153737A /* Pods_RNOkayCam.framework in Frameworks */,
38
43
  );
39
44
  runOnlyForDeploymentPostprocessing = 0;
40
45
  };
41
46
  /* End PBXFrameworksBuildPhase section */
42
47
 
43
48
  /* Begin PBXGroup section */
49
+ 0968FBA9E90D8EE56660C935 /* Pods */ = {
50
+ isa = PBXGroup;
51
+ children = (
52
+ FED8765FCB8A0E8CACFC386E /* Pods-RNOkayCam.debug.xcconfig */,
53
+ CB6B4CC187A245DF02C1905A /* Pods-RNOkayCam.release.xcconfig */,
54
+ );
55
+ name = Pods;
56
+ path = Pods;
57
+ sourceTree = "<group>";
58
+ };
44
59
  134814211AA4EA7D00B7C361 /* Products */ = {
45
60
  isa = PBXGroup;
46
61
  children = (
@@ -56,7 +71,17 @@
56
71
  4D47E5BF25C083810038D7EC /* RNOkayCam.swift */,
57
72
  134814211AA4EA7D00B7C361 /* Products */,
58
73
  4D47E5BD25C083530038D7EC /* RNOkayCam-Bridging-Header.h */,
74
+ 0968FBA9E90D8EE56660C935 /* Pods */,
75
+ E382AF4271A2883E64F698E0 /* Frameworks */,
76
+ );
77
+ sourceTree = "<group>";
78
+ };
79
+ E382AF4271A2883E64F698E0 /* Frameworks */ = {
80
+ isa = PBXGroup;
81
+ children = (
82
+ FF8168FCF180DE99D3443D56 /* Pods_RNOkayCam.framework */,
59
83
  );
84
+ name = Frameworks;
60
85
  sourceTree = "<group>";
61
86
  };
62
87
  /* End PBXGroup section */
@@ -66,6 +91,7 @@
66
91
  isa = PBXNativeTarget;
67
92
  buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNOkayCam" */;
68
93
  buildPhases = (
94
+ 693E4AB06E794461882BF8F3 /* [CP] Check Pods Manifest.lock */,
69
95
  58B511D71A9E6C8500147676 /* Sources */,
70
96
  58B511D81A9E6C8500147676 /* Frameworks */,
71
97
  58B511D91A9E6C8500147676 /* CopyFiles */,
@@ -112,6 +138,31 @@
112
138
  };
113
139
  /* End PBXProject section */
114
140
 
141
+ /* Begin PBXShellScriptBuildPhase section */
142
+ 693E4AB06E794461882BF8F3 /* [CP] Check Pods Manifest.lock */ = {
143
+ isa = PBXShellScriptBuildPhase;
144
+ buildActionMask = 2147483647;
145
+ files = (
146
+ );
147
+ inputFileListPaths = (
148
+ );
149
+ inputPaths = (
150
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
151
+ "${PODS_ROOT}/Manifest.lock",
152
+ );
153
+ name = "[CP] Check Pods Manifest.lock";
154
+ outputFileListPaths = (
155
+ );
156
+ outputPaths = (
157
+ "$(DERIVED_FILE_DIR)/Pods-RNOkayCam-checkManifestLockResult.txt",
158
+ );
159
+ runOnlyForDeploymentPostprocessing = 0;
160
+ shellPath = /bin/sh;
161
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
162
+ showEnvVarsInLog = 0;
163
+ };
164
+ /* End PBXShellScriptBuildPhase section */
165
+
115
166
  /* Begin PBXSourcesBuildPhase section */
116
167
  58B511D71A9E6C8500147676 /* Sources */ = {
117
168
  isa = PBXSourcesBuildPhase;
@@ -162,7 +213,7 @@
162
213
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
163
214
  GCC_WARN_UNUSED_FUNCTION = YES;
164
215
  GCC_WARN_UNUSED_VARIABLE = YES;
165
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
216
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
166
217
  MTL_ENABLE_DEBUG_INFO = YES;
167
218
  ONLY_ACTIVE_ARCH = YES;
168
219
  SDKROOT = iphoneos;
@@ -199,7 +250,7 @@
199
250
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
200
251
  GCC_WARN_UNUSED_FUNCTION = YES;
201
252
  GCC_WARN_UNUSED_VARIABLE = YES;
202
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
253
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
203
254
  MTL_ENABLE_DEBUG_INFO = NO;
204
255
  SDKROOT = iphoneos;
205
256
  VALIDATE_PRODUCT = YES;
@@ -208,6 +259,7 @@
208
259
  };
209
260
  58B511F01A9E6C8500147676 /* Debug */ = {
210
261
  isa = XCBuildConfiguration;
262
+ baseConfigurationReference = FED8765FCB8A0E8CACFC386E /* Pods-RNOkayCam.debug.xcconfig */;
211
263
  buildSettings = {
212
264
  CLANG_ENABLE_MODULES = YES;
213
265
  HEADER_SEARCH_PATHS = (
@@ -229,6 +281,7 @@
229
281
  };
230
282
  58B511F11A9E6C8500147676 /* Release */ = {
231
283
  isa = XCBuildConfiguration;
284
+ baseConfigurationReference = CB6B4CC187A245DF02C1905A /* Pods-RNOkayCam.release.xcconfig */;
232
285
  buildSettings = {
233
286
  CLANG_ENABLE_MODULES = YES;
234
287
  HEADER_SEARCH_PATHS = (
@@ -7,7 +7,7 @@
7
7
  <key>RNOkayCam.xcscheme_^#shared#^_</key>
8
8
  <dict>
9
9
  <key>orderHint</key>
10
- <integer>0</integer>
10
+ <integer>3</integer>
11
11
  </dict>
12
12
  </dict>
13
13
  </dict>
@@ -4,4 +4,7 @@
4
4
  <FileRef
5
5
  location = "group:RNOkayCam.xcodeproj">
6
6
  </FileRef>
7
+ <FileRef
8
+ location = "group:Pods/Pods.xcodeproj">
9
+ </FileRef>
7
10
  </Workspace>
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.1.10",
4
+ "version": "1.1.22",
5
5
  "description": "React-Native version of OkayCam",
6
6
  "main": "index.ts",
7
7
  "files": [
@@ -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", "1.1.5"
25
+ s.dependency "OkayCam", "1.1.8"
26
26
  end
27
27
 
28
28