From 5da82e7b0b3ecbbe4f5b31bcbaa8d92868ad8602 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Wed, 23 Sep 2020 13:45:53 +0200 Subject: [PATCH] feature: revamp protocol upgrade dialog --- app/assets/javascripts/strings.ts | 8 ++++++++ .../javascripts/views/footer/footer_view.ts | 18 ++++++++++++++---- app/assets/stylesheets/_stylekit-sub.scss | 4 ++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/strings.ts b/app/assets/javascripts/strings.ts index 8351b22fd..9bc8d7d7e 100644 --- a/app/assets/javascripts/strings.ts +++ b/app/assets/javascripts/strings.ts @@ -68,3 +68,11 @@ export const STRING_CONFIRM_APP_QUIT_DURING_PASSCODE_CHANGE = export const STRING_CONFIRM_APP_QUIT_DURING_PASSCODE_REMOVAL = "A passcode removal is in progress. You may lose data if you quit the app. " + "Are you sure you want to quit?" + +export const STRING_UPGRADE_ACCOUNT_CONFIRM_TITLE = 'Encryption upgrade available'; +export const STRING_UPGRADE_ACCOUNT_CONFIRM_TEXT = + 'Encryption version 004 is available for your account and local data storage. ' + + 'This version strengthens the encryption algorithms for your account and ' + + 'disk use. To learn more about this upgrade, visit our ' + + 'Security Upgrade page.'; +export const STRING_UPGRADE_ACCOUNT_CONFIRM_BUTTON = 'Upgrade'; diff --git a/app/assets/javascripts/views/footer/footer_view.ts b/app/assets/javascripts/views/footer/footer_view.ts index 6f711d7b5..b42deab33 100644 --- a/app/assets/javascripts/views/footer/footer_view.ts +++ b/app/assets/javascripts/views/footer/footer_view.ts @@ -19,9 +19,13 @@ import { AppStateEvent, EventSource } from '@/ui_models/app_state'; import { STRING_GENERIC_SYNC_ERROR, STRING_NEW_UPDATE_READY, - STRING_CONFIRM_APP_QUIT_DURING_UPGRADE + STRING_CONFIRM_APP_QUIT_DURING_UPGRADE, + STRING_UPGRADE_ACCOUNT_CONFIRM_TEXT, + STRING_UPGRADE_ACCOUNT_CONFIRM_TITLE, + STRING_UPGRADE_ACCOUNT_CONFIRM_BUTTON, } from '@/strings'; import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl'; +import { confirmDialog } from '@/services/alertService'; /** * Disable before production release. @@ -337,9 +341,15 @@ class FooterViewCtrl extends PureViewCtrl<{}, { } async openSecurityUpdate() { - preventRefreshing(STRING_CONFIRM_APP_QUIT_DURING_UPGRADE, async () => { - await this.application.performProtocolUpgrade(); - }); + if (await confirmDialog({ + title: STRING_UPGRADE_ACCOUNT_CONFIRM_TITLE, + text: STRING_UPGRADE_ACCOUNT_CONFIRM_TEXT, + confirmButtonText: STRING_UPGRADE_ACCOUNT_CONFIRM_BUTTON, + })) { + preventRefreshing(STRING_CONFIRM_APP_QUIT_DURING_UPGRADE, async () => { + await this.application.performProtocolUpgrade(); + }); + } } findErrors() { diff --git a/app/assets/stylesheets/_stylekit-sub.scss b/app/assets/stylesheets/_stylekit-sub.scss index 7867e66ac..33003133c 100644 --- a/app/assets/stylesheets/_stylekit-sub.scss +++ b/app/assets/stylesheets/_stylekit-sub.scss @@ -70,3 +70,7 @@ button.sk-button { border: none; } + +a { + color: var(--sn-stylekit-info-color); +}