diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index d6ef3341da..a6f279be74 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -53,6 +53,7 @@ import createRoom from "../../createRoom"; import KeyRequestHandler from '../../KeyRequestHandler'; import { _t, getCurrentLanguage } from '../../languageHandler'; import SettingsStore, {SettingLevel} from "../../settings/SettingsStore"; +import ThemeController from "../../settings/controllers/ThemeController"; import { startAnyRegistrationFlow } from "../../Registration.js"; import { messageForSyncError } from '../../utils/ErrorUtils'; import ResizeNotifier from "../../utils/ResizeNotifier"; @@ -506,6 +507,8 @@ export default createReactClass({ view: VIEWS.LOGIN, }); this.notifyNewScreen('login'); + ThemeController.setIsLogin(true); + this._themeWatcher.recheck(); break; case 'start_post_registration': this.setState({ @@ -760,6 +763,8 @@ export default createReactClass({ } this.setStateForNewView(newState); + ThemeController.setIsLogin(true); + this._themeWatcher.recheck(); this.notifyNewScreen('register'); }, @@ -910,6 +915,8 @@ export default createReactClass({ view: VIEWS.WELCOME, }); this.notifyNewScreen('welcome'); + ThemeController.setIsLogin(true); + this._themeWatcher.recheck(); }, _viewHome: function() { @@ -919,6 +926,8 @@ export default createReactClass({ }); this._setPage(PageTypes.HomePage); this.notifyNewScreen('home'); + ThemeController.setIsLogin(false); + this._themeWatcher.recheck(); }, _viewUser: function(userId, subAction) { @@ -1231,6 +1240,8 @@ export default createReactClass({ }); this.subTitleStatus = ''; this._setPageSubtitle(); + ThemeController.setIsLogin(true); + this._themeWatcher.recheck(); }, /** diff --git a/src/settings/controllers/ThemeController.js b/src/settings/controllers/ThemeController.js index aae43673bf..1586ab7a7f 100644 --- a/src/settings/controllers/ThemeController.js +++ b/src/settings/controllers/ThemeController.js @@ -19,9 +19,17 @@ import SettingController from "./SettingController"; import {DEFAULT_THEME, enumerateThemes} from "../../theme"; export default class ThemeController extends SettingController { + static isLogin = false; + + static setIsLogin(val) { + ThemeController.isLogin = val; + } + getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) { if (!calculatedValue) return null; // Don't override null themes + if (ThemeController.isLogin) return 'light'; + const themes = enumerateThemes(); // Override in case some no longer supported theme is stored here if (!themes[calculatedValue]) {