diff --git a/src/background/main.background.ts b/src/background/main.background.ts index fdf2ab81f5a..6de29fa43a2 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -152,10 +152,16 @@ export default class MainBackground { this.systemService.clearClipboard(clipboardValue, clearMs); } }, - () => { + async () => { if (this.nativeMessagingBackground != null) { const promise = this.nativeMessagingBackground.getResponse(); - this.nativeMessagingBackground.send({command: 'biometricUnlock'}) + + try { + await this.nativeMessagingBackground.send({command: 'biometricUnlock'}); + } catch (e) { + return Promise.reject(e); + } + return promise.then((result) => result.response === 'unlocked'); } }); diff --git a/src/popup/settings/settings.component.html b/src/popup/settings/settings.component.html index 42f3287792a..fc1eeedfe79 100644 --- a/src/popup/settings/settings.component.html +++ b/src/popup/settings/settings.component.html @@ -44,7 +44,7 @@
- +
diff --git a/src/popup/settings/settings.component.ts b/src/popup/settings/settings.component.ts index 57a65cce77a..0cf3972dcec 100644 --- a/src/popup/settings/settings.component.ts +++ b/src/popup/settings/settings.component.ts @@ -208,10 +208,6 @@ export class SettingsComponent implements OnInit { async updateBiometric() { if (this.biometric) { - this.biometric = false; - await this.storageService.remove(ConstantsService.biometricUnlockKey); - this.vaultTimeoutService.biometricLocked = false; - } else { const submitted = Swal.fire({ heightAuto: false, buttonsStyling: false, @@ -242,8 +238,14 @@ export class SettingsComponent implements OnInit { if (this.biometric === false) { this.platformUtilsService.showToast('error', this.i18nService.t('errorEnableBiometricTitle'), this.i18nService.t('errorEnableBiometricDesc')); } + }).catch((e) => { + // Handle connection errors + this.biometric = false; }) ]); + } else { + await this.storageService.remove(ConstantsService.biometricUnlockKey); + this.vaultTimeoutService.biometricLocked = false; } }