@regulaforensics/face-sdk 7.2.415-beta → 7.2.422-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 +3 -2
- package/RNFaceSDK.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +0 -2
- package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +0 -18
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
- package/examples/capacitor/index.html +7 -2
- package/examples/capacitor/package-lock.json +3 -17
- package/examples/capacitor/package.json +3 -3
- package/examples/capacitor/scripts/setup.sh +2 -4
- package/examples/capacitor/src/main.css +6 -60
- package/examples/capacitor/src/main.html +1 -1
- package/examples/capacitor/src/main.tsx +87 -51
- package/examples/cordova/.vscode/launch.json +28 -0
- package/examples/cordova/README.md +25 -0
- package/examples/cordova/config.xml +26 -0
- package/examples/cordova/package-lock.json +1313 -0
- package/examples/cordova/package.json +30 -0
- package/examples/cordova/scripts/android.sh +8 -0
- package/examples/cordova/scripts/ios.sh +8 -0
- package/examples/cordova/scripts/setup.sh +8 -0
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/index.html +21 -0
- package/examples/cordova/www/src/main.css +83 -0
- package/examples/cordova/www/src/main.html +25 -0
- package/examples/cordova/www/src/main.js +152 -0
- package/examples/ionic/angular.json +3 -3
- package/examples/ionic/config.xml +1 -1
- package/examples/ionic/index.ts +17 -0
- package/examples/ionic/package-lock.json +765 -851
- package/examples/ionic/package.json +3 -3
- package/examples/ionic/src/images/portrait.png +0 -0
- package/examples/ionic/src/main.css +6 -60
- package/examples/ionic/src/main.html +1 -1
- package/examples/ionic/src/{main.tsx → main.ts} +97 -52
- package/examples/ionic/tsconfig.json +2 -3
- package/examples/react_native/index.tsx +7 -49
- package/examples/react_native/package-lock.json +621 -618
- package/examples/react_native/package.json +9 -9
- package/examples/react_native/src/main.css +6 -60
- package/examples/react_native/src/main.html +1 -1
- package/examples/react_native/src/main.tsx +79 -54
- package/ios/RFSWJSONConstructor.h +1 -0
- package/ios/RFSWJSONConstructor.m +14 -5
- package/ios/RFSWMain.m +0 -30
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/www/capacitor/customization/customization_fonts.js +1 -1
- package/www/capacitor/customization/customization_images.js +1 -1
- package/www/capacitor/customization/font.js +0 -8
- package/www/capacitor/detect_faces/detect_face_result.js +0 -12
- package/www/capacitor/detect_faces/detect_faces_attribute_result.js +0 -9
- package/www/capacitor/detect_faces/detect_faces_backend_exception.js +0 -7
- package/www/capacitor/detect_faces/detect_faces_config.js +0 -34
- package/www/capacitor/detect_faces/detect_faces_exception.js +0 -8
- package/www/capacitor/detect_faces/detect_faces_request.js +0 -22
- package/www/capacitor/detect_faces/detect_faces_response.js +0 -9
- package/www/capacitor/face_capture/face_capture_config.js +0 -37
- package/www/capacitor/face_capture/face_capture_exception.js +0 -7
- package/www/capacitor/face_capture/face_capture_image.js +0 -8
- package/www/capacitor/face_capture/face_capture_response.js +0 -7
- package/www/capacitor/image_params/output_image_crop.js +0 -23
- package/www/capacitor/image_params/output_image_params.js +0 -19
- package/www/capacitor/image_params/point.js +0 -7
- package/www/capacitor/image_params/rect.js +0 -9
- package/www/capacitor/image_params/size.js +0 -12
- package/www/capacitor/image_quality/image_quality_characteristic.js +0 -22
- package/www/capacitor/image_quality/image_quality_range.js +0 -7
- package/www/capacitor/image_quality/image_quality_result.js +0 -10
- package/www/capacitor/index.js +0 -48
- package/www/capacitor/init/face_sdk_version.js +0 -8
- package/www/capacitor/init/init_config.js +0 -19
- package/www/capacitor/init/init_exception.js +0 -8
- package/www/capacitor/init/license_exception.js +0 -7
- package/www/capacitor/internal/bridge.js +1 -20
- package/www/capacitor/liveness/liveness_backend_exception.js +0 -7
- package/www/capacitor/liveness/liveness_config.js +0 -43
- package/www/capacitor/liveness/liveness_exception.js +0 -8
- package/www/capacitor/liveness/liveness_notification.js +0 -7
- package/www/capacitor/liveness/liveness_response.js +0 -11
- package/www/capacitor/match_faces/compared_face.js +0 -9
- package/www/capacitor/match_faces/compared_faces_pair.js +0 -10
- package/www/capacitor/match_faces/compared_faces_split.js +0 -7
- package/www/capacitor/match_faces/match_faces_backend_exception.js +0 -7
- package/www/capacitor/match_faces/match_faces_config.js +0 -19
- package/www/capacitor/match_faces/match_faces_detection.js +0 -9
- package/www/capacitor/match_faces/match_faces_detection_face.js +0 -11
- package/www/capacitor/match_faces/match_faces_exception.js +0 -8
- package/www/capacitor/match_faces/match_faces_image.js +0 -9
- package/www/capacitor/match_faces/match_faces_request.js +0 -27
- package/www/capacitor/match_faces/match_faces_response.js +0 -9
- package/www/capacitor/person_database/edit_group_persons_request.js +0 -15
- package/www/capacitor/person_database/image_upload.js +0 -17
- package/www/capacitor/person_database/pageable_item_list.js +0 -8
- package/www/capacitor/person_database/person.js +0 -13
- package/www/capacitor/person_database/person_group.js +0 -11
- package/www/capacitor/person_database/person_image.js +0 -13
- package/www/capacitor/person_database/search_person.js +0 -14
- package/www/capacitor/person_database/search_person_detection.js +0 -9
- package/www/capacitor/person_database/search_person_image.js +0 -15
- package/www/capacitor/person_database/search_person_request.js +0 -29
- package/www/cordova.js +6 -753
- 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 +0 -8
- package/www/react-native/detect_faces/detect_face_result.js +0 -12
- package/www/react-native/detect_faces/detect_faces_attribute_result.js +0 -9
- package/www/react-native/detect_faces/detect_faces_backend_exception.js +0 -7
- package/www/react-native/detect_faces/detect_faces_config.js +0 -34
- package/www/react-native/detect_faces/detect_faces_exception.js +0 -8
- package/www/react-native/detect_faces/detect_faces_request.js +0 -22
- package/www/react-native/detect_faces/detect_faces_response.js +0 -9
- package/www/react-native/face_capture/face_capture_config.js +0 -37
- package/www/react-native/face_capture/face_capture_exception.js +0 -7
- package/www/react-native/face_capture/face_capture_image.js +0 -8
- package/www/react-native/face_capture/face_capture_response.js +0 -7
- package/www/react-native/image_params/output_image_crop.js +0 -23
- package/www/react-native/image_params/output_image_params.js +0 -19
- package/www/react-native/image_params/point.js +0 -7
- package/www/react-native/image_params/rect.js +0 -9
- package/www/react-native/image_params/size.js +0 -12
- package/www/react-native/image_quality/image_quality_characteristic.js +0 -22
- package/www/react-native/image_quality/image_quality_range.js +0 -7
- package/www/react-native/image_quality/image_quality_result.js +0 -10
- package/www/react-native/index.js +0 -48
- package/www/react-native/init/face_sdk_version.js +0 -8
- package/www/react-native/init/init_config.js +0 -19
- package/www/react-native/init/init_exception.js +0 -8
- package/www/react-native/init/license_exception.js +0 -7
- package/www/react-native/internal/bridge.js +1 -20
- package/www/react-native/liveness/liveness_backend_exception.js +0 -7
- package/www/react-native/liveness/liveness_config.js +0 -43
- package/www/react-native/liveness/liveness_exception.js +0 -8
- package/www/react-native/liveness/liveness_notification.js +0 -7
- package/www/react-native/liveness/liveness_response.js +0 -11
- package/www/react-native/match_faces/compared_face.js +0 -9
- package/www/react-native/match_faces/compared_faces_pair.js +0 -10
- package/www/react-native/match_faces/compared_faces_split.js +0 -7
- package/www/react-native/match_faces/match_faces_backend_exception.js +0 -7
- package/www/react-native/match_faces/match_faces_config.js +0 -19
- package/www/react-native/match_faces/match_faces_detection.js +0 -9
- package/www/react-native/match_faces/match_faces_detection_face.js +0 -11
- package/www/react-native/match_faces/match_faces_exception.js +0 -8
- package/www/react-native/match_faces/match_faces_image.js +0 -9
- package/www/react-native/match_faces/match_faces_request.js +0 -27
- package/www/react-native/match_faces/match_faces_response.js +0 -9
- package/www/react-native/person_database/edit_group_persons_request.js +0 -15
- package/www/react-native/person_database/image_upload.js +0 -17
- package/www/react-native/person_database/pageable_item_list.js +0 -8
- package/www/react-native/person_database/person.js +0 -13
- package/www/react-native/person_database/person_group.js +0 -11
- package/www/react-native/person_database/person_image.js +0 -13
- package/www/react-native/person_database/search_person.js +0 -14
- package/www/react-native/person_database/search_person_detection.js +0 -9
- package/www/react-native/person_database/search_person_image.js +0 -15
- package/www/react-native/person_database/search_person_request.js +0 -29
- package/www/types/index.d.ts +0 -12
- package/www/types/match_faces/match_faces_config.d.ts +0 -2
- package/www/types/person_database/search_person_request.d.ts +0 -4
- package/examples/capacitor/index.tsx +0 -53
- package/examples/ionic/index.tsx +0 -68
- package/test/json.tsx +0 -375
- package/test/package-lock.json +0 -584
- package/test/package.json +0 -9
- package/test/test.tsx +0 -61
- package/test/utils.tsx +0 -38
- /package/examples/{ionic → cordova/www}/images/portrait.png +0 -0
- /package/examples/ionic/{assets → src/assets}/.gitkeep +0 -0
- /package/examples/ionic/{images → src/images}/icon.png +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "face-sdk",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"setup": "scripts/setup.sh",
|
|
5
|
+
"ios": "scripts/ios.sh",
|
|
6
|
+
"android": "scripts/android.sh"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@regulaforensics/face-sdk": "7.2.422-beta",
|
|
10
|
+
"@regulaforensics/face-core-basic": "7.1.202",
|
|
11
|
+
"cordova-ios": "7.1.1",
|
|
12
|
+
"cordova-android": "13.0.0",
|
|
13
|
+
"cordova-plugin-file": "8.1.3",
|
|
14
|
+
"cordova-plugin-camera": "8.0.0",
|
|
15
|
+
"cordova-plugin-dialogs": "2.0.2"
|
|
16
|
+
},
|
|
17
|
+
"cordova": {
|
|
18
|
+
"plugins": {
|
|
19
|
+
"@regulaforensics/face-sdk": {},
|
|
20
|
+
"@regulaforensics/face-core-basic": {},
|
|
21
|
+
"cordova-plugin-file": {},
|
|
22
|
+
"cordova-plugin-camera": {},
|
|
23
|
+
"cordova-plugin-dialogs": {}
|
|
24
|
+
},
|
|
25
|
+
"platforms": [
|
|
26
|
+
"android",
|
|
27
|
+
"ios"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
|
|
2
|
+
<link rel="stylesheet" href="src/main.css">
|
|
3
|
+
<script src="cordova.js"></script>
|
|
4
|
+
<script src="src/main.js"></script>
|
|
5
|
+
|
|
6
|
+
<div id="content" style="height: 100%"></div>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
document.addEventListener('deviceready', () => {
|
|
10
|
+
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + 'www/src/main.html', (fileEntry) => {
|
|
11
|
+
fileEntry.file((file) => {
|
|
12
|
+
const reader = new FileReader()
|
|
13
|
+
reader.onloadend = function () {
|
|
14
|
+
document.getElementById('content').innerHTML = this.result
|
|
15
|
+
document.dispatchEvent(new CustomEvent("ready"))
|
|
16
|
+
}
|
|
17
|
+
reader.readAsText(file)
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
html,
|
|
2
|
+
body {
|
|
3
|
+
width: 99%;
|
|
4
|
+
height: 99vh;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.page {
|
|
10
|
+
height: 100%;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.column {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.row {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.header {
|
|
31
|
+
text-align: center;
|
|
32
|
+
padding-top: 80px;
|
|
33
|
+
margin-top: -10px;
|
|
34
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
font-size: 18px;
|
|
37
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sub-header {
|
|
41
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
42
|
+
width: 100%;
|
|
43
|
+
padding-top: 13px;
|
|
44
|
+
text-align: center;
|
|
45
|
+
font-weight: 550;
|
|
46
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.divider {
|
|
50
|
+
height: 1px;
|
|
51
|
+
background-color: rgba(0, 0, 0, 0.075);
|
|
52
|
+
margin-top: 13px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.no-scroll {
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
overflow-y: hidden;
|
|
58
|
+
overflow-x: hidden;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.button {
|
|
62
|
+
width: 175px;
|
|
63
|
+
height: 40px;
|
|
64
|
+
margin: 5px;
|
|
65
|
+
margin-top: 10px;
|
|
66
|
+
background-color: #4285F4;
|
|
67
|
+
color: white;
|
|
68
|
+
border: none;
|
|
69
|
+
padding: 10px 20px;
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
border-radius: 100px;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
transition: all 0.3s ease;
|
|
74
|
+
user-select: none;
|
|
75
|
+
-webkit-user-select: none;
|
|
76
|
+
-moz-user-select: none;
|
|
77
|
+
-ms-user-select: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.button:active {
|
|
81
|
+
position: relative;
|
|
82
|
+
top: 1px;
|
|
83
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<div class="page">
|
|
2
|
+
<div class="column header">
|
|
3
|
+
<span id="status">Loading...</span>
|
|
4
|
+
<div class="column divider"></div>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="column sub-header">
|
|
7
|
+
<div class="row" style="width: 100%">
|
|
8
|
+
<div style="width: 185px">Similarity: <span id="similarity-status">null</span></div>
|
|
9
|
+
<div style="width: 185px">Liveness: <span id="liveness-status">null</span></div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="column divider"></div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="column no-scroll">
|
|
14
|
+
<div class="row" style="height: 100%">
|
|
15
|
+
<img id="first-image" src="images/portrait.png" width="175px" style="padding: 5px">
|
|
16
|
+
<img id="second-image" src="images/portrait.png" width="175px" style="padding: 5px">
|
|
17
|
+
</div>
|
|
18
|
+
<div class="row">
|
|
19
|
+
<button id="match-faces" class="button">Match</button>
|
|
20
|
+
<button id="start-liveness" class="button">Liveness</button>
|
|
21
|
+
</div>
|
|
22
|
+
<button id="clear-results" class="button" style="width: 360px">Clear</button>
|
|
23
|
+
<div style="padding-top: 30px"></div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
document.addEventListener('ready', onDeviceReady)
|
|
2
|
+
async function onDeviceReady() {
|
|
3
|
+
faceSdk = FaceSDKPlugin.FaceSDK.instance
|
|
4
|
+
|
|
5
|
+
image1 = null
|
|
6
|
+
image2 = null
|
|
7
|
+
|
|
8
|
+
// imports
|
|
9
|
+
FaceCaptureResponse = FaceSDKPlugin.FaceCaptureResponse
|
|
10
|
+
LivenessResponse = FaceSDKPlugin.LivenessResponse
|
|
11
|
+
MatchFacesResponse = FaceSDKPlugin.MatchFacesResponse
|
|
12
|
+
MatchFacesRequest = FaceSDKPlugin.MatchFacesRequest
|
|
13
|
+
MatchFacesImage = FaceSDKPlugin.MatchFacesImage
|
|
14
|
+
ComparedFacesSplit = FaceSDKPlugin.ComparedFacesSplit
|
|
15
|
+
InitConfig = FaceSDKPlugin.InitConfig
|
|
16
|
+
InitResponse = FaceSDKPlugin.InitResponse
|
|
17
|
+
LivenessNotification = FaceSDKPlugin.LivenessNotification
|
|
18
|
+
ImageType = FaceSDKPlugin.ImageType
|
|
19
|
+
LivenessSkipStep = FaceSDKPlugin.LivenessSkipStep
|
|
20
|
+
LivenessStatus = FaceSDKPlugin.LivenessStatus
|
|
21
|
+
LivenessConfig = FaceSDKPlugin.LivenessConfig
|
|
22
|
+
|
|
23
|
+
setStatus = data => document.getElementById("status").innerHTML = data
|
|
24
|
+
setLivenessStatus = data => document.getElementById("liveness-status").innerHTML = data
|
|
25
|
+
setSimilarityStatus = data => document.getElementById("similarity-status").innerHTML = data
|
|
26
|
+
setUiImage1 = data => document.getElementById("first-image").src = data
|
|
27
|
+
setUiImage2 = data => document.getElementById("second-image").src = data
|
|
28
|
+
resetImages = () => {
|
|
29
|
+
setUiImage1("images/portrait.png")
|
|
30
|
+
setUiImage2("images/portrait.png")
|
|
31
|
+
}
|
|
32
|
+
document.getElementById("first-image").onclick = () => pickImage(1)
|
|
33
|
+
document.getElementById("second-image").onclick = () => pickImage(2)
|
|
34
|
+
document.getElementById("match-faces").onclick = () => matchFaces()
|
|
35
|
+
document.getElementById("start-liveness").onclick = () => startLiveness()
|
|
36
|
+
document.getElementById("clear-results").onclick = () => clearResults()
|
|
37
|
+
|
|
38
|
+
init()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function init() {
|
|
42
|
+
if (!await initialize()) return
|
|
43
|
+
setStatus("Ready")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function startLiveness() {
|
|
47
|
+
var response = await faceSdk.startLiveness({
|
|
48
|
+
config: new LivenessConfig({
|
|
49
|
+
skipStep: [LivenessSkipStep.ONBOARDING_STEP]
|
|
50
|
+
}),
|
|
51
|
+
notificationCompletion: (notification) => {
|
|
52
|
+
console.log("LivenessStatus: " + notification.status)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
if (response.image == null) return
|
|
56
|
+
setImage("data:image/png;base64," + response.image, ImageType.LIVE, 1)
|
|
57
|
+
setLivenessStatus(response.liveness == LivenessStatus.PASSED ? "passed" : "unknown")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function matchFaces() {
|
|
61
|
+
if (image1 == null || image2 == null) {
|
|
62
|
+
setStatus("Both images required!")
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
setStatus("Processing...")
|
|
66
|
+
var request = new MatchFacesRequest([image1, image2])
|
|
67
|
+
var response = await faceSdk.matchFaces(request)
|
|
68
|
+
var split = await faceSdk.splitComparedFaces(response.results, 0.75)
|
|
69
|
+
var match = split.matchedFaces
|
|
70
|
+
setSimilarityStatus("failed")
|
|
71
|
+
if (match.length > 0)
|
|
72
|
+
setSimilarityStatus((match[0].similarity * 100).toFixed(2) + "%")
|
|
73
|
+
setStatus("Ready")
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function clearResults() {
|
|
77
|
+
setStatus("Ready")
|
|
78
|
+
setSimilarityStatus("null")
|
|
79
|
+
setLivenessStatus("null")
|
|
80
|
+
resetImages()
|
|
81
|
+
image1 = null
|
|
82
|
+
image2 = null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// If 'regula.license' exists, init using license(enables offline match)
|
|
86
|
+
// otherwise init without license.
|
|
87
|
+
async function initialize() {
|
|
88
|
+
setStatus("Initializing...")
|
|
89
|
+
|
|
90
|
+
var license = await loadAssetIfExists("regula.license")
|
|
91
|
+
var config
|
|
92
|
+
if (license != null) config = new InitConfig(license)
|
|
93
|
+
var [success, error] = await faceSdk.initialize({ config: config })
|
|
94
|
+
|
|
95
|
+
if (!success && error != null) {
|
|
96
|
+
setStatus(error.message)
|
|
97
|
+
console.log(error.code + ": " + error.message)
|
|
98
|
+
}
|
|
99
|
+
return success
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function setImage(base64, type, position) {
|
|
103
|
+
setSimilarityStatus("null")
|
|
104
|
+
var mfImage = new MatchFacesImage(base64, type)
|
|
105
|
+
if (position == 1) {
|
|
106
|
+
image1 = mfImage
|
|
107
|
+
setUiImage1(base64)
|
|
108
|
+
setLivenessStatus("null")
|
|
109
|
+
}
|
|
110
|
+
if (position == 2) {
|
|
111
|
+
image2 = mfImage
|
|
112
|
+
setUiImage2(base64)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function useCamera(position) {
|
|
117
|
+
var response = await faceSdk.startFaceCapture()
|
|
118
|
+
if (response.image == null) return
|
|
119
|
+
var image = response.image
|
|
120
|
+
setImage("data:image/png;base64," + image.image, image.imageType, position)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function useGallery(position) {
|
|
124
|
+
navigator.camera.getPicture(function (result) {
|
|
125
|
+
if (result == null) return
|
|
126
|
+
setImage(result, ImageType.PRINTED, position)
|
|
127
|
+
}, function (_) { }, {
|
|
128
|
+
destinationType: Camera.DestinationType.DATA_URL,
|
|
129
|
+
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
|
|
130
|
+
mediaType: Camera.MediaType.PICTURE
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function pickImage(position) {
|
|
135
|
+
navigator.notification.confirm("", button => {
|
|
136
|
+
if (button == 1) useGallery(position)
|
|
137
|
+
else useCamera(position)
|
|
138
|
+
}, "Select option", ["Use gallery", "Use camera"])
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function loadAssetIfExists(path) {
|
|
142
|
+
path = cordova.file.applicationDirectory + "www/" + path
|
|
143
|
+
return new Promise((resolve, _) => {
|
|
144
|
+
window.resolveLocalFileSystemURL(path, (fileEntry) => {
|
|
145
|
+
fileEntry.file((file) => {
|
|
146
|
+
var reader = new FileReader()
|
|
147
|
+
reader.onloadend = function (_) { resolve(this.result) }
|
|
148
|
+
reader.readAsDataURL(file)
|
|
149
|
+
})
|
|
150
|
+
}, (_) => resolve(null))
|
|
151
|
+
})
|
|
152
|
+
}
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"options": {
|
|
12
12
|
"outputPath": "www",
|
|
13
13
|
"index": "index.html",
|
|
14
|
-
"main": "index.
|
|
14
|
+
"main": "index.ts",
|
|
15
15
|
"tsConfig": "tsconfig.json",
|
|
16
16
|
"assets": [
|
|
17
17
|
{
|
|
18
18
|
"glob": "**/*",
|
|
19
|
-
"input": "assets",
|
|
19
|
+
"input": "src/assets",
|
|
20
20
|
"output": "assets"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"glob": "**/*",
|
|
24
|
-
"input": "images",
|
|
24
|
+
"input": "src/images",
|
|
25
25
|
"output": "images"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
2
|
<widget android-packageName="com.regula.documentreader.api.androidtest" ios-CFBundleIdentifier="com.regula.documentreader.qa" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<name>FaceSDK</name>
|
|
4
|
-
<icon src="images/icon.png" />
|
|
4
|
+
<icon src="src/images/icon.png" />
|
|
5
5
|
<platform name="android">
|
|
6
6
|
<preference name="orientation" value="portrait" />
|
|
7
7
|
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { Dialogs } from '@awesome-cordova-plugins/dialogs/ngx'
|
|
6
|
+
import { Camera } from '@awesome-cordova-plugins/camera/ngx'
|
|
7
|
+
import { Main } from './src/main'
|
|
8
|
+
import { NgModule } from '@angular/core'
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
bootstrap: [Main],
|
|
12
|
+
providers: [Platform, Dialogs, Camera],
|
|
13
|
+
imports: [BrowserModule, IonicModule.forRoot()]
|
|
14
|
+
})
|
|
15
|
+
class MainModule { }
|
|
16
|
+
|
|
17
|
+
platformBrowserDynamic().bootstrapModule(MainModule)
|