From 365a7273d80a5aad91a0593b2499786da997b126 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 9 Jan 2019 05:24:15 -0600 Subject: [PATCH] Move initial key backup to background Since the initial key backup can take several minutes for some users, this moves the upload step to the background. The create key backup flow now only marks all sessions for backup synchronously, with the actual backup happening later. The key backup panel in Settings gains a new row to show a summary of upload status. Users are directed there if they wish to know if the backup is done. The text in various related dialogs has also been tweaked to fit the new flow. --- .../keybackup/CreateKeyBackupDialog.js | 17 ++++++++------- .../views/settings/KeyBackupPanel.js | 21 ++++++++++++------- src/i18n/strings/en_EN.json | 10 ++++----- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js index be728916dd..89a9e9e47d 100644 --- a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js +++ b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js @@ -21,7 +21,7 @@ import { scorePassword } from '../../../../utils/PasswordScorer'; import FileSaver from 'file-saver'; -import { _t, _td } from '../../../../languageHandler'; +import { _t } from '../../../../languageHandler'; const PHASE_PASSPHRASE = 0; const PHASE_PASSPHRASE_CONFIRM = 1; @@ -102,7 +102,7 @@ export default React.createClass({ info = await MatrixClientPeg.get().createKeyBackupVersion( this._keyBackupInfo, ); - await MatrixClientPeg.get().backupAllGroupSessions(info.version); + await MatrixClientPeg.get().scheduleAllGroupSessionsForBackup(); this.setState({ phase: PHASE_DONE, }); @@ -408,7 +408,6 @@ export default React.createClass({ _renderBusyPhase: function(text) { const Spinner = sdk.getComponent('views.elements.Spinner'); return
-

{_t(text)}

; }, @@ -416,8 +415,10 @@ export default React.createClass({ _renderPhaseDone: function() { const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); return
-

{_t("Backup created")}

-

{_t("Your encryption keys are now being backed up to your Homeserver.")}

+

{_t( + "Your encryption keys are now being backed up in the background " + + "to your Homeserver. The initial backup could take several minutes. " + + "You can view key backup upload progress in Settings.")}

not uploading keys to this backup", {}, + "This device is not using key backup", {}, {b: x => {x}}, ); } let uploadStatus; const { sessionsRemaining } = this.state; - if (sessionsRemaining > 0) { - uploadStatus = _t("Backing up %(sessionsRemaining)s keys...", { - sessionsRemaining, - }); + if (!MatrixClientPeg.get().getKeyBackupEnabled()) { + // No upload status to show when backup disabled. + uploadStatus = ""; + } else if (sessionsRemaining > 0) { + uploadStatus =
+ {_t("Backing up %(sessionsRemaining)s keys...", { sessionsRemaining })}
+
; } else { - uploadStatus = _t("All keys backed up"); + uploadStatus =
+ {_t("All keys backed up")}
+
; } let backupSigStatuses = this.state.backupSigStatus.sigs.map((sig, i) => { @@ -244,7 +249,7 @@ export default class KeyBackupPanel extends React.PureComponent { {_t("Backup version: ")}{this.state.backupInfo.version}
{_t("Algorithm: ")}{this.state.backupInfo.algorithm}
{clientBackupStatus}
- {uploadStatus}
+ {uploadStatus}
{backupSigStatuses}


not uploading keys to this backup": "This device is not uploading keys to this backup", + "This device is using key backup": "This device is using key backup", + "This device is not using key backup": "This device is not using key backup", "Backing up %(sessionsRemaining)s keys...": "Backing up %(sessionsRemaining)s keys...", "All keys backed up": "All keys backed up", "Backup has a valid signature from this device": "Backup has a valid signature from this device", @@ -1388,15 +1388,15 @@ "Print it and store it somewhere safe": "Print it and store it somewhere safe", "Save it on a USB key or backup drive": "Save it on a USB key or backup drive", "Copy it to your personal cloud storage": "Copy it to your personal cloud storage", - "Backup created": "Backup created", - "Your encryption keys are now being backed up to your Homeserver.": "Your encryption keys are now being backed up to your Homeserver.", + "Your encryption keys are now being backed up in the background to your Homeserver. The initial backup could take several minutes. You can view key backup upload progress in Settings.": "Your encryption keys are now being backed up in the background to your Homeserver. The initial backup could take several minutes. You can view key backup upload progress in Settings.", "Without setting up Secure Message Recovery, you won't be able to restore your encrypted message history if you log out or use another device.": "Without setting up Secure Message Recovery, you won't be able to restore your encrypted message history if you log out or use another device.", "Set up Secure Message Recovery": "Set up Secure Message Recovery", "Create a Recovery Passphrase": "Create a Recovery Passphrase", "Confirm Recovery Passphrase": "Confirm Recovery Passphrase", "Recovery Key": "Recovery Key", "Keep it safe": "Keep it safe", - "Backing up...": "Backing up...", + "Starting backup...": "Starting backup...", + "Backup Started": "Backup Started", "Create Key Backup": "Create Key Backup", "Unable to create key backup": "Unable to create key backup", "Retry": "Retry",