Merge pull request #929 from bitwarden/responsive-theme-change
Respond to OS theme changes
This commit is contained in:
commit
f0716c62d2
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 25a91313ad0441d1c02e043113f931f203fd57e6
|
Subproject commit b1d9b84eae451ec2edaf18b7256dd8361b0310ca
|
|
@ -156,11 +156,11 @@ export function initFactory(): Function {
|
||||||
htmlEl.classList.add('locale_' + i18nService.translationLocale);
|
htmlEl.classList.add('locale_' + i18nService.translationLocale);
|
||||||
let theme = await storageService.get<string>(ConstantsService.themeKey);
|
let theme = await storageService.get<string>(ConstantsService.themeKey);
|
||||||
if (theme == null) {
|
if (theme == null) {
|
||||||
if (platformUtilsService.getDevice() === DeviceType.MacOsDesktop) {
|
|
||||||
theme = await platformUtilsService.getDefaultSystemTheme();
|
theme = await platformUtilsService.getDefaultSystemTheme();
|
||||||
} else {
|
platformUtilsService.onDefaultSystemThemeChange(sysTheme => {
|
||||||
theme = 'light';
|
window.document.documentElement.classList.remove('theme_light', 'theme_dark');
|
||||||
}
|
window.document.documentElement.classList.add('theme_' + sysTheme);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
htmlEl.classList.add('theme_' + theme);
|
htmlEl.classList.add('theme_' + theme);
|
||||||
stateService.save(ConstantsService.disableFaviconKey,
|
stateService.save(ConstantsService.disableFaviconKey,
|
||||||
|
|
Loading…
Reference in New Issue