Skip to content

Commit

Permalink
✨ feat(frontend): Add function to grant biometric access
Browse files Browse the repository at this point in the history
Added a new function `grantBiometricAccess` to handle the process of requesting biometric access and displaying alerts based on the user's decision. This function is called when biometric access is not already granted. Updated the logic for handling biometric initialization and access verification.

Refactored code in `App.vue` to improve biometric authentication flow.

See details in the diff for more information.

Closes #32
Co-authored-by: John Doe <[email protected]>
  • Loading branch information
sudoskys committed May 12, 2024
1 parent 053d1d9 commit 24e570a
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,24 +181,27 @@ const initBiometric = () => {
WebAppBiometricManager.initBiometric(
() => {
console.log('Biometric initialized')
if (WebAppBiometricManager.isBiometricAvailable.value) {
console.log('Biometric now available')
console.log(WebAppBiometricManager.biometricType.value)
isBiometricInitialized.value = true
} else {
console.log('Biometric now unavailable')
isBiometricInitialized.value = false
}
// 授权
if (WebAppBiometricManager.isBiometricAccessGranted.value) {
console.log('Biometric granted')
} else {
console.log('Biometric not granted')
grantBiometricAccess()
}
}
)
}
WebAppBiometricManager.onBiometricManagerUpdated(() => {
console.log('Biometric manager updated')
if (WebAppBiometricManager.isBiometricAvailable.value) {
console.log('Biometric now available')
console.log(WebAppBiometricManager.biometricType.value)
isBiometricInitialized.value = true
} else {
console.log('Biometric now unavailable')
isBiometricInitialized.value = false
}
if (WebAppBiometricManager.isBiometricAccessGranted.value) {
console.log('Biometric granted')
} else {
console.log('Biometric not granted')
grantBiometricAccess()
}
})
console.log(getUserAcc())
initBiometric()
WebApp.ready()
Expand Down

0 comments on commit 24e570a

Please sign in to comment.