From b7acbcf3a7766eb0a52f21fe90505a69b4c19444 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Fri, 5 Mar 2021 08:56:20 +1000 Subject: [PATCH] Enable platform-specific export warning message (#295) --- src/angular/components/export.component.ts | 33 +++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/angular/components/export.component.ts b/src/angular/components/export.component.ts index bad245f197..82b0ca5fb9 100644 --- a/src/angular/components/export.component.ts +++ b/src/angular/components/export.component.ts @@ -29,28 +29,13 @@ export class ExportComponent { } async submit() { - let acceptedWarning; - if (this.masterPassword == null || this.masterPassword === '') { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), this.i18nService.t('invalidMasterPassword')); return; } - if (this.encryptedFormat) { - acceptedWarning = await this.platformUtilsService.showDialog( - '

' + this.i18nService.t('encExportKeyWarningDesc') + - '

' + this.i18nService.t('encExportAccountWarningDesc'), - this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), - this.i18nService.t('cancel'), 'warning', - true); - } else { - acceptedWarning = await this.platformUtilsService.showDialog( - this.i18nService.t('exportWarningDesc'), - this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), - this.i18nService.t('cancel'), 'warning'); - } - + const acceptedWarning = await this.warningDialog(); if (!acceptedWarning) { return; } @@ -72,6 +57,22 @@ export class ExportComponent { } } + async warningDialog() { + if (this.encryptedFormat) { + return await this.platformUtilsService.showDialog( + '

' + this.i18nService.t('encExportKeyWarningDesc') + + '

' + this.i18nService.t('encExportAccountWarningDesc'), + this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), + this.i18nService.t('cancel'), 'warning', + true); + } else { + return await this.platformUtilsService.showDialog( + this.i18nService.t('exportWarningDesc'), + this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), + this.i18nService.t('cancel'), 'warning'); + } + } + togglePassword() { this.platformUtilsService.eventTrack('Toggled Master Password on Export'); this.showPassword = !this.showPassword;