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:
parent
5e8d2748e0
commit
48a89a236a
4 changed files with 11 additions and 11 deletions
|
@ -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 brand = SdkConfig.get().brand;
|
||||||
const appVersion = this.state.appVersion || "unknown";
|
const appVersion = this.state.appVersion || "unknown";
|
||||||
const olmVersionTuple = this.context.olmVersion;
|
const cryptoVersion = this.context.getCrypto()?.getVersion() ?? "<not-enabled>";
|
||||||
const olmVersion = olmVersionTuple
|
|
||||||
? `${olmVersionTuple[0]}.${olmVersionTuple[1]}.${olmVersionTuple[2]}`
|
|
||||||
: "<not-enabled>";
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
appVersion: `${_t("setting|help_about|brand_version", { brand })} ${appVersion}`,
|
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 => {
|
private getVersionTextToCopy = (): string => {
|
||||||
const { appVersion, olmVersion } = this.getVersionInfo();
|
const { appVersion, cryptoVersion } = this.getVersionInfo();
|
||||||
return `${appVersion}\n${olmVersion}`;
|
return `${appVersion}\n${cryptoVersion}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
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 (
|
return (
|
||||||
<SettingsTab>
|
<SettingsTab>
|
||||||
|
@ -314,7 +311,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
|
||||||
<CopyableText getTextToCopy={this.getVersionTextToCopy}>
|
<CopyableText getTextToCopy={this.getVersionTextToCopy}>
|
||||||
{appVersion}
|
{appVersion}
|
||||||
<br />
|
<br />
|
||||||
{olmVersion}
|
{cryptoVersion}
|
||||||
<br />
|
<br />
|
||||||
</CopyableText>
|
</CopyableText>
|
||||||
{updateButton}
|
{updateButton}
|
||||||
|
|
|
@ -2385,11 +2385,11 @@
|
||||||
"brand_version": "%(brand)s version:",
|
"brand_version": "%(brand)s version:",
|
||||||
"chat_bot": "Chat with %(brand)s Bot",
|
"chat_bot": "Chat with %(brand)s Bot",
|
||||||
"clear_cache_reload": "Clear cache and reload",
|
"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": "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.",
|
"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>",
|
"homeserver": "Homeserver is <code>%(homeserverUrl)s</code>",
|
||||||
"identity_server": "Identity server is <code>%(identityServerUrl)s</code>",
|
"identity_server": "Identity server is <code>%(identityServerUrl)s</code>",
|
||||||
"olm_version": "Olm version:",
|
|
||||||
"title": "Help & About",
|
"title": "Help & About",
|
||||||
"versions": "Versions"
|
"versions": "Versions"
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import {
|
||||||
mockClientMethodsUser,
|
mockClientMethodsUser,
|
||||||
mockClientMethodsServer,
|
mockClientMethodsServer,
|
||||||
mockPlatformPeg,
|
mockPlatformPeg,
|
||||||
|
mockClientMethodsCrypto,
|
||||||
} from "../../../test-utils";
|
} from "../../../test-utils";
|
||||||
import { UIFeature } from "../../../../src/settings/UIFeature";
|
import { UIFeature } from "../../../../src/settings/UIFeature";
|
||||||
import { SettingLevel } from "../../../../src/settings/SettingLevel";
|
import { SettingLevel } from "../../../../src/settings/SettingLevel";
|
||||||
|
@ -70,6 +71,7 @@ describe("<UserSettingsDialog />", () => {
|
||||||
mockClient = getMockClientWithEventEmitter({
|
mockClient = getMockClientWithEventEmitter({
|
||||||
...mockClientMethodsUser(userId),
|
...mockClientMethodsUser(userId),
|
||||||
...mockClientMethodsServer(),
|
...mockClientMethodsServer(),
|
||||||
|
...mockClientMethodsCrypto(),
|
||||||
});
|
});
|
||||||
sdkContext = new SdkContextClass();
|
sdkContext = new SdkContextClass();
|
||||||
sdkContext.client = mockClient;
|
sdkContext.client = mockClient;
|
||||||
|
|
|
@ -168,5 +168,6 @@ export const mockClientMethodsCrypto = (): Partial<
|
||||||
isCrossSigningReady: jest.fn().mockResolvedValue(true),
|
isCrossSigningReady: jest.fn().mockResolvedValue(true),
|
||||||
isSecretStorageReady: jest.fn(),
|
isSecretStorageReady: jest.fn(),
|
||||||
getSessionBackupPrivateKey: jest.fn(),
|
getSessionBackupPrivateKey: jest.fn(),
|
||||||
|
getVersion: jest.fn().mockReturnValue("Version 0"),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue