Delabs Spaces, keeping it as a default-on preference for the time being

This commit is contained in:
Michael Telatynski 2021-08-11 14:52:40 +01:00
parent 40cf05a3ce
commit be85dcd1bf
14 changed files with 170 additions and 83 deletions

View file

@ -145,44 +145,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_spaces": {
isFeature: true,
displayName: _td("Spaces prototype. Incompatible with Communities, Communities v2 and Custom Tags. " +
"Requires compatible homeserver for some features."),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new ReloadOnChangeController(),
betaInfo: {
title: _td("Spaces"),
caption: _td("Spaces are a new way to group rooms and people."),
disclaimer: (enabled) => {
if (enabled) {
return <>
<p>{ _t("If you leave, %(brand)s will reload with Spaces disabled. " +
"Communities and custom tags will be visible again.", {
brand: SdkConfig.get().brand,
}) }</p>
<p>{ _t("Beta available for web, desktop and Android. Thank you for trying the beta.") }</p>
</>;
}
return <>
<p>{ _t("%(brand)s will reload with Spaces enabled. " +
"Communities and custom tags will be hidden.", {
brand: SdkConfig.get().brand,
}) }</p>
<b>{ _t("You can leave the beta any time from settings or tapping on a beta badge, " +
"like the one above.") }</b>
<p>{ _t("Beta available for web, desktop and Android. " +
"Some features may be unavailable on your homeserver.") }</p>
</>;
},
image: require("../../res/img/betas/spaces.png"),
feedbackSubheading: _td("Your feedback will help make spaces better. " +
"The more detail you can go into, the better."),
feedbackLabel: "spaces-feedback",
},
},
"feature_dnd": {
isFeature: true,
displayName: _td("Show options to enable 'Do not disturb' mode"),
@ -203,7 +165,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new IncompatibleController("feature_spaces"),
controller: new IncompatibleController("showCommunitiesInsteadOfSpaces", false, false),
},
"feature_pinning": {
isFeature: true,
@ -223,7 +185,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
displayName: _td("Group & filter rooms by custom tags (refresh to apply changes)"),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new IncompatibleController("feature_spaces"),
controller: new IncompatibleController("showCommunitiesInsteadOfSpaces", false, false),
},
"feature_state_counters": {
isFeature: true,
@ -769,6 +731,14 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: false,
},
"showCommunitiesInsteadOfSpaces": {
displayName: _td("Display Communities instead of Spaces"),
description: _td("Temporarily show communities instead of Spaces. " +
"Support for this will be removed in the near future. This will reload Element"),
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
default: false,
controller: new ReloadOnChangeController(),
},
[UIFeature.RoomHistorySettings]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
@ -832,7 +802,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
[UIFeature.Communities]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
controller: new IncompatibleController("feature_spaces"),
controller: new IncompatibleController("showCommunitiesInsteadOfSpaces", false, false),
},
[UIFeature.AdvancedSettings]: {
supportedLevels: LEVELS_UI_FEATURE,

View file

@ -24,7 +24,11 @@ import SettingsStore from "../SettingsStore";
* labs flags.
*/
export default class IncompatibleController extends SettingController {
public constructor(private settingName: string, private forcedValue = false) {
public constructor(
private settingName: string,
private forcedValue = false,
private incompatibleValue: any = true,
) {
super();
}
@ -34,13 +38,13 @@ export default class IncompatibleController extends SettingController {
calculatedValue: any,
calculatedAtLevel: SettingLevel,
): any {
if (this.incompatibleSettingEnabled) {
if (this.incompatibleSetting) {
return this.forcedValue;
}
return null; // no override
}
public get incompatibleSettingEnabled(): boolean {
return SettingsStore.getValue(this.settingName);
public get incompatibleSetting(): boolean {
return SettingsStore.getValue(this.settingName) === this.incompatibleValue;
}
}