From 4db4625e34e1d9991ce922b5efc192815385691e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 28 Jul 2020 11:37:59 -0600 Subject: [PATCH] Move SettingLevel to its own file --- src/settings/SettingLevel.ts | 29 +++++++++++++++++++++++++++++ src/settings/SettingsStore.js | 15 +++------------ 2 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 src/settings/SettingLevel.ts diff --git a/src/settings/SettingLevel.ts b/src/settings/SettingLevel.ts new file mode 100644 index 0000000000..e4703be1a9 --- /dev/null +++ b/src/settings/SettingLevel.ts @@ -0,0 +1,29 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/** + * Represents the various setting levels supported by the SettingsStore. + */ +export enum SettingLevel { + // TODO: [TS] Follow naming convention + DEVICE = "device", + ROOM_DEVICE = "room-device", + ROOM_ACCOUNT = "room-account", + ACCOUNT = "account", + ROOM = "room", + CONFIG = "config", + DEFAULT = "default", +} diff --git a/src/settings/SettingsStore.js b/src/settings/SettingsStore.js index 488a15d003..a2e2fbadfc 100644 --- a/src/settings/SettingsStore.js +++ b/src/settings/SettingsStore.js @@ -28,21 +28,12 @@ import dis from '../dispatcher/dispatcher'; import {SETTINGS} from "./Settings"; import LocalEchoWrapper from "./handlers/LocalEchoWrapper"; import {WatchManager} from "./WatchManager"; +import {SettingLevel as SL2} from "./SettingLevel"; /** - * Represents the various setting levels supported by the SettingsStore. + * @deprecated Use SettingLevel directly */ -export const SettingLevel = { - // Note: This enum is not used in this class or in the Settings file - // This should always be used elsewhere in the project. - DEVICE: "device", - ROOM_DEVICE: "room-device", - ROOM_ACCOUNT: "room-account", - ACCOUNT: "account", - ROOM: "room", - CONFIG: "config", - DEFAULT: "default", -}; +export const SettingLevel = SL2; const defaultWatchManager = new WatchManager();