From 48a89a236a2fd3a8e351c866196766256f5dac9c Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Wed, 25 Oct 2023 17:34:03 +0200 Subject: [PATCH] Element-R: Add current version of the rust-sdk and vodozemac (#11785) * Add current version of the rust-sdk and vodozemac * Use `CryptoAPI#getVersion` for old crypto * Update i18n * Fix test * Remove wrong comment --- .../settings/tabs/user/HelpUserSettingsTab.tsx | 17 +++++++---------- src/i18n/strings/en_EN.json | 2 +- .../views/dialogs/UserSettingsDialog-test.tsx | 2 ++ test/test-utils/client.ts | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx index 1b4ed9694e..85b04cf7a9 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx @@ -69,17 +69,14 @@ export default class HelpUserSettingsTab extends React.Component }); } - private getVersionInfo(): { appVersion: string; olmVersion: string } { + private getVersionInfo(): { appVersion: string; cryptoVersion: string } { const brand = SdkConfig.get().brand; const appVersion = this.state.appVersion || "unknown"; - const olmVersionTuple = this.context.olmVersion; - const olmVersion = olmVersionTuple - ? `${olmVersionTuple[0]}.${olmVersionTuple[1]}.${olmVersionTuple[2]}` - : ""; + const cryptoVersion = this.context.getCrypto()?.getVersion() ?? ""; return { appVersion: `${_t("setting|help_about|brand_version", { brand })} ${appVersion}`, - olmVersion: `${_t("setting|help_about|olm_version")} ${olmVersion}`, + cryptoVersion: `${_t("setting|help_about|crypto_version")} ${cryptoVersion}`, }; } @@ -220,8 +217,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}`; }; public render(): React.ReactNode { @@ -302,7 +299,7 @@ export default class HelpUserSettingsTab extends React.Component ); } - const { appVersion, olmVersion } = this.getVersionInfo(); + const { appVersion, cryptoVersion } = this.getVersionInfo(); return ( @@ -314,7 +311,7 @@ export default class HelpUserSettingsTab extends React.Component {appVersion}
- {olmVersion} + {cryptoVersion}
{updateButton} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 77648f0251..2ff6dd3bd6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2385,11 +2385,11 @@ "brand_version": "%(brand)s version:", "chat_bot": "Chat with %(brand)s Bot", "clear_cache_reload": "Clear cache and reload", + "crypto_version": "Crypto version:", "help_link": "For help with using %(brand)s, click here.", "help_link_chat_bot": "For help with using %(brand)s, click here or start a chat with our bot using the button below.", "homeserver": "Homeserver is %(homeserverUrl)s", "identity_server": "Identity server is %(identityServerUrl)s", - "olm_version": "Olm version:", "title": "Help & About", "versions": "Versions" } diff --git a/test/components/views/dialogs/UserSettingsDialog-test.tsx b/test/components/views/dialogs/UserSettingsDialog-test.tsx index 586288d2bd..a2cd034ba3 100644 --- a/test/components/views/dialogs/UserSettingsDialog-test.tsx +++ b/test/components/views/dialogs/UserSettingsDialog-test.tsx @@ -28,6 +28,7 @@ import { mockClientMethodsUser, mockClientMethodsServer, mockPlatformPeg, + mockClientMethodsCrypto, } from "../../../test-utils"; import { UIFeature } from "../../../../src/settings/UIFeature"; import { SettingLevel } from "../../../../src/settings/SettingLevel"; @@ -70,6 +71,7 @@ describe("", () => { mockClient = getMockClientWithEventEmitter({ ...mockClientMethodsUser(userId), ...mockClientMethodsServer(), + ...mockClientMethodsCrypto(), }); sdkContext = new SdkContextClass(); sdkContext.client = mockClient; diff --git a/test/test-utils/client.ts b/test/test-utils/client.ts index 2bd0643a11..9c00b22c3e 100644 --- a/test/test-utils/client.ts +++ b/test/test-utils/client.ts @@ -168,5 +168,6 @@ export const mockClientMethodsCrypto = (): Partial< isCrossSigningReady: jest.fn().mockResolvedValue(true), isSecretStorageReady: jest.fn(), getSessionBackupPrivateKey: jest.fn(), + getVersion: jest.fn().mockReturnValue("Version 0"), }), });