Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Element-R: Add current version of the rust-sdk and vodozemac #11785

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm renaming the Olm Version: x.x.x field to:

  • old crypto: Crypto Version: Olm x.x.x
  • new crypto: Crypto Version: Rust SDK xxx, Vodozemac xxx

};
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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>
Expand All @@ -314,7 +311,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
<CopyableText getTextToCopy={this.getVersionTextToCopy}>
{appVersion}
<br />
{olmVersion}
{cryptoVersion}
<br />
</CopyableText>
{updateButton}
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 2 additions & 0 deletions test/components/views/dialogs/UserSettingsDialog-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
mockClientMethodsUser,
mockClientMethodsServer,
mockPlatformPeg,
mockClientMethodsCrypto,
} from "../../../test-utils";
import { UIFeature } from "../../../../src/settings/UIFeature";
import { SettingLevel } from "../../../../src/settings/SettingLevel";
Expand Down Expand Up @@ -70,6 +71,7 @@ describe("<UserSettingsDialog />", () => {
mockClient = getMockClientWithEventEmitter({
...mockClientMethodsUser(userId),
...mockClientMethodsServer(),
...mockClientMethodsCrypto(),
});
sdkContext = new SdkContextClass();
sdkContext.client = mockClient;
Expand Down
1 change: 1 addition & 0 deletions test/test-utils/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a mock of olmVersion somewhere which we can get rid of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no mock of olmVersion, the value was directly read on the MatrixClient, so undefined in the test

}),
});
Loading