From 1c84abae44bf01fcafe022c1d13eb53501021e70 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 31 May 2019 09:14:49 -0600 Subject: [PATCH 1/2] Fix logout dialog for low bandwidth --- src/components/views/dialogs/LogoutDialog.js | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/components/views/dialogs/LogoutDialog.js b/src/components/views/dialogs/LogoutDialog.js index 5241c14096..f215133297 100644 --- a/src/components/views/dialogs/LogoutDialog.js +++ b/src/components/views/dialogs/LogoutDialog.js @@ -20,11 +20,12 @@ import sdk from '../../../index'; import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; import MatrixClientPeg from '../../../MatrixClientPeg'; +import SettingsStore from "../../../settings/SettingsStore"; export default class LogoutDialog extends React.Component { defaultProps = { onFinished: function() {}, - } + }; constructor() { super(); @@ -34,9 +35,11 @@ export default class LogoutDialog extends React.Component { this._onSetRecoveryMethodClick = this._onSetRecoveryMethodClick.bind(this); this._onLogoutConfirm = this._onLogoutConfirm.bind(this); - const shouldLoadBackupStatus = !MatrixClientPeg.get().getKeyBackupEnabled(); + const lowBandwidth = SettingsStore.getValue("lowBandwidth"); + const shouldLoadBackupStatus = !lowBandwidth && !MatrixClientPeg.get().getKeyBackupEnabled(); this.state = { + lowBandwidth: lowBandwidth, loading: shouldLoadBackupStatus, backupInfo: null, error: null, @@ -110,17 +113,17 @@ export default class LogoutDialog extends React.Component { } render() { - const description =
-

{_t( - "Encrypted messages are secured with end-to-end encryption. " + - "Only you and the recipient(s) have the keys to read these messages.", - )}

-

{_t("Back up your keys before signing out to avoid losing them.")}

-
; - - if (!MatrixClientPeg.get().getKeyBackupEnabled()) { + if (!this.state.lowBandwidth && !MatrixClientPeg.get().getKeyBackupEnabled()) { const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + const description =
+

{_t( + "Encrypted messages are secured with end-to-end encryption. " + + "Only you and the recipient(s) have the keys to read these messages.", + )}

+

{_t("Back up your keys before signing out to avoid losing them.")}

+
; + let dialogContent; if (this.state.loading) { const Spinner = sdk.getComponent('views.elements.Spinner'); From 16a46be00f9c993027f0529bcfb821a48b43da04 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 31 May 2019 09:20:13 -0600 Subject: [PATCH 2/2] Cache shouldLoadBackupStatus in state --- src/components/views/dialogs/LogoutDialog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/LogoutDialog.js b/src/components/views/dialogs/LogoutDialog.js index f215133297..47d4153494 100644 --- a/src/components/views/dialogs/LogoutDialog.js +++ b/src/components/views/dialogs/LogoutDialog.js @@ -39,7 +39,7 @@ export default class LogoutDialog extends React.Component { const shouldLoadBackupStatus = !lowBandwidth && !MatrixClientPeg.get().getKeyBackupEnabled(); this.state = { - lowBandwidth: lowBandwidth, + shouldLoadBackupStatus: shouldLoadBackupStatus, loading: shouldLoadBackupStatus, backupInfo: null, error: null, @@ -113,7 +113,7 @@ export default class LogoutDialog extends React.Component { } render() { - if (!this.state.lowBandwidth && !MatrixClientPeg.get().getKeyBackupEnabled()) { + if (this.state.shouldLoadBackupStatus) { const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const description =