Skip to content

Commit 52c1f5c

Browse files
authored
Update-loading-and-face-match (#4)
* fix: loading state and facematch state * fix: missing .gitignore * fix: update info text & component names
1 parent 8c20a35 commit 52c1f5c

File tree

9 files changed

+56
-11
lines changed

9 files changed

+56
-11
lines changed

sdk-integration-examples/web-sdk/angular/face-scan/src/app/app.component.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class AppComponent {
2828

2929
private onSdkReady = () => {
3030
console.log("Successfully loaded");
31+
this.loading = false;
3132
};
3233

3334
private onScanSuccess = (ev: IdverseSdkUiCustomEvent<any>) => {
@@ -83,7 +84,14 @@ export class AppComponent {
8384
}
8485

8586
onhandleStart() {
86-
if (this.idverseSdk && this.ready) this.idverseSdk.startFaceScan();
87+
if (this.idverseSdk && this.ready) {
88+
this.loading = true;
89+
try {
90+
this.idverseSdk.startFaceScan();
91+
} catch (e) {
92+
console.error(e);
93+
}
94+
}
8795
}
8896
onClearError() {
8997
this.errorText = null;

sdk-integration-examples/web-sdk/angular/id-scan/src/app/app.component.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class AppComponent {
3030

3131
private onSdkReady = () => {
3232
console.log("Successfully loaded");
33+
this.loading = false;
3334
};
3435

3536
private onScanSuccess = (ev: IdverseSdkUiCustomEvent<any>) => {
@@ -72,7 +73,8 @@ export class AppComponent {
7273
}
7374
this.idverseSdk.recognizers = [SdkType.IDScan];
7475
this.idverseSdk.enableDFA = true;
75-
this.idverseSdk.enableFaceMatch = true;
76+
// INFO: Set to true when IDScan is used in combination with FaceScan, and a Face Match result is required.
77+
this.idverseSdk.enableFaceMatch = false;
7678

7779
this.idverseSdk.addEventListener("ready", this.onSdkReady);
7880
this.idverseSdk.addEventListener("fatalError", this.onError);
@@ -83,10 +85,14 @@ export class AppComponent {
8385

8486
onhandleStart(state: boolean) {
8587
this.scanBothSides = state;
86-
8788
if (this.idverseSdk && this.ready) {
89+
this.loading = true;
8890
this.idverseSdk.setScanBothSides(state);
89-
this.idverseSdk.startIDScan();
91+
try {
92+
this.idverseSdk.startIDScan();
93+
} catch (e) {
94+
console.error(e);
95+
}
9096
}
9197
}
9298
onClearError() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

sdk-integration-examples/web-sdk/react/face-scan/src/App.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function App() {
7777

7878
const handleStart = async () => {
7979
if (!idverseSDK || !ready) return;
80+
setLoading(true);
8081
try {
8182
idverseSDK.startFaceScan();
8283
} catch (e) {

sdk-integration-examples/web-sdk/react/id-scan/src/App.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ function App() {
6767
}
6868
sdk.recognizers = [SdkType.IDScan];
6969
sdk.enableDFA = true;
70-
sdk.enableFaceMatch = true;
70+
// INFO: Set to true when IDScan is used in combination with FaceScan, and a Face Match result is required.
71+
sdk.enableFaceMatch = false;
7172

7273
sdk.addEventListener("ready", onSdkReady);
7374
sdk.addEventListener("fatalError", onError);
@@ -83,6 +84,7 @@ function App() {
8384
if (!idverseSDK || !ready) return;
8485
setScanBothSides(state);
8586
idverseSDK.setScanBothSides(state);
87+
setLoading(true);
8688
try {
8789
idverseSDK.startIDScan();
8890
} catch (e) {

sdk-integration-examples/web-sdk/vue/face-scan/src/App.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import HelloWorld from "./components/HelloWorld.vue";
2+
import Main from "./components/Main.vue";
33
</script>
44

55
<template>
@@ -8,7 +8,7 @@ import HelloWorld from "./components/HelloWorld.vue";
88
<img src="/logo.svg" class="logo" alt="Idverse logo" />
99
</a>
1010
</div>
11-
<HelloWorld />
11+
<Main />
1212
</template>
1313

1414
<style scoped>

sdk-integration-examples/web-sdk/vue/face-scan/src/components/HelloWorld.vue renamed to sdk-integration-examples/web-sdk/vue/face-scan/src/components/Main.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
22
import { ref, onMounted } from "vue";
3-
import Details from "./Details.vue";
43
import "@idverse/idverse-sdk-browser/ui";
54
import {
65
FaceScanRecognizerResult,
@@ -17,6 +16,7 @@ const idverseSDK = ref<HTMLIdverseSdkUiElement | null>(null);
1716
1817
const onSdkReady = () => {
1918
console.log("Successfully loaded");
19+
loading.value = false;
2020
};
2121
2222
const onScanSuccess = (ev: IdverseSdkUiCustomEvent<any>) => {
@@ -47,6 +47,7 @@ const closeSession = () => {
4747
4848
const handleStart = async () => {
4949
if (!idverseSDK.value || !ready.value) return;
50+
loading.value = true;
5051
try {
5152
idverseSDK.value.startFaceScan();
5253
} catch (e) {

sdk-integration-examples/web-sdk/vue/id-scan/src/App.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import HelloWorld from "./components/HelloWorld.vue";
2+
import Main from "./components/Main.vue";
33
</script>
44

55
<template>
@@ -8,7 +8,7 @@ import HelloWorld from "./components/HelloWorld.vue";
88
<img src="/logo.svg" class="logo" alt="Idverse logo" />
99
</a>
1010
</div>
11-
<HelloWorld />
11+
<Main />
1212
</template>
1313

1414
<style scoped>

sdk-integration-examples/web-sdk/vue/id-scan/src/components/HelloWorld.vue renamed to sdk-integration-examples/web-sdk/vue/id-scan/src/components/Main.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const idverseSDK = ref<HTMLIdverseSdkUiElement | null>(null);
1818
1919
const onSdkReady = () => {
2020
console.log("Successfully loaded");
21+
loading.value = false;
2122
};
2223
2324
const onScanSuccess = (ev: IdverseSdkUiCustomEvent<any>) => {
@@ -48,6 +49,7 @@ const closeSession = () => {
4849
4950
const handleStart = async (state: boolean) => {
5051
if (!idverseSDK || !ready) return;
52+
loading.value = true;
5153
scanBothSides.value = state;
5254
idverseSDK.value?.setScanBothSides(state);
5355
try {
@@ -76,7 +78,8 @@ onMounted(() => {
7678
7779
sdk.recognizers = [SdkType.IDScan];
7880
sdk.enableDFA = true;
79-
sdk.enableFaceMatch = true;
81+
// INFO: Set to true when IDScan is used in combination with FaceScan, and a Face Match result is required.
82+
sdk.enableFaceMatch = false;
8083
8184
sdk.addEventListener("ready", onSdkReady);
8285
sdk.addEventListener("fatalError", onError);

0 commit comments

Comments
 (0)