Merge branch 'develop' into sw-notification-action
This commit is contained in:
@@ -47,7 +47,7 @@ if (localStorage.getItem('accounts') != null) {
|
||||
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import { Integrations } from '@sentry/tracing';
|
||||
import { createApp, toRaw, watch } from 'vue';
|
||||
import { computed, createApp, watch } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
import widgets from '@client/widgets';
|
||||
@@ -66,7 +66,6 @@ import { fetchInstance, instance } from '@client/instance';
|
||||
import { makeHotkey } from '@client/scripts/hotkey';
|
||||
import { search } from '@client/scripts/search';
|
||||
import { isMobile } from '@client/scripts/is-mobile';
|
||||
import { getThemes } from '@client/theme-store';
|
||||
import { initializeSw } from '@client/scripts/initialize-sw';
|
||||
import { reload, reloadChannel } from '@client/scripts/unison-reload';
|
||||
import { reactionPicker } from '@client/scripts/reaction-picker';
|
||||
@@ -79,6 +78,13 @@ console.info(`Misskey v${version}`);
|
||||
window.onerror = null;
|
||||
window.onunhandledrejection = null;
|
||||
|
||||
// 後方互換性のため。
|
||||
// TODO: そのうち消す
|
||||
if ((typeof ColdDeviceStorage.get('lightTheme') === 'string') || (typeof ColdDeviceStorage.get('darkTheme') === 'string')) {
|
||||
ColdDeviceStorage.set('lightTheme', require('@client/themes/l-light.json5'));
|
||||
ColdDeviceStorage.set('darkTheme', require('@client/themes/d-dark.json5'));
|
||||
}
|
||||
|
||||
if (_DEV_) {
|
||||
console.warn('Development mode!!!');
|
||||
|
||||
@@ -222,6 +228,7 @@ const app = createApp(await (
|
||||
ui === 'deck' ? import('@client/ui/deck.vue') :
|
||||
ui === 'desktop' ? import('@client/ui/desktop.vue') :
|
||||
ui === 'chat' ? import('@client/ui/chat/index.vue') :
|
||||
ui === 'pope' ? import('@client/ui/universal.vue') :
|
||||
import('@client/ui/default.vue')
|
||||
).then(x => x.default));
|
||||
|
||||
@@ -265,12 +272,24 @@ if (splash) {
|
||||
}
|
||||
|
||||
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
||||
import('@client/scripts/theme').then(({ builtinThemes }) => {
|
||||
const themes = builtinThemes.concat(getThemes());
|
||||
applyTheme(themes.find(x => x.id === (darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'))));
|
||||
});
|
||||
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
||||
}, { immediate: localStorage.theme == null });
|
||||
|
||||
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
||||
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
||||
|
||||
watch(darkTheme, (theme) => {
|
||||
if (defaultStore.state.darkMode) {
|
||||
applyTheme(theme);
|
||||
}
|
||||
});
|
||||
|
||||
watch(lightTheme, (theme) => {
|
||||
if (!defaultStore.state.darkMode) {
|
||||
applyTheme(theme);
|
||||
}
|
||||
});
|
||||
|
||||
//#region Sync dark mode
|
||||
if (ColdDeviceStorage.get('syncDeviceDarkMode')) {
|
||||
defaultStore.set('darkMode', isDeviceDarkmode());
|
||||
|
Reference in New Issue
Block a user