add log
This commit is contained in:
parent
220df6ca49
commit
9b312636bc
|
@ -40,7 +40,8 @@
|
||||||
|
|
||||||
var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)');
|
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) {
|
if (matchPreferColorScheme.matches) {
|
||||||
setDarkTheme();
|
setDarkTheme();
|
||||||
} else {
|
} else {
|
||||||
|
@ -453,6 +454,8 @@
|
||||||
if (ariaNgSettingService.isBrowserSupportMatchMedia()) {
|
if (ariaNgSettingService.isBrowserSupportMatchMedia()) {
|
||||||
var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)');
|
var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
matchPreferColorScheme.addEventListener('change', function (e) {
|
matchPreferColorScheme.addEventListener('change', function (e) {
|
||||||
|
ariaNgLogService.info('[root] system switches to ' + (e.matches ? 'dark' : 'light') + ' theme');
|
||||||
|
|
||||||
if (ariaNgSettingService.getTheme() === 'system') {
|
if (ariaNgSettingService.getTheme() === 'system') {
|
||||||
if (e.matches) {
|
if (e.matches) {
|
||||||
setDarkTheme();
|
setDarkTheme();
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
var browserLang = $window.navigator.browserLanguage ? $window.navigator.browserLanguage : $window.navigator.language;
|
var browserLang = $window.navigator.browserLanguage ? $window.navigator.browserLanguage : $window.navigator.language;
|
||||||
|
|
||||||
if (!browserLang) {
|
if (!browserLang) {
|
||||||
|
ariaNgLogService.info('[ariaNgSettingService] cannot get browser language, use default language');
|
||||||
return ariaNgDefaultOptions.language;
|
return ariaNgDefaultOptions.language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,9 +114,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ariaNgLanguages[browserLang]) {
|
if (!ariaNgLanguages[browserLang]) {
|
||||||
|
ariaNgLogService.info('[ariaNgSettingService] browser language \"' + browserLang + '\" not support, use default language');
|
||||||
return ariaNgDefaultOptions.language;
|
return ariaNgDefaultOptions.language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ariaNgLogService.info('[ariaNgSettingService] use browser language \"' + browserLang + '\" as current language');
|
||||||
return browserLang;
|
return browserLang;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in a new issue