diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2020-02-18 21:20:43 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2020-02-18 21:20:43 +0000 |
| commit | 3ddf7ebe2c94f88be12644d7a7a675f6f8331707 (patch) | |
| tree | 878e90d5381ce14f9c3d88ab77e998ef6238760d /src/boot | |
| parent | 26e455bb4cadb90b4351f2a2e8f53eaa15d9e569 (diff) | |
| parent | 32902e01f80a2ff27e9f4fc5a922c47b63f397fd (diff) | |
Merge branch 'themes-accent' into 'develop'
Themes v3 Part 1 "2.1" codenamed "One step for themes, a giant burder for code reviewers"
Closes #750 and #774
See merge request pleroma/pleroma-fe!1037
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/after_store.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 4e043b35..d70e1058 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -5,6 +5,8 @@ import App from '../App.vue' import { windowWidth } from '../services/window_utils/window_utils' import { getOrCreateApp, getClientToken } from '../services/new_api/oauth.js' import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' +import { CURRENT_VERSION } from '../services/theme_data/theme_data.service.js' +import { applyTheme } from '../services/style_setter/style_setter.js' const getStatusnetConfig = async ({ store }) => { try { @@ -265,7 +267,7 @@ const checkOAuthToken = async ({ store }) => { try { await store.dispatch('loginUser', store.getters.getUserToken()) } catch (e) { - console.log(e) + console.error(e) } } resolve() @@ -273,23 +275,29 @@ const checkOAuthToken = async ({ store }) => { } const afterStoreSetup = async ({ store, i18n }) => { - if (store.state.config.customTheme) { - // This is a hack to deal with async loading of config.json and themes - // See: style_setter.js, setPreset() - window.themeLoaded = true - store.dispatch('setOption', { - name: 'customTheme', - value: store.state.config.customTheme - }) - } - const width = windowWidth() store.dispatch('setMobileLayout', width <= 800) + await setConfig({ store }) + + const { customTheme, customThemeSource } = store.state.config + const { theme } = store.state.instance + const customThemePresent = customThemeSource || customTheme + + if (customThemePresent) { + if (customThemeSource && customThemeSource.themeEngineVersion === CURRENT_VERSION) { + applyTheme(customThemeSource) + } else { + applyTheme(customTheme) + } + } else if (theme) { + // do nothing, it will load asynchronously + } else { + console.error('Failed to load any theme!') + } // Now we can try getting the server settings and logging in await Promise.all([ checkOAuthToken({ store }), - setConfig({ store }), getTOS({ store }), getInstancePanel({ store }), getStickers({ store }), |
