react-native-okaycam 1.1.11 → 1.1.21
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/android/.DS_Store +0 -0
- package/android/.gradle/6.8/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.8/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/6.8/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.8/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.8/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.8/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/.gitignore +3 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +8 -4
- package/android/.idea/jarRepositories.xml +35 -0
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_core_core_1_3_1_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__com_caverock_androidsvg_aar_1_4_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_0_8_1_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_0_8_1_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_0_8_1_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_0_8_1_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp_0_8_1_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_20_1_aar.xml +19 -0
- package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_2_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_okhttp_1_2_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_2_3.xml +13 -0
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml +13 -0
- package/android/.idea/libraries/Gradle__com_innov8tif_okaycam_OkayCam_1_1_8_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_parse_bolts_bolts_android_1_1_4.xml +13 -0
- package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_5_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_ws_2_5_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_6_0.xml +13 -0
- package/android/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml +13 -0
- package/android/.idea/libraries/Gradle__junit_junit_4_10.xml +13 -0
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml +11 -0
- package/android/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml +13 -0
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_21.xml +13 -0
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_21.xml +13 -0
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_21.xml +13 -0
- package/android/.idea/libraries/Gradle__org_webkit_android_jsc_r174650_aar.xml +11 -0
- package/android/.idea/misc.xml +1 -1
- package/android/.idea/modules/android.iml +93 -6
- package/android/build/generated/source/buildConfig/debug/com/innov8tif/RNOkayCam/BuildConfig.java +12 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +11 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +27 -0
- package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/android/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +3230 -0
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/classes/com/innov8tif/RNOkayCam/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/innov8tif/RNOkayCam/RNOkayCamModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/innov8tif/RNOkayCam/RNOkayCamPackage.class +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +11 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +13 -0
- package/android/build/intermediates/merged_java_res/debug/out.jar +0 -0
- package/android/build/intermediates/merged_manifests/debug/output.json +27 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +2248 -0
- package/android/build/outputs/aar/android-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +37 -0
- package/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +6 -0
- package/android/build.gradle +13 -5
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/android/gradle.properties +2 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/java/com/innov8tif/RNOkayCam/RNOkayCamModule.java +347 -248
- package/index.ts +182 -152
- package/ios/RNOkayCam.swift +41 -0
- package/ios/RNOkayCam.xcodeproj/project.pbxproj +55 -2
- package/ios/RNOkayCam.xcodeproj/xcuserdata/thet.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/ios/RNOkayCam.xcworkspace/contents.xcworkspacedata +3 -0
- package/ios/RNOkayCam.xcworkspace/xcuserdata/thet.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/package.json +1 -1
- package/react-native-okaycam.podspec +1 -1
- package/android/.idea/workspace.xml +0 -44
package/index.ts
CHANGED
|
@@ -1,204 +1,234 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
16
32
|
}
|
|
17
33
|
|
|
18
34
|
interface Frame {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
size: FrameSize;
|
|
36
|
+
color: string;
|
|
37
|
+
content: ImageResolvedAssetSource;
|
|
22
38
|
}
|
|
23
39
|
|
|
24
40
|
interface TimerConfig {
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
backgroundColor: string;
|
|
42
|
+
textColor: string;
|
|
27
43
|
}
|
|
28
44
|
|
|
29
45
|
interface OkayCamBtnConfig {
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
backgroundColor: string;
|
|
47
|
+
contentColor: string;
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
interface CaptureConfig {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
delay: number;
|
|
52
|
+
onFlash: Boolean;
|
|
53
|
+
outputPath?: string;
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
interface SwitchBtnConfig {
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
69
|
+
text: "",
|
|
70
|
+
color: defaultColor,
|
|
71
|
+
size: 20,
|
|
72
|
+
};
|
|
57
73
|
|
|
58
74
|
const defaultFrame: Frame = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
84
|
+
backgroundColor: defaultColor2,
|
|
85
|
+
textColor: defaultColor,
|
|
86
|
+
};
|
|
71
87
|
|
|
72
88
|
const okayCamBtnConfig: OkayCamBtnConfig = {
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
189
|
+
show: true,
|
|
190
|
+
color: defaultColor,
|
|
191
|
+
};
|
|
162
192
|
|
|
163
|
-
const cameraFacing: cameraFacingType =
|
|
193
|
+
const cameraFacing: cameraFacingType = "front";
|
|
164
194
|
|
|
165
195
|
// call native capture selfie
|
|
166
196
|
export const captureSelfie = (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
};
|
package/ios/RNOkayCam.swift
CHANGED
|
@@ -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,
|
|
@@ -158,6 +164,41 @@ class RNOkayCam: NSObject {
|
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
|
|
167
|
+
func getOkaycamPreview(previewConfig: NSDictionary?) -> OkayCamPreviewConfig?{
|
|
168
|
+
if previewConfig == nil { return nil}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
let title = configToOkayCamLabel(config: previewConfig?.object(forKey: "title") as! NSDictionary)
|
|
172
|
+
|
|
173
|
+
let instr1 = configToOkayCamLabel(config: previewConfig?.object(forKey: "instruction1") as! NSDictionary)
|
|
174
|
+
|
|
175
|
+
let instr2 = configToOkayCamLabel(config: previewConfig?.object(forKey: "instruction2") as! NSDictionary)
|
|
176
|
+
|
|
177
|
+
let instr3 = configToOkayCamLabel(config: previewConfig?.object(forKey: "instruction3") as! NSDictionary)
|
|
178
|
+
|
|
179
|
+
let bgColor = self.hexStringToUIColor(hex: previewConfig?.object(forKey: "backgroundColor") as! String)
|
|
180
|
+
|
|
181
|
+
// frame contet
|
|
182
|
+
let ref = previewConfig?.object(forKey: "refImage") as? String
|
|
183
|
+
var refUrl:URL? = nil
|
|
184
|
+
if (ref != nil) {
|
|
185
|
+
#if DEBUG
|
|
186
|
+
refUrl = URL(string: ref!)!
|
|
187
|
+
#else
|
|
188
|
+
refUrl = URL(fileURLWithPath: ref!.replacingOccurrences(of: "file:///", with: ""))
|
|
189
|
+
#endif
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return OkayCamPreviewConfig(title: title, refImage: refUrl!, instruction1: instr1, instruction2: instr2, instruction3: instr3, backgroundColor: bgColor)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
func configToOkayCamLabel(config:NSDictionary) -> OkayCamLabelConfig{
|
|
196
|
+
let text = config.object(forKey: "text") as! String
|
|
197
|
+
let color = self.hexStringToUIColor(hex: config.object(forKey: "color") as! String)
|
|
198
|
+
let size = CGFloat(config.object(forKey: "size") as! Int)
|
|
199
|
+
return OkayCamLabelConfig(text: text, color: color, size: size)
|
|
200
|
+
}
|
|
201
|
+
|
|
161
202
|
@objc func captureSelfie(_ configs: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
162
203
|
|
|
163
204
|
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 =
|
|
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 =
|
|
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 = (
|
package/ios/RNOkayCam.xcworkspace/xcuserdata/thet.xcuserdatad/UserInterfaceState.xcuserstate
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="dcd03e48-895c-4531-9c6b-999b4eb29984" name="Default Changelist" comment="" />
|
|
5
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
6
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
|
-
</component>
|
|
10
|
-
<component name="Git.Settings">
|
|
11
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
|
12
|
-
</component>
|
|
13
|
-
<component name="ProjectId" id="20OnRh4fdjMjOrINVhdGIVlXNLA" />
|
|
14
|
-
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
|
15
|
-
<component name="ProjectViewState">
|
|
16
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
|
17
|
-
<option name="showLibraryContents" value="true" />
|
|
18
|
-
</component>
|
|
19
|
-
<component name="PropertiesComponent">
|
|
20
|
-
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
21
|
-
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
|
22
|
-
<property name="android.sdk.path" value="$USER_HOME$/Library/Android/sdk" />
|
|
23
|
-
<property name="settings.editor.selected.configurable" value="AndroidSdkUpdater" />
|
|
24
|
-
</component>
|
|
25
|
-
<component name="SvnConfiguration">
|
|
26
|
-
<configuration />
|
|
27
|
-
</component>
|
|
28
|
-
<component name="TaskManager">
|
|
29
|
-
<task active="true" id="Default" summary="Default task">
|
|
30
|
-
<changelist id="dcd03e48-895c-4531-9c6b-999b4eb29984" name="Default Changelist" comment="" />
|
|
31
|
-
<created>1635924494769</created>
|
|
32
|
-
<option name="number" value="Default" />
|
|
33
|
-
<option name="presentableId" value="Default" />
|
|
34
|
-
<updated>1635924494769</updated>
|
|
35
|
-
</task>
|
|
36
|
-
<servers />
|
|
37
|
-
</component>
|
|
38
|
-
<component name="WindowStateProjectService">
|
|
39
|
-
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup" timestamp="1635924730612">
|
|
40
|
-
<screen x="0" y="0" width="1440" height="900" />
|
|
41
|
-
</state>
|
|
42
|
-
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup/0.0.1440.900@0.0.1440.900" timestamp="1635924730612" />
|
|
43
|
-
</component>
|
|
44
|
-
</project>
|