From 4de30786ecaec4a05dde226df213b12e9ded20ff Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Wed, 2 Feb 2022 16:13:56 -0500 Subject: [PATCH] Allow retry when cannot update --- _locales/en/messages.json | 18 +++++++- stylesheets/components/LeftPaneDialog.scss | 5 +++ test/i18n_test.js | 9 +--- ts/components/DialogUpdate.tsx | 50 ++++++++++++++++------ 4 files changed, 59 insertions(+), 23 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 9c555f0ad..91a2038ed 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1042,12 +1042,20 @@ "description": "Shown in a button when a conversation is unmuted and can be muted" }, "cannotUpdateDetail": { - "message": "Signal Desktop failed to update, but there is a new version available. Please go to $url$ and install the new version manually, then either contact support or file a bug about this problem.", + "message": "Signal couldn't update. $retry$ or visit $url$ to install it manually. Then, $support$ about this problem", "description": "Shown if a general error happened while trying to install update package", "placeholders": { + "retry": { + "content": "$2", + "example": "retry update" + }, "url": { - "content": "$1", + "content": "$2", "example": "https://signal.org/download" + }, + "support": { + "content": "$3", + "example": "contact support" } } }, @@ -2457,6 +2465,12 @@ "autoUpdateNewVersionTitle": { "message": "Update available" }, + "autoUpdateRetry": { + "message": "Retry update" + }, + "autoUpdateContactSupport": { + "message": "contact support" + }, "autoUpdateNewVersionMessage": { "message": "Click to restart Signal" }, diff --git a/stylesheets/components/LeftPaneDialog.scss b/stylesheets/components/LeftPaneDialog.scss index ec6b37049..08e80c2a0 100644 --- a/stylesheets/components/LeftPaneDialog.scss +++ b/stylesheets/components/LeftPaneDialog.scss @@ -32,6 +32,11 @@ padding-left: 36px; } + &__retry { + @include button-reset; + @include font-body-1-bold; + } + &--clickable { cursor: pointer; } diff --git a/test/i18n_test.js b/test/i18n_test.js index f9e5630cd..5371769ea 100644 --- a/test/i18n_test.js +++ b/test/i18n_test.js @@ -12,13 +12,8 @@ describe('i18n', () => { assert.equal(i18n('reportIssue'), ['Contact Support']); }); it('returns message with single substitution', () => { - const actual = i18n('cannotUpdateDetail', [ - 'https://signal.org/download', - ]); - assert.equal( - actual, - 'Signal Desktop failed to update, but there is a new version available. Please go to https://signal.org/download and install the new version manually, then either contact support or file a bug about this problem.' - ); + const actual = i18n('migratingToSQLCipher', ['45/200']); + assert.equal(actual, 'Optimizing messages... 45/200 complete.'); }); it('returns message with multiple substitutions', () => { const actual = i18n('theyChangedTheTimer', { diff --git a/ts/components/DialogUpdate.tsx b/ts/components/DialogUpdate.tsx index 1e631ee8d..1ef4deb5b 100644 --- a/ts/components/DialogUpdate.tsx +++ b/ts/components/DialogUpdate.tsx @@ -68,16 +68,38 @@ export const DialogUpdate = ({ > - {url} - , - ]} + components={{ + retry: ( + + ), + url: ( + + {url} + + ), + support: ( + + {i18n('autoUpdateContactSupport')} + + ), + }} i18n={i18n} id="cannotUpdateDetail" /> @@ -89,12 +111,12 @@ export const DialogUpdate = ({ if (dialogType === DialogType.MacOS_Read_Only) { return (