add feature flag for cross-signing

This commit is contained in:
Bruno Windels 2023-02-10 17:35:45 +01:00
parent 551a9e0bc8
commit ab67a28c74
2 changed files with 11 additions and 1 deletions

View File

@ -29,7 +29,12 @@ export class FeaturesViewModel extends ViewModel {
name: this.i18n`Audio/video calls`,
description: this.i18n`Allows starting and participating in A/V calls compatible with Element Call (MSC3401). Look for the start call option in the room menu ((...) in the right corner) to start a call.`,
feature: FeatureFlag.Calls
})),
})),
new FeatureViewModel(this.childOptions({
name: this.i18n`Cross-Signing`,
description: this.i18n`Allows.verifying the identity of people you chat with`,
feature: FeatureFlag.CrossSigning
})),
];
}
}

View File

@ -18,6 +18,7 @@ import type {SettingsStorage} from "./platform/web/dom/SettingsStorage";
export enum FeatureFlag {
Calls = 1 << 0,
CrossSigning = 1 << 1
}
export class FeatureSet {
@ -39,6 +40,10 @@ export class FeatureSet {
return this.isFeatureEnabled(FeatureFlag.Calls);
}
get crossSigning(): boolean {
return this.isFeatureEnabled(FeatureFlag.CrossSigning);
}
static async load(settingsStorage: SettingsStorage): Promise<FeatureSet> {
const flags = await settingsStorage.getInt("enabled_features") || 0;
return new FeatureSet(flags);