diff --git a/src/tchap/components/views/settings/tabs/user/TchapHelpUserSettingsTab.tsx b/src/tchap/components/views/settings/tabs/user/TchapHelpUserSettingsTab.tsx index ed745c8786..fbf75e0d2c 100644 --- a/src/tchap/components/views/settings/tabs/user/TchapHelpUserSettingsTab.tsx +++ b/src/tchap/components/views/settings/tabs/user/TchapHelpUserSettingsTab.tsx @@ -20,7 +20,6 @@ import { logger } from "matrix-js-sdk/src/logger"; import AccessibleButton from "matrix-react-sdk/src/components/views/elements/AccessibleButton"; import { _t } from "matrix-react-sdk/src/languageHandler"; -import { MatrixClientPeg } from "matrix-react-sdk/src/MatrixClientPeg"; import SdkConfig from "matrix-react-sdk/src/SdkConfig"; import Modal from "matrix-react-sdk/src/Modal"; @@ -29,6 +28,7 @@ import UpdateCheckButton from "matrix-react-sdk/src/components/views/settings/Up import BugReportDialog from "matrix-react-sdk/src/components/views/dialogs/BugReportDialog"; import CopyableText from "matrix-react-sdk/src/components/views/elements/CopyableText"; import ExternalLink from "matrix-react-sdk/src/components/views/elements/ExternalLink"; +import MatrixClientContext from "matrix-react-sdk/src/contexts/MatrixClientContext"; interface IProps { closeSettingsFn: () => void; @@ -39,7 +39,12 @@ interface IState { canUpdate: boolean; } +//Tchap : This class is a replacement (via customizations) for matrix-react-sdk/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx export default class HelpUserSettingsTab extends React.Component { + //those lines instantiate the 'context' which is kind of a singleton for a matrix client + public static contextType = MatrixClientContext; + public context!: React.ContextType; + public constructor(props: IProps) { super(props); @@ -81,8 +86,8 @@ export default class HelpUserSettingsTab extends React.Component // Dev note: please keep this log line, it's useful when troubleshooting a MatrixClient suddenly // stopping in the middle of the logs. logger.log("Clear cache & reload clicked"); - MatrixClientPeg.get().stopClient(); - MatrixClientPeg.get() + this.context.stopClient(); + this.context .store.deleteAllData() .then(() => { PlatformPeg.get()?.reload(); @@ -192,8 +197,8 @@ export default class HelpUserSettingsTab extends React.Component } private getVersionTextToCopy = (): string => { - const { appVersion, olmVersion } = this.getVersionInfo(); - return `${appVersion}\n${olmVersion}`; + const { appVersion, cryptoVersion } = this.getVersionInfo(); + return `${appVersion}\n${cryptoVersion}`; }; /* :TCHAP: unused @@ -296,7 +301,7 @@ export default class HelpUserSettingsTab extends React.Component ); } - const { appVersion, olmVersion } = this.getVersionInfo(); + const { appVersion, cryptoVersion } = this.getVersionInfo(); // :TCHAP: add Contact us section, proper FAQ section, Known Issues section const supportEmail = "support@tchap.beta.gouv.fr"; @@ -398,7 +403,7 @@ export default class HelpUserSettingsTab extends React.Component {appVersion}
- {olmVersion} + {cryptoVersion}
{updateButton} @@ -413,7 +418,7 @@ export default class HelpUserSettingsTab extends React.Component {_t( "setting|help_about|homeserver", { - homeserverUrl: MatrixClientPeg.get().getHomeserverUrl(), + homeserverUrl: this.context.getHomeserverUrl(), }, { code: (sub) => {sub}, @@ -421,11 +426,11 @@ export default class HelpUserSettingsTab extends React.Component )}
- {MatrixClientPeg.get().getIdentityServerUrl() && + {this.context.getIdentityServerUrl() && _t( "setting|help_about|identity_server", { - identityServerUrl: MatrixClientPeg.get().getIdentityServerUrl(), + identityServerUrl: this.context.getIdentityServerUrl(), }, { code: (sub) => {sub}, @@ -439,8 +444,8 @@ export default class HelpUserSettingsTab extends React.Component "setting|help_about|access_token_detail", )} - MatrixClientPeg.get().getAccessToken()}> - {MatrixClientPeg.get().getAccessToken()} + this.context.getAccessToken()}> + {this.context.getAccessToken()}