Right panel store refactor (#7313)
Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
This commit is contained in:
parent
8e881336ab
commit
325e2ba99b
42 changed files with 765 additions and 811 deletions
|
@ -32,7 +32,6 @@ import SystemFontController from './controllers/SystemFontController';
|
|||
import UseSystemFontController from './controllers/UseSystemFontController';
|
||||
import { SettingLevel } from "./SettingLevel";
|
||||
import SettingController from "./controllers/SettingController";
|
||||
import { RightPanelPhases } from "../stores/RightPanelStorePhases";
|
||||
import { isMac } from '../Keyboard';
|
||||
import UIFeatureController from "./controllers/UIFeatureController";
|
||||
import { UIFeature } from "./UIFeature";
|
||||
|
@ -771,21 +770,13 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
|||
displayName: _td("Show previews/thumbnails for images"),
|
||||
default: true,
|
||||
},
|
||||
"showRightPanelInRoom": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
default: false,
|
||||
"RightPanel.phasesGlobal": {
|
||||
supportedLevels: [SettingLevel.DEVICE],
|
||||
default: null,
|
||||
},
|
||||
"showRightPanelInGroup": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
default: false,
|
||||
},
|
||||
"lastRightPanelPhaseForRoom": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
default: RightPanelPhases.RoomSummary,
|
||||
},
|
||||
"lastRightPanelPhaseForGroup": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
default: RightPanelPhases.GroupMemberList,
|
||||
"RightPanel.phases": {
|
||||
supportedLevels: [SettingLevel.ROOM_DEVICE],
|
||||
default: null,
|
||||
},
|
||||
"enableEventIndexing": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
|
|
|
@ -57,17 +57,6 @@ export default class DeviceSettingsHandler extends SettingsHandler {
|
|||
return null; // wrong type or otherwise not set
|
||||
}
|
||||
|
||||
// Special case the right panel - see `setValue` for rationale.
|
||||
if ([
|
||||
"showRightPanelInRoom",
|
||||
"showRightPanelInGroup",
|
||||
"lastRightPanelPhaseForRoom",
|
||||
"lastRightPanelPhaseForGroup",
|
||||
].includes(settingName)) {
|
||||
const val = JSON.parse(localStorage.getItem(`mx_${settingName}`) || "{}");
|
||||
return val['value'];
|
||||
}
|
||||
|
||||
// Special case for old useIRCLayout setting
|
||||
if (settingName === "layout") {
|
||||
const settings = this.getSettings() || {};
|
||||
|
@ -106,20 +95,6 @@ export default class DeviceSettingsHandler extends SettingsHandler {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// Special case the right panel because we want to be able to update these all
|
||||
// concurrently without stomping on one another. We could use async/await, though
|
||||
// that introduces just enough latency to be annoying.
|
||||
if ([
|
||||
"showRightPanelInRoom",
|
||||
"showRightPanelInGroup",
|
||||
"lastRightPanelPhaseForRoom",
|
||||
"lastRightPanelPhaseForGroup",
|
||||
].includes(settingName)) {
|
||||
localStorage.setItem(`mx_${settingName}`, JSON.stringify({ value: newValue }));
|
||||
this.watchers.notifyUpdate(settingName, null, SettingLevel.DEVICE, newValue);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// Special case for old useIRCLayout setting
|
||||
if (settingName === "layout") {
|
||||
const settings = this.getSettings() || {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue