This commit is contained in:
MaysWind 2021-02-11 13:45:58 +08:00
parent 220df6ca49
commit 9b312636bc
2 changed files with 7 additions and 1 deletions

View file

@ -40,7 +40,8 @@
var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)');
ariaNgLogService.info(matchPreferColorScheme)
ariaNgLogService.info('[root.setThemeBySystemSettings] system uses ' + (matchPreferColorScheme.matches ? 'dark' : 'light') + ' theme');
if (matchPreferColorScheme.matches) {
setDarkTheme();
} else {
@ -453,6 +454,8 @@
if (ariaNgSettingService.isBrowserSupportMatchMedia()) {
var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)');
matchPreferColorScheme.addEventListener('change', function (e) {
ariaNgLogService.info('[root] system switches to ' + (e.matches ? 'dark' : 'light') + ' theme');
if (ariaNgSettingService.getTheme() === 'system') {
if (e.matches) {
setDarkTheme();

View file

@ -86,6 +86,7 @@
var browserLang = $window.navigator.browserLanguage ? $window.navigator.browserLanguage : $window.navigator.language;
if (!browserLang) {
ariaNgLogService.info('[ariaNgSettingService] cannot get browser language, use default language');
return ariaNgDefaultOptions.language;
}
@ -113,9 +114,11 @@
}
if (!ariaNgLanguages[browserLang]) {
ariaNgLogService.info('[ariaNgSettingService] browser language \"' + browserLang + '\" not support, use default language');
return ariaNgDefaultOptions.language;
}
ariaNgLogService.info('[ariaNgSettingService] use browser language \"' + browserLang + '\" as current language');
return browserLang;
};