support custom themes from setting
also move theme setting code from MatrixChat to own file.
This commit is contained in:
parent
79d4434c9f
commit
558f8daeeb
6 changed files with 151 additions and 107 deletions
|
@ -245,6 +245,10 @@ export const SETTINGS = {
|
|||
default: "light",
|
||||
controller: new ThemeController(),
|
||||
},
|
||||
"custom_themes": {
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
default: [],
|
||||
},
|
||||
"webRtcAllowPeerToPeer": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
||||
displayName: _td('Allow Peer-to-Peer for 1:1 calls'),
|
||||
|
|
|
@ -16,12 +16,13 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import SettingController from "./SettingController";
|
||||
import {DEFAULT_THEME, THEMES} from "../../themes";
|
||||
import {DEFAULT_THEME, enumerateThemes} from "../../theme";
|
||||
|
||||
export default class ThemeController extends SettingController {
|
||||
getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) {
|
||||
const themes = enumerateThemes();
|
||||
// Override in case some no longer supported theme is stored here
|
||||
if (!THEMES[calculatedValue]) {
|
||||
if (!themes[calculatedValue]) {
|
||||
return DEFAULT_THEME;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue