@regulaforensics/face-sdk 7.2.422-beta → 7.2.425-beta
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 +2 -3
- package/RNFaceSDK.podspec +1 -1
- package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +2 -0
- package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +18 -0
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
- package/examples/capacitor/index.html +2 -7
- package/examples/capacitor/index.tsx +53 -0
- package/examples/capacitor/package-lock.json +17 -3
- package/examples/capacitor/package.json +2 -2
- package/examples/capacitor/scripts/setup.sh +4 -2
- package/examples/capacitor/src/main.css +60 -6
- package/examples/capacitor/src/main.html +1 -1
- package/examples/capacitor/src/main.tsx +51 -87
- package/examples/ionic/README.md +1 -1
- package/examples/ionic/angular.json +3 -3
- package/examples/ionic/config.xml +4 -2
- package/examples/ionic/index.tsx +68 -0
- package/examples/ionic/package-lock.json +849 -763
- package/examples/ionic/package.json +2 -2
- package/examples/ionic/src/main.css +60 -6
- package/examples/ionic/src/main.html +1 -1
- package/examples/ionic/src/{main.ts → main.tsx} +52 -97
- package/examples/ionic/tsconfig.json +3 -2
- package/examples/react_native/README.md +1 -0
- package/examples/react_native/app.config.ts +1 -1
- package/examples/react_native/index.tsx +49 -7
- package/examples/react_native/package-lock.json +618 -621
- package/examples/react_native/package.json +8 -8
- package/examples/react_native/src/main.css +60 -6
- package/examples/react_native/src/main.html +1 -1
- package/examples/react_native/src/main.tsx +54 -79
- package/ios/RFSWJSONConstructor.h +0 -1
- package/ios/RFSWJSONConstructor.m +5 -14
- package/ios/RFSWMain.m +30 -0
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/test/json.tsx +375 -0
- package/test/package-lock.json +584 -0
- package/test/package.json +9 -0
- package/test/test.tsx +61 -0
- package/test/utils.tsx +38 -0
- package/www/capacitor/customization/customization_fonts.js +1 -1
- package/www/capacitor/customization/customization_images.js +1 -1
- package/www/capacitor/customization/font.js +8 -0
- package/www/capacitor/detect_faces/detect_face_result.js +12 -0
- package/www/capacitor/detect_faces/detect_faces_attribute_result.js +9 -0
- package/www/capacitor/detect_faces/detect_faces_backend_exception.js +7 -0
- package/www/capacitor/detect_faces/detect_faces_config.js +34 -0
- package/www/capacitor/detect_faces/detect_faces_exception.js +8 -0
- package/www/capacitor/detect_faces/detect_faces_request.js +22 -0
- package/www/capacitor/detect_faces/detect_faces_response.js +9 -0
- package/www/capacitor/face_capture/face_capture_config.js +37 -0
- package/www/capacitor/face_capture/face_capture_exception.js +7 -0
- package/www/capacitor/face_capture/face_capture_image.js +8 -0
- package/www/capacitor/face_capture/face_capture_response.js +7 -0
- package/www/capacitor/image_params/output_image_crop.js +23 -0
- package/www/capacitor/image_params/output_image_params.js +19 -0
- package/www/capacitor/image_params/point.js +7 -0
- package/www/capacitor/image_params/rect.js +9 -0
- package/www/capacitor/image_params/size.js +12 -0
- package/www/capacitor/image_quality/image_quality_characteristic.js +22 -0
- package/www/capacitor/image_quality/image_quality_range.js +7 -0
- package/www/capacitor/image_quality/image_quality_result.js +10 -0
- package/www/capacitor/index.js +48 -0
- package/www/capacitor/init/face_sdk_version.js +8 -0
- package/www/capacitor/init/init_config.js +19 -0
- package/www/capacitor/init/init_exception.js +8 -0
- package/www/capacitor/init/license_exception.js +7 -0
- package/www/capacitor/internal/bridge.js +20 -1
- package/www/capacitor/liveness/liveness_backend_exception.js +7 -0
- package/www/capacitor/liveness/liveness_config.js +43 -0
- package/www/capacitor/liveness/liveness_exception.js +8 -0
- package/www/capacitor/liveness/liveness_notification.js +7 -0
- package/www/capacitor/liveness/liveness_response.js +11 -0
- package/www/capacitor/match_faces/compared_face.js +9 -0
- package/www/capacitor/match_faces/compared_faces_pair.js +10 -0
- package/www/capacitor/match_faces/compared_faces_split.js +7 -0
- package/www/capacitor/match_faces/match_faces_backend_exception.js +7 -0
- package/www/capacitor/match_faces/match_faces_config.js +19 -0
- package/www/capacitor/match_faces/match_faces_detection.js +9 -0
- package/www/capacitor/match_faces/match_faces_detection_face.js +11 -0
- package/www/capacitor/match_faces/match_faces_exception.js +8 -0
- package/www/capacitor/match_faces/match_faces_image.js +9 -0
- package/www/capacitor/match_faces/match_faces_request.js +27 -0
- package/www/capacitor/match_faces/match_faces_response.js +9 -0
- package/www/capacitor/person_database/edit_group_persons_request.js +15 -0
- package/www/capacitor/person_database/image_upload.js +17 -0
- package/www/capacitor/person_database/pageable_item_list.js +8 -0
- package/www/capacitor/person_database/person.js +13 -0
- package/www/capacitor/person_database/person_group.js +11 -0
- package/www/capacitor/person_database/person_image.js +13 -0
- package/www/capacitor/person_database/search_person.js +14 -0
- package/www/capacitor/person_database/search_person_detection.js +9 -0
- package/www/capacitor/person_database/search_person_image.js +15 -0
- package/www/capacitor/person_database/search_person_request.js +29 -0
- package/www/cordova.js +753 -6
- package/www/react-native/customization/customization_fonts.js +1 -1
- package/www/react-native/customization/customization_images.js +1 -1
- package/www/react-native/customization/font.js +8 -0
- package/www/react-native/detect_faces/detect_face_result.js +12 -0
- package/www/react-native/detect_faces/detect_faces_attribute_result.js +9 -0
- package/www/react-native/detect_faces/detect_faces_backend_exception.js +7 -0
- package/www/react-native/detect_faces/detect_faces_config.js +34 -0
- package/www/react-native/detect_faces/detect_faces_exception.js +8 -0
- package/www/react-native/detect_faces/detect_faces_request.js +22 -0
- package/www/react-native/detect_faces/detect_faces_response.js +9 -0
- package/www/react-native/face_capture/face_capture_config.js +37 -0
- package/www/react-native/face_capture/face_capture_exception.js +7 -0
- package/www/react-native/face_capture/face_capture_image.js +8 -0
- package/www/react-native/face_capture/face_capture_response.js +7 -0
- package/www/react-native/image_params/output_image_crop.js +23 -0
- package/www/react-native/image_params/output_image_params.js +19 -0
- package/www/react-native/image_params/point.js +7 -0
- package/www/react-native/image_params/rect.js +9 -0
- package/www/react-native/image_params/size.js +12 -0
- package/www/react-native/image_quality/image_quality_characteristic.js +22 -0
- package/www/react-native/image_quality/image_quality_range.js +7 -0
- package/www/react-native/image_quality/image_quality_result.js +10 -0
- package/www/react-native/index.js +48 -0
- package/www/react-native/init/face_sdk_version.js +8 -0
- package/www/react-native/init/init_config.js +19 -0
- package/www/react-native/init/init_exception.js +8 -0
- package/www/react-native/init/license_exception.js +7 -0
- package/www/react-native/internal/bridge.js +20 -1
- package/www/react-native/liveness/liveness_backend_exception.js +7 -0
- package/www/react-native/liveness/liveness_config.js +43 -0
- package/www/react-native/liveness/liveness_exception.js +8 -0
- package/www/react-native/liveness/liveness_notification.js +7 -0
- package/www/react-native/liveness/liveness_response.js +11 -0
- package/www/react-native/match_faces/compared_face.js +9 -0
- package/www/react-native/match_faces/compared_faces_pair.js +10 -0
- package/www/react-native/match_faces/compared_faces_split.js +7 -0
- package/www/react-native/match_faces/match_faces_backend_exception.js +7 -0
- package/www/react-native/match_faces/match_faces_config.js +19 -0
- package/www/react-native/match_faces/match_faces_detection.js +9 -0
- package/www/react-native/match_faces/match_faces_detection_face.js +11 -0
- package/www/react-native/match_faces/match_faces_exception.js +8 -0
- package/www/react-native/match_faces/match_faces_image.js +9 -0
- package/www/react-native/match_faces/match_faces_request.js +27 -0
- package/www/react-native/match_faces/match_faces_response.js +9 -0
- package/www/react-native/person_database/edit_group_persons_request.js +15 -0
- package/www/react-native/person_database/image_upload.js +17 -0
- package/www/react-native/person_database/pageable_item_list.js +8 -0
- package/www/react-native/person_database/person.js +13 -0
- package/www/react-native/person_database/person_group.js +11 -0
- package/www/react-native/person_database/person_image.js +13 -0
- package/www/react-native/person_database/search_person.js +14 -0
- package/www/react-native/person_database/search_person_detection.js +9 -0
- package/www/react-native/person_database/search_person_image.js +15 -0
- package/www/react-native/person_database/search_person_request.js +29 -0
- package/www/types/index.d.ts +12 -0
- package/www/types/match_faces/match_faces_config.d.ts +2 -0
- package/www/types/person_database/search_person_request.d.ts +4 -0
- package/examples/cordova/.vscode/launch.json +0 -28
- package/examples/cordova/README.md +0 -25
- package/examples/cordova/config.xml +0 -26
- package/examples/cordova/package-lock.json +0 -1313
- package/examples/cordova/package.json +0 -30
- package/examples/cordova/scripts/android.sh +0 -8
- package/examples/cordova/scripts/ios.sh +0 -8
- package/examples/cordova/scripts/setup.sh +0 -8
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/index.html +0 -21
- package/examples/cordova/www/src/main.css +0 -83
- package/examples/cordova/www/src/main.html +0 -25
- package/examples/cordova/www/src/main.js +0 -152
- package/examples/ionic/index.ts +0 -17
- package/examples/ionic/src/images/portrait.png +0 -0
- /package/examples/ionic/{src/assets → assets}/.gitkeep +0 -0
- /package/examples/ionic/{src/images → images}/icon.png +0 -0
- /package/examples/{cordova/www → ionic}/images/portrait.png +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# Regula Face SDK plugin
|
|
2
2
|
Face SDK is a framework that is used for face matching, recognition and liveness detection.
|
|
3
|
-
This plugin makes possible to use it with react-native, cordova and
|
|
3
|
+
This plugin makes possible to use it with react-native, cordova and capacitor applications.
|
|
4
4
|
|
|
5
5
|
## Demo applications
|
|
6
|
-
In the [examples](examples/) folder you can find
|
|
6
|
+
In the [examples](examples/) folder you can find 3 demo applications:
|
|
7
7
|
* [React-native](examples/react_native)
|
|
8
|
-
* [Cordova](examples/cordova)
|
|
9
8
|
* [Ionic(ionic app with cordova, angular)](examples/ionic)
|
|
10
9
|
* [Capacitor(ionic app with capacitor, react)](examples/capacitor)
|
|
11
10
|
|
package/RNFaceSDK.podspec
CHANGED
|
@@ -833,6 +833,7 @@ fun searchPersonRequestFromJSON(it: JSONObject) = object : SearchPersonRequest()
|
|
|
833
833
|
groupIdsForSearch = it.getJSONArrayOrNull("groupIdsForSearch").toArray()
|
|
834
834
|
threshold = it.getDoubleOrNull("threshold")?.toFloat()
|
|
835
835
|
limit = it.getIntOrNull("limit")
|
|
836
|
+
tag = it.getStringOrNull("tag")
|
|
836
837
|
imageUpload = imageUploadFromJSON(it.getJSONObjectOrNull("imageUpload"))
|
|
837
838
|
isDetectAll = it.optBoolean("detectAll", false)
|
|
838
839
|
outputImageParams = outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
|
|
@@ -843,6 +844,7 @@ fun generateSearchPersonRequest(it: SearchPersonRequest) = mapOf(
|
|
|
843
844
|
"groupIdsForSearch" to it.groupIdsForSearch.toJson(),
|
|
844
845
|
"threshold" to it.threshold,
|
|
845
846
|
"limit" to it.limit,
|
|
847
|
+
"tag" to it.tag,
|
|
846
848
|
"imageUpload" to generateImageUpload(it.imageUpload),
|
|
847
849
|
"detectAll" to it.isDetectAll,
|
|
848
850
|
"outputImageParams" to generateOutputImageParams(it.outputImageParams)
|
|
@@ -30,6 +30,12 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
|
30
30
|
"getVersion" -> getVersion(callback)
|
|
31
31
|
"getServiceUrl" -> getServiceUrl(callback)
|
|
32
32
|
"setServiceUrl" -> setServiceUrl(argsNullable(0))
|
|
33
|
+
"getTenant" -> getTenant(callback)
|
|
34
|
+
"setTenant" -> setTenant(argsNullable(0))
|
|
35
|
+
"getEnv" -> getEnv(callback)
|
|
36
|
+
"setEnv" -> setEnv(argsNullable(0))
|
|
37
|
+
"getLocale" -> getLocale(callback)
|
|
38
|
+
"setLocale" -> setLocale(argsNullable(0))
|
|
33
39
|
"setLocalizationDictionary" -> setLocalizationDictionary(args(0))
|
|
34
40
|
"setRequestHeaders" -> setRequestHeaders(args(0))
|
|
35
41
|
"setCustomization" -> setCustomization(args(0))
|
|
@@ -81,6 +87,18 @@ fun getServiceUrl(callback: Callback) = callback(Instance().serviceUrl)
|
|
|
81
87
|
|
|
82
88
|
fun setServiceUrl(url: String?) = url.let { Instance().serviceUrl = it }
|
|
83
89
|
|
|
90
|
+
fun getTenant(callback: Callback) = callback(Instance().tenant)
|
|
91
|
+
|
|
92
|
+
fun setTenant(tag: String?) = tag.let { Instance().tenant = it }
|
|
93
|
+
|
|
94
|
+
fun getEnv(callback: Callback) = callback(Instance().env)
|
|
95
|
+
|
|
96
|
+
fun setEnv(tag: String?) = tag.let { Instance().env = it }
|
|
97
|
+
|
|
98
|
+
fun getLocale(callback: Callback) = callback(Instance().locale)
|
|
99
|
+
|
|
100
|
+
fun setLocale(locale: String?) = locale.let { Instance().locale = it }
|
|
101
|
+
|
|
84
102
|
fun setLocalizationDictionary(dictionary: JSONObject) {
|
|
85
103
|
localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
|
|
86
104
|
Instance().setLocalizationCallback(localizationCallbacks!!)
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
<action android:name="android.intent.action.MAIN" />
|
|
19
19
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
20
20
|
</intent-filter>
|
|
21
|
-
|
|
22
21
|
</activity>
|
|
23
22
|
</application>
|
|
23
|
+
|
|
24
24
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
25
|
-
</manifest>
|
|
25
|
+
</manifest>
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
2
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
3
|
-
|
|
4
2
|
<div id="content" style="height: 100%"></div>
|
|
5
3
|
|
|
6
|
-
<script>
|
|
7
|
-
|
|
8
|
-
.then(response => response.text())
|
|
9
|
-
.then(html => document.getElementById("content").innerHTML = html)
|
|
10
|
-
</script>
|
|
4
|
+
<script type="module" src="./index.tsx"></script>
|
|
5
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import '@ionic/react/css/core.css'
|
|
2
|
+
import '/src/main.css'
|
|
3
|
+
import { setupIonicReact } from '@ionic/react'
|
|
4
|
+
import { StatusBar, Style } from '@capacitor/status-bar'
|
|
5
|
+
import { File } from '@awesome-cordova-plugins/file'
|
|
6
|
+
import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
|
|
7
|
+
import { main } from './src/main'
|
|
8
|
+
import { Dialog } from '@capacitor/dialog'
|
|
9
|
+
|
|
10
|
+
document.addEventListener('deviceready', () => fetch("main.html")
|
|
11
|
+
.then(response => response.text())
|
|
12
|
+
.then(html => document.getElementById("content").innerHTML = html)
|
|
13
|
+
.then(_ => document.dispatchEvent(new Event('ready')))
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
export async function loadAssetIfExists(path: string): Promise<string | null> {
|
|
17
|
+
try {
|
|
18
|
+
var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "public/assets")
|
|
19
|
+
var fileEntry = await File.getFile(dir, path, null)
|
|
20
|
+
var result = await new Promise<string | null>((resolve, _) => {
|
|
21
|
+
fileEntry.file(file => {
|
|
22
|
+
var reader = new FileReader()
|
|
23
|
+
reader.onloadend = (_) => resolve(reader.result as string)
|
|
24
|
+
reader.readAsDataURL(file)
|
|
25
|
+
}, _ => resolve(null))
|
|
26
|
+
})
|
|
27
|
+
return result
|
|
28
|
+
} catch (_) {
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function pickImage(): Promise<string | null> {
|
|
34
|
+
return await Camera.getPicture({
|
|
35
|
+
destinationType: DestinationType.DATA_URL,
|
|
36
|
+
mediaType: MediaType.PICTURE,
|
|
37
|
+
sourceType: PictureSourceType.PHOTOLIBRARY
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function chooseOption(): Promise<boolean | null> {
|
|
42
|
+
var response = await Dialog.confirm({
|
|
43
|
+
message: "Select option",
|
|
44
|
+
okButtonTitle: "Use camera",
|
|
45
|
+
cancelButtonTitle: "Use gallery"
|
|
46
|
+
})
|
|
47
|
+
return response.value
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
document.addEventListener('ready', main)
|
|
51
|
+
|
|
52
|
+
setupIonicReact()
|
|
53
|
+
StatusBar.setStyle({ style: Style.Light })
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"@capacitor/ios": "7.0.1",
|
|
17
17
|
"@capacitor/status-bar": "7.0.0",
|
|
18
18
|
"@ionic/react": "8.4.3",
|
|
19
|
+
"@regulaforensics/face-core-basic": "7.1.178",
|
|
20
|
+
"@regulaforensics/face-sdk": "7.1.317",
|
|
19
21
|
"@types/react-router-dom": "5.3.3",
|
|
20
22
|
"@vitejs/plugin-react": "4.3.4",
|
|
21
23
|
"cordova-plugin-camera": "8.0.0",
|
|
@@ -1202,6 +1204,18 @@
|
|
|
1202
1204
|
"node": ">= 8"
|
|
1203
1205
|
}
|
|
1204
1206
|
},
|
|
1207
|
+
"node_modules/@regulaforensics/face-core-basic": {
|
|
1208
|
+
"version": "7.1.178",
|
|
1209
|
+
"resolved": "https://registry.npmjs.org/@regulaforensics/face-core-basic/-/face-core-basic-7.1.178.tgz",
|
|
1210
|
+
"integrity": "sha512-KfVME7fPy3vOMKM5g/79Yiz6enWvhxL/nw6B9HKkMpE1uKYgXUa3DWgs4m5EMiqH7jmJ3bmxekkDUFwer6j3pw==",
|
|
1211
|
+
"license": "commercial"
|
|
1212
|
+
},
|
|
1213
|
+
"node_modules/@regulaforensics/face-sdk": {
|
|
1214
|
+
"version": "7.1.317",
|
|
1215
|
+
"resolved": "https://registry.npmjs.org/@regulaforensics/face-sdk/-/face-sdk-7.1.317.tgz",
|
|
1216
|
+
"integrity": "sha512-RtZ4vOlVfcisVcD86rEYbnxPyUjVW2cKwG45oUBGE43UJYAuoYdwdUdfOWoQqwNAsk5Aehp/8EsMwc6e775h3Q==",
|
|
1217
|
+
"license": "commercial"
|
|
1218
|
+
},
|
|
1205
1219
|
"node_modules/@rollup/rollup-android-arm-eabi": {
|
|
1206
1220
|
"version": "4.40.2",
|
|
1207
1221
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.2.tgz",
|
|
@@ -1764,9 +1778,9 @@
|
|
|
1764
1778
|
}
|
|
1765
1779
|
},
|
|
1766
1780
|
"node_modules/brace-expansion": {
|
|
1767
|
-
"version": "2.0.
|
|
1768
|
-
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.
|
|
1769
|
-
"integrity": "sha512-
|
|
1781
|
+
"version": "2.0.2",
|
|
1782
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
|
1783
|
+
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
|
1770
1784
|
"license": "MIT",
|
|
1771
1785
|
"dependencies": {
|
|
1772
1786
|
"balanced-match": "^1.0.0"
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
"android": "scripts/android.sh"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@regulaforensics/face-sdk": "7.2.
|
|
9
|
+
"@regulaforensics/face-sdk": "7.2.425-beta",
|
|
10
10
|
"@regulaforensics/face-core-basic": "7.1.202",
|
|
11
11
|
"@awesome-cordova-plugins/file": "6.6.0",
|
|
12
12
|
"@awesome-cordova-plugins/camera": "6.6.0",
|
|
13
13
|
"cordova-plugin-file": "8.1.3",
|
|
14
14
|
"cordova-plugin-camera": "8.0.0",
|
|
15
|
-
"@capacitor/dialog": "7.0.1",
|
|
16
15
|
"@capacitor/cli": "7.0.1",
|
|
17
16
|
"@capacitor/core": "7.0.1",
|
|
18
17
|
"@capacitor/app": "7.0.0",
|
|
19
18
|
"@capacitor/ios": "7.0.1",
|
|
20
19
|
"@capacitor/android": "7.0.1",
|
|
21
20
|
"@capacitor/status-bar": "7.0.0",
|
|
21
|
+
"@capacitor/dialog": "7.0.1",
|
|
22
22
|
"@ionic/react": "8.4.3",
|
|
23
23
|
"@vitejs/plugin-react": "4.3.4",
|
|
24
24
|
"vite-plugin-static-copy": "2.3.1",
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
html,
|
|
2
2
|
body {
|
|
3
|
-
|
|
3
|
+
margin: 0;
|
|
4
|
+
width: 100%;
|
|
4
5
|
height: 99vh;
|
|
5
6
|
display: flex;
|
|
7
|
+
overflow: hidden;
|
|
6
8
|
flex-direction: column;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/* Prevent text selection */
|
|
12
|
+
* {
|
|
13
|
+
user-select: none !important;
|
|
14
|
+
-webkit-user-select: none !important;
|
|
15
|
+
-webkit-user-drag: none !important;
|
|
16
|
+
-webkit-touch-callout: none !important;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
.column {
|
|
@@ -52,10 +56,14 @@ body {
|
|
|
52
56
|
margin-top: 13px;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
.scroll {
|
|
60
|
+
flex-grow: 1;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
.no-scroll {
|
|
56
65
|
flex-grow: 1;
|
|
57
66
|
overflow-y: hidden;
|
|
58
|
-
overflow-x: hidden;
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
.button {
|
|
@@ -67,6 +75,7 @@ body {
|
|
|
67
75
|
color: white;
|
|
68
76
|
border: none;
|
|
69
77
|
padding: 10px 20px;
|
|
78
|
+
justify-content: center;
|
|
70
79
|
font-size: 16px;
|
|
71
80
|
border-radius: 100px;
|
|
72
81
|
cursor: pointer;
|
|
@@ -80,4 +89,49 @@ body {
|
|
|
80
89
|
.button:active {
|
|
81
90
|
position: relative;
|
|
82
91
|
top: 1px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.text-button {
|
|
95
|
+
background: none;
|
|
96
|
+
border: none;
|
|
97
|
+
color: #2196f3;
|
|
98
|
+
font-size: 20px;
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
padding: 5px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.text-button:active {
|
|
104
|
+
position: relative;
|
|
105
|
+
top: 1px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.radio {
|
|
109
|
+
align-items: baseline;
|
|
110
|
+
padding: 15px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
input[type="checkbox"] {
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
border: 2px solid black;
|
|
117
|
+
background-color: white;
|
|
118
|
+
display: inline-block;
|
|
119
|
+
position: relative;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.progress-bar {
|
|
124
|
+
width: 75%;
|
|
125
|
+
padding: 3px;
|
|
126
|
+
margin-top: 40px;
|
|
127
|
+
background-color: #eee;
|
|
128
|
+
border-radius: 8px;
|
|
129
|
+
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#progress {
|
|
133
|
+
width: 0%;
|
|
134
|
+
height: 20px;
|
|
135
|
+
background-color: #4285F4;
|
|
136
|
+
border-radius: 5px;
|
|
83
137
|
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import '@ionic/react/css/core.css'
|
|
2
|
-
import './main.css'
|
|
3
|
-
import { setupIonicReact } from '@ionic/react'
|
|
4
|
-
import { StatusBar, Style } from '@capacitor/status-bar'
|
|
5
|
-
import { File } from '@awesome-cordova-plugins/file'
|
|
6
|
-
import { Dialog } from '@capacitor/dialog'
|
|
7
|
-
import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
|
|
8
1
|
import { FaceSDK, MatchFacesRequest, MatchFacesImage, InitConfig, LivenessSkipStep, ImageType, LivenessStatus, LivenessConfig } from '@regulaforensics/face-sdk'
|
|
2
|
+
import { loadAssetIfExists, chooseOption, pickImage } from '../index'
|
|
3
|
+
|
|
4
|
+
var faceSdk = FaceSDK.instance
|
|
5
|
+
var image1: MatchFacesImage | null
|
|
6
|
+
var image2: MatchFacesImage | null
|
|
9
7
|
|
|
10
8
|
async function init() {
|
|
11
9
|
if (!await initializeReader()) return
|
|
12
10
|
setStatus("Ready")
|
|
13
11
|
}
|
|
14
12
|
|
|
13
|
+
async function startFaceCapture(position: number) {
|
|
14
|
+
var image = (await faceSdk.startFaceCapture()).image
|
|
15
|
+
if (image == null) return
|
|
16
|
+
setImage("data:image/png;base64," + image.image, image.imageType, position)
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
async function startLiveness() {
|
|
16
20
|
var response = await faceSdk.startLiveness({
|
|
17
21
|
config: new LivenessConfig({
|
|
@@ -42,30 +46,15 @@ async function matchFaces() {
|
|
|
42
46
|
setStatus("Ready")
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// If 'regula.license' exists, init using license(enables offline match)
|
|
55
|
-
// otherwise init without license.
|
|
56
|
-
async function initializeReader() {
|
|
57
|
-
setStatus("Initializing...")
|
|
58
|
-
|
|
59
|
-
var license = await loadAssetIfExists("regula.license")
|
|
60
|
-
var config: InitConfig | undefined
|
|
61
|
-
if (license != null) config = new InitConfig(license)
|
|
62
|
-
var [success, error] = await faceSdk.initialize({ config: config })
|
|
63
|
-
|
|
64
|
-
if (!success && error != null) {
|
|
65
|
-
setStatus(error.message)
|
|
66
|
-
console.log(error.code + ": " + error.message)
|
|
49
|
+
async function getImage(position: number) {
|
|
50
|
+
var source = await chooseOption()
|
|
51
|
+
if (source == null) return
|
|
52
|
+
if (source) startFaceCapture(position)
|
|
53
|
+
else {
|
|
54
|
+
var image = await pickImage()
|
|
55
|
+
if (image == null) return
|
|
56
|
+
setImage(image, ImageType.PRINTED, position)
|
|
67
57
|
}
|
|
68
|
-
return success
|
|
69
58
|
}
|
|
70
59
|
|
|
71
60
|
function setImage(base64: string, type: number, position: number) {
|
|
@@ -82,71 +71,46 @@ function setImage(base64: string, type: number, position: number) {
|
|
|
82
71
|
}
|
|
83
72
|
}
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
setImage("data:image/png;base64," + image.image, image.imageType, position)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function useGallery(position: number) {
|
|
93
|
-
var image = await Camera.getPicture({
|
|
94
|
-
destinationType: DestinationType.DATA_URL,
|
|
95
|
-
mediaType: MediaType.PICTURE,
|
|
96
|
-
sourceType: PictureSourceType.PHOTOLIBRARY
|
|
97
|
-
})
|
|
98
|
-
setImage(image, ImageType.PRINTED, position)
|
|
99
|
-
}
|
|
74
|
+
// If 'regula.license' exists, init using license(enables offline match)
|
|
75
|
+
// otherwise init without license.
|
|
76
|
+
async function initializeReader() {
|
|
77
|
+
setStatus("Initializing...")
|
|
100
78
|
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
cancelButtonTitle: "Use gallery"
|
|
106
|
-
})
|
|
107
|
-
if (response.value) useCamera(position)
|
|
108
|
-
else useGallery(position)
|
|
109
|
-
}
|
|
79
|
+
var license = await loadAssetIfExists("regula.license")
|
|
80
|
+
var config: InitConfig | undefined
|
|
81
|
+
if (license != null) config = new InitConfig(license)
|
|
82
|
+
var [success, error] = await faceSdk.initialize({ config: config })
|
|
110
83
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var fileEntry = await File.getFile(dir, path, null)
|
|
115
|
-
var result = await new Promise<string | null>((resolve, _) => {
|
|
116
|
-
fileEntry.file(file => {
|
|
117
|
-
var reader = new FileReader()
|
|
118
|
-
reader.onloadend = (_) => resolve(reader.result as string)
|
|
119
|
-
reader.readAsDataURL(file)
|
|
120
|
-
}, _ => resolve(null))
|
|
121
|
-
})
|
|
122
|
-
return result
|
|
123
|
-
} catch (_) {
|
|
124
|
-
return null
|
|
84
|
+
if (error != null) {
|
|
85
|
+
setStatus(error.message)
|
|
86
|
+
console.log(error.code + ": " + error.message)
|
|
125
87
|
}
|
|
88
|
+
return success
|
|
126
89
|
}
|
|
127
90
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
91
|
+
// --------------------------------------------------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
export function main() {
|
|
94
|
+
document.getElementById("first-image")!.onclick = () => getImage(1)
|
|
95
|
+
document.getElementById("second-image")!.onclick = () => getImage(2)
|
|
96
|
+
document.getElementById("match-faces")!.onclick = () => matchFaces()
|
|
97
|
+
document.getElementById("start-liveness")!.onclick = () => startLiveness()
|
|
98
|
+
document.getElementById("clear-results")!.onclick = () => clearResults()
|
|
131
99
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
100
|
+
init()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var setStatus = (data: string) => document.getElementById("status")!.innerHTML = data
|
|
104
|
+
var setLivenessStatus = (data: string) => document.getElementById("liveness-status")!.innerHTML = data
|
|
105
|
+
var setSimilarityStatus = (data: string) => document.getElementById("similarity-status")!.innerHTML = data
|
|
135
106
|
var setUiImage1 = (data: string) => (document.getElementById("first-image") as HTMLImageElement).src = data
|
|
136
107
|
var setUiImage2 = (data: string) => (document.getElementById("second-image") as HTMLImageElement).src = data
|
|
137
|
-
var
|
|
108
|
+
var clearResults = () => {
|
|
109
|
+
setStatus("Ready")
|
|
110
|
+
setSimilarityStatus("null")
|
|
111
|
+
setLivenessStatus("null")
|
|
138
112
|
setUiImage1("images/portrait.png")
|
|
139
113
|
setUiImage2("images/portrait.png")
|
|
114
|
+
image1 = null
|
|
115
|
+
image2 = null
|
|
140
116
|
}
|
|
141
|
-
|
|
142
|
-
setupIonicReact()
|
|
143
|
-
StatusBar.setStyle({ style: Style.Light })
|
|
144
|
-
document.addEventListener('deviceready', () => {
|
|
145
|
-
document.getElementById("first-image").onclick = () => pickImage(1)
|
|
146
|
-
document.getElementById("second-image").onclick = () => pickImage(2)
|
|
147
|
-
document.getElementById("match-faces").onclick = () => matchFaces()
|
|
148
|
-
document.getElementById("start-liveness").onclick = () => startLiveness()
|
|
149
|
-
document.getElementById("clear-results").onclick = () => clearResults()
|
|
150
|
-
|
|
151
|
-
init()
|
|
152
|
-
})
|
package/examples/ionic/README.md
CHANGED
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"options": {
|
|
12
12
|
"outputPath": "www",
|
|
13
13
|
"index": "index.html",
|
|
14
|
-
"main": "index.
|
|
14
|
+
"main": "index.tsx",
|
|
15
15
|
"tsConfig": "tsconfig.json",
|
|
16
16
|
"assets": [
|
|
17
17
|
{
|
|
18
18
|
"glob": "**/*",
|
|
19
|
-
"input": "
|
|
19
|
+
"input": "assets",
|
|
20
20
|
"output": "assets"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"glob": "**/*",
|
|
24
|
-
"input": "
|
|
24
|
+
"input": "images",
|
|
25
25
|
"output": "images"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<widget android-packageName="com.regula.documentreader.api.androidtest" ios-CFBundleIdentifier="com.regula.documentreader.qa" version="1.0.0"
|
|
2
|
+
<widget android-packageName="com.regula.documentreader.api.androidtest" ios-CFBundleIdentifier="com.regula.documentreader.qa" version="1.0.0"
|
|
3
|
+
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
4
|
<name>FaceSDK</name>
|
|
4
|
-
<icon src="
|
|
5
|
+
<icon src="images/icon.png" />
|
|
5
6
|
<platform name="android">
|
|
6
7
|
<preference name="orientation" value="portrait" />
|
|
7
8
|
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
<preference name="GradlePluginKotlinEnabled" value="true" />
|
|
13
14
|
</platform>
|
|
14
15
|
<platform name="ios">
|
|
16
|
+
<preference name="deployment-target" value="14.0" />
|
|
15
17
|
<preference name="orientation" value="portrait" />
|
|
16
18
|
<allow-intent href="itms:*" />
|
|
17
19
|
<allow-intent href="itms-apps:*" />
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import 'zone.js';
|
|
2
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
|
3
|
+
import { BrowserModule } from '@angular/platform-browser'
|
|
4
|
+
import { IonicModule, Platform } from '@ionic/angular'
|
|
5
|
+
import { NgModule } from '@angular/core'
|
|
6
|
+
|
|
7
|
+
import { Component } from '@angular/core'
|
|
8
|
+
import { File } from '@awesome-cordova-plugins/file'
|
|
9
|
+
import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera/ngx'
|
|
10
|
+
import { Dialogs } from '@awesome-cordova-plugins/dialogs/ngx'
|
|
11
|
+
|
|
12
|
+
import { main } from './src/main'
|
|
13
|
+
|
|
14
|
+
export async function loadAssetIfExists(path: string): Promise<string | null> {
|
|
15
|
+
try {
|
|
16
|
+
var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "www/assets")
|
|
17
|
+
var fileEntry = await File.getFile(dir, path, null)
|
|
18
|
+
var result = await new Promise<string | null>((resolve, _) => {
|
|
19
|
+
fileEntry.file(file => {
|
|
20
|
+
var reader = new FileReader()
|
|
21
|
+
reader.onloadend = (_) => resolve(reader.result as string)
|
|
22
|
+
reader.readAsDataURL(file)
|
|
23
|
+
}, _ => resolve(null))
|
|
24
|
+
})
|
|
25
|
+
return result
|
|
26
|
+
} catch (_) {
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function pickImage(): Promise<string | null> {
|
|
32
|
+
return await cameraInstance.getPicture({
|
|
33
|
+
destinationType: DestinationType.DATA_URL,
|
|
34
|
+
mediaType: MediaType.PICTURE,
|
|
35
|
+
sourceType: PictureSourceType.PHOTOLIBRARY
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function chooseOption(): Promise<boolean | null> {
|
|
40
|
+
return await dialogsInstance.confirm("", "Select option", [
|
|
41
|
+
"Use camera",
|
|
42
|
+
"Use gallery"
|
|
43
|
+
]) == 1
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var cameraInstance: Camera
|
|
47
|
+
var dialogsInstance: Dialogs
|
|
48
|
+
@Component({
|
|
49
|
+
selector: 'app-root',
|
|
50
|
+
templateUrl: 'src/main.html',
|
|
51
|
+
styleUrl: 'src/main.css'
|
|
52
|
+
})
|
|
53
|
+
class Main {
|
|
54
|
+
constructor(platform: Platform, camera: Camera, dialogs: Dialogs) {
|
|
55
|
+
cameraInstance = camera
|
|
56
|
+
dialogsInstance = dialogs
|
|
57
|
+
platform.ready().then(main)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@NgModule({
|
|
62
|
+
bootstrap: [Main],
|
|
63
|
+
providers: [Platform, Camera, Dialogs],
|
|
64
|
+
imports: [BrowserModule, IonicModule.forRoot()]
|
|
65
|
+
})
|
|
66
|
+
class MainModule { }
|
|
67
|
+
|
|
68
|
+
platformBrowserDynamic().bootstrapModule(MainModule)
|