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
This commit is contained in:
Florian Duros 2023-10-25 17:34:03 +02:00 committed by GitHub
parent 5e8d2748e0
commit 48a89a236a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View File

@ -69,17 +69,14 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
});
}
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]}`
: "<not-enabled>";
const cryptoVersion = this.context.getCrypto()?.getVersion() ?? "<not-enabled>";
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<IProps, IState>
}
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<IProps, IState>
);
}
const { appVersion, olmVersion } = this.getVersionInfo();
const { appVersion, cryptoVersion } = this.getVersionInfo();
return (
<SettingsTab>
@ -314,7 +311,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
<CopyableText getTextToCopy={this.getVersionTextToCopy}>
{appVersion}
<br />
{olmVersion}
{cryptoVersion}
<br />
</CopyableText>
{updateButton}

View File

@ -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 <a>here</a>.",
"help_link_chat_bot": "For help with using %(brand)s, click <a>here</a> or start a chat with our bot using the button below.",
"homeserver": "Homeserver is <code>%(homeserverUrl)s</code>",
"identity_server": "Identity server is <code>%(identityServerUrl)s</code>",
"olm_version": "Olm version:",
"title": "Help & About",
"versions": "Versions"
}

View File

@ -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("<UserSettingsDialog />", () => {
mockClient = getMockClientWithEventEmitter({
...mockClientMethodsUser(userId),
...mockClientMethodsServer(),
...mockClientMethodsCrypto(),
});
sdkContext = new SdkContextClass();
sdkContext.client = mockClient;

View File

@ -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"),
}),
});