@@ -57,7 +57,7 @@ import WebPlatform from './platform/WebPlatform';
5757import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg' ;
5858import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore" ;
5959import SdkConfig from "matrix-react-sdk/lib/SdkConfig" ;
60- import { getBaseTheme , setTheme , ThemeWatcher } from "matrix-react-sdk/lib/theme" ;
60+ import { setTheme } from "matrix-react-sdk/lib/theme" ;
6161
6262import Olm from 'olm' ;
6363
@@ -255,54 +255,7 @@ async function loadApp() {
255255 }
256256
257257 // as quickly as we possibly can, set a default theme...
258- // we do this by checking to see if the theme's "base" has loaded first so we can
259- // safely rely on the assets.
260- let a ;
261- const themeWatcher = new ThemeWatcher ( ) ;
262- const theme = themeWatcher . getEffectiveTheme ( ) ;
263- const baseTheme = getBaseTheme ( theme ) ;
264- for ( let i = 0 ; ( a = document . getElementsByTagName ( "link" ) [ i ] ) ; i ++ ) {
265- const href = a . getAttribute ( "href" ) ;
266- if ( ! href ) continue ;
267- // shouldn't we be using the 'title' tag rather than the href?
268- const match = href . match ( / ^ b u n d l e s \/ .* \/ t h e m e - ( .* ) \. c s s $ / ) ;
269- if ( match ) {
270- if ( match [ 1 ] === baseTheme ) {
271- // remove the disabled flag off the stylesheet
272-
273- // Firefox requires setting the attribute to false, so do
274- // that instead of removing it. Related:
275- // https://bugzilla.mozilla.org/show_bug.cgi?id=1281135
276- a . disabled = false ;
277-
278- // in case the Tinter.tint() in MatrixChat fires before the
279- // CSS has actually loaded (which in practice happens)...
280-
281- // This if fixes setTheme to not fire on Firefox
282- // in case it is the first time loading Riot.
283- // `InstallTrigger` is a Object which only exists on Firefox
284- // (it is used for their Plugins) and can be used as a
285- // feature check.
286- // Firefox loads css always before js. This is why we dont use
287- // onload or it's EventListener as those will never trigger.
288- if ( typeof InstallTrigger !== 'undefined' ) {
289- setTheme ( theme ) ;
290- } else {
291- // FIXME: we should probably block loading the app or even
292- // showing a spinner until the theme is loaded, to avoid
293- // flashes of unstyled content.
294- a . onload = ( ) => {
295- setTheme ( theme ) ;
296- } ;
297- }
298- } else {
299- // Firefox requires this to not be done via `setAttribute`
300- // or via HTML.
301- // https://bugzilla.mozilla.org/show_bug.cgi?id=1281135
302- a . disabled = true ;
303- }
304- }
305- }
258+ await setTheme ( ) ;
306259
307260 // Now that we've loaded the theme (CSS), display the config syntax error if needed.
308261 if ( configSyntaxError ) {
0 commit comments