From ab40a0b264e90b51024df3a88e35cc413109b635 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 16 Nov 2018 11:33:09 +0000 Subject: [PATCH] Actually add the dialog --- .../views/dialogs/CryptoStoreTooNewDialog.js | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/components/views/dialogs/CryptoStoreTooNewDialog.js diff --git a/src/components/views/dialogs/CryptoStoreTooNewDialog.js b/src/components/views/dialogs/CryptoStoreTooNewDialog.js new file mode 100644 index 0000000000..0146420f46 --- /dev/null +++ b/src/components/views/dialogs/CryptoStoreTooNewDialog.js @@ -0,0 +1,71 @@ +/* +Copyright 2018 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react'; +import sdk from '../../../index'; +import dis from '../../../dispatcher'; +import { _t } from '../../../languageHandler'; +import Modal from '../../../Modal'; + +export default (props) => { + const _onLogoutClicked = () => { + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + Modal.createTrackedDialog('Logout e2e db too new', '', QuestionDialog, { + title: _t("Sign out"), + description: _t( + "To avoid losing your chat history, you must export your room keys " + + "before logging out. You will need to go back to the newer version of " + + "Riot to do this", + ), + button: _t("Sign out"), + focus: false, + onFinished: (doLogout) => { + if (doLogout) { + dis.dispatch({action: 'logout'}); + props.onFinished(); + } + }, + }); + }; + + const description = + _t("You've previously used a newer version of Riot on %(host)s. " + + "To use this version again with end to end encryption, you will " + + "need to sign out and back in again. ", + {host: props.host}, + ); + + const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); + return ( +
+ { description } +
+ + + +
); +};