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';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../../index';
|
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';
|
|
|
|
|
|
|
|
export default (props) => {
|
2020-07-10 21:07:11 +03:00
|
|
|
const brand = SdkConfig.get().brand;
|
|
|
|
|
2018-11-16 14:33:09 +03:00
|
|
|
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 " +
|
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) {
|
|
|
|
dis.dispatch({action: 'logout'});
|
|
|
|
props.onFinished();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
|
|
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
|
|
|
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}
|
|
|
|
>
|
|
|
|
<button onClick={_onLogoutClicked} >
|
|
|
|
{ _t('Sign out') }
|
|
|
|
</button>
|
|
|
|
</DialogButtons>
|
|
|
|
</BaseDialog>);
|
|
|
|
};
|