mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 01:53:08 +02:00
Fix dark mode sync
This commit is contained in:
parent
9f49c663f8
commit
90ba51ee9c
1 changed files with 7 additions and 0 deletions
|
@ -19,6 +19,7 @@ import Dialog from './components/dialog.vue';
|
|||
import Menu from './components/menu.vue';
|
||||
import { router } from './router';
|
||||
import { applyTheme, lightTheme, builtinThemes } from './theme';
|
||||
import { isDeviceDarkmode } from './scripts/is-device-darkmode';
|
||||
|
||||
Vue.use(Vuex);
|
||||
Vue.use(VueHotkey);
|
||||
|
@ -144,11 +145,17 @@ os.init(async () => {
|
|||
}
|
||||
}, false)
|
||||
|
||||
//#region Sync dark mode
|
||||
if (os.store.state.device.syncDeviceDarkMode) {
|
||||
os.store.commit('device/set', { key: 'darkMode', value: isDeviceDarkmode() });
|
||||
}
|
||||
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addListener(mql => {
|
||||
if (os.store.state.device.syncDeviceDarkMode) {
|
||||
os.store.commit('device/set', { key: 'darkMode', value: mql.matches });
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
|
||||
if ('Notification' in window && os.store.getters.isSignedIn) {
|
||||
// 許可を得ていなかったらリクエスト
|
||||
|
|
Loading…
Reference in a new issue