initial dark mode not always set

typically can be seen on a fast connection to a NextCloud instance

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie3431d58cb2499464e1bfac95dcf3b981536a7a2
This commit is contained in:
Caolán McNamara 2024-05-14 15:11:38 +01:00 committed by Caolán McNamara
parent 0c7cb448ca
commit d42798abc6

View file

@ -243,6 +243,21 @@ app.definitions.Socket = L.Class.extend({
if (spellOnline) {
msg += ' spellOnline=' + spellOnline;
}
var docTypes = ['text', 'spreadsheet', 'presentation', 'drawing'];
for (var i = 0; i < docTypes.length; ++i) {
var docType = docTypes[i];
var darkTheme = false;
if (window.uiDefaults) {
darkTheme = window.uiDefaults.darkTheme === true;
}
var item = window.localStorage.getItem('UIDefaults_' + docType + '_darkTheme');
if (item) {
darkTheme = item;
}
if (darkTheme) {
msg += ' ' + docType + 'DarkTheme=' + darkTheme;
}
}
var accessibilityState = window.localStorage.getItem('accessibilityState') === 'true';
accessibilityState = accessibilityState || L.Browser.cypressTest;