support custom themes from setting

also move theme setting code from MatrixChat to own file.
This commit is contained in:
Bruno Windels 2019-10-01 15:21:22 +02:00
parent 79d4434c9f
commit 558f8daeeb
6 changed files with 151 additions and 107 deletions

View file

@ -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;
}