2018-11-16 14:33:09 +03:00
|
|
|
/*
|
|
|
|
Copyright 2018 New Vector Ltd
|
2020-07-10 21:07:11 +03:00
|
|
|
Copyright 2020 The Matrix.org Foundation C.I.C.
|
2018-11-16 14:33:09 +03:00
|
|
|
|
|
|
|
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';
|
2020-05-14 05:41:41 +03:00
|
|
|
import dis from '../../../dispatcher/dispatcher';
|
2018-11-16 14:33:09 +03:00
|
|
|
import { _t } from '../../../languageHandler';
|
2020-07-10 21:07:11 +03:00
|
|
|
import SdkConfig from '../../../SdkConfig';
|
2018-11-16 14:33:09 +03:00
|
|
|
import Modal from '../../../Modal';
|
2021-07-02 18:19:01 +03:00
|
|
|
import BaseDialog from "./BaseDialog";
|
|
|
|
import DialogButtons from "../elements/DialogButtons";
|
|
|
|
import QuestionDialog from "./QuestionDialog";
|
2018-11-16 14:33:09 +03:00
|
|
|
|
2021-06-14 23:45:12 +03:00
|
|
|
interface IProps {
|
|
|
|
onFinished: (success: boolean) => void;
|
|
|
|
}
|
|
|
|
|
2021-07-02 18:25:30 +03:00
|
|
|
const CryptoStoreTooNewDialog: React.FC<IProps> = (props: IProps) => {
|
2020-07-10 21:07:11 +03:00
|
|
|
const brand = SdkConfig.get().brand;
|
|
|
|
|
2018-11-16 14:33:09 +03:00
|
|
|
const _onLogoutClicked = () => {
|
|
|
|
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 " +
|
2020-07-10 21:07:11 +03:00
|
|
|
"%(brand)s to do this",
|
|
|
|
{ brand },
|
2018-11-16 14:33:09 +03:00
|
|
|
),
|
|
|
|
button: _t("Sign out"),
|
|
|
|
focus: false,
|
|
|
|
onFinished: (doLogout) => {
|
|
|
|
if (doLogout) {
|
2021-06-29 15:11:58 +03:00
|
|
|
dis.dispatch({ action: 'logout' });
|
2021-06-14 23:45:12 +03:00
|
|
|
props.onFinished(true);
|
2018-11-16 14:33:09 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const description =
|
2020-07-10 21:07:11 +03:00
|
|
|
_t(
|
|
|
|
"You've previously used a newer version of %(brand)s with this session. " +
|
2018-11-16 14:33:09 +03:00
|
|
|
"To use this version again with end to end encryption, you will " +
|
2020-07-10 21:07:11 +03:00
|
|
|
"need to sign out and back in again.",
|
|
|
|
{ brand },
|
|
|
|
);
|
2018-11-16 14:33:09 +03:00
|
|
|
|
|
|
|
return (<BaseDialog className="mx_CryptoStoreTooNewDialog"
|
|
|
|
contentId='mx_Dialog_content'
|
|
|
|
title={_t("Incompatible Database")}
|
|
|
|
hasCancel={false}
|
|
|
|
onFinished={props.onFinished}
|
|
|
|
>
|
|
|
|
<div className="mx_Dialog_content" id='mx_Dialog_content'>
|
|
|
|
{ description }
|
|
|
|
</div>
|
|
|
|
<DialogButtons primaryButton={_t('Continue With Encryption Disabled')}
|
|
|
|
hasCancel={false}
|
|
|
|
onPrimaryButtonClick={props.onFinished}
|
|
|
|
>
|
2021-07-23 12:23:45 +03:00
|
|
|
<button onClick={_onLogoutClicked}>
|
2018-11-16 14:33:09 +03:00
|
|
|
{ _t('Sign out') }
|
|
|
|
</button>
|
|
|
|
</DialogButtons>
|
|
|
|
</BaseDialog>);
|
|
|
|
};
|
2021-07-02 18:25:30 +03:00
|
|
|
|
|
|
|
export default CryptoStoreTooNewDialog;
|