Skip to content

Commit 7294bec

Browse files
committed
Use new theme API in react-sdk
A thesis presented in two parts. This part has the absolute minimum logic changes to the themeing code in vector/index.js because I know how subtle and fragile this code is. However, it also looks like it's completely duplicated from react-sdk, so in the next part I'm going to remove that logic and make it use the logic in react-sdk, then we can see what breaks. Requires matrix-org/matrix-react-sdk#3637
1 parent 3cf4d15 commit 7294bec

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/vector/index.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import WebPlatform from './platform/WebPlatform';
5757
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
5858
import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
5959
import SdkConfig from "matrix-react-sdk/lib/SdkConfig";
60-
import {getBaseTheme, setTheme} from "matrix-react-sdk/lib/theme";
60+
import {getBaseTheme, setTheme, ThemeWatcher} from "matrix-react-sdk/lib/theme";
6161

6262
import Olm from 'olm';
6363

@@ -258,7 +258,8 @@ async function loadApp() {
258258
// we do this by checking to see if the theme's "base" has loaded first so we can
259259
// safely rely on the assets.
260260
let a;
261-
const theme = SettingsStore.getValue("theme");
261+
const themeWatcher = new ThemeWatcher();
262+
const theme = themeWatcher.getEffectiveTheme();
262263
const baseTheme = getBaseTheme(theme);
263264
for (let i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
264265
const href = a.getAttribute("href");

0 commit comments

Comments
 (0)