use separate action for setting Theme V2
This commit is contained in:
parent
cd92eb56e0
commit
e029732021
|
@ -499,18 +499,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setCustomTheme () {
|
setCustomTheme () {
|
||||||
this.$store.dispatch('setOption', {
|
this.$store.dispatch('setThemeV2', {
|
||||||
name: 'customTheme',
|
customTheme: {
|
||||||
value: {
|
|
||||||
ignore: true,
|
ignore: true,
|
||||||
themeFileVersion: this.selectedVersion,
|
themeFileVersion: this.selectedVersion,
|
||||||
themeEngineVersion: CURRENT_VERSION,
|
themeEngineVersion: CURRENT_VERSION,
|
||||||
...this.previewTheme
|
...this.previewTheme
|
||||||
}
|
},
|
||||||
})
|
customThemeSource: {
|
||||||
this.$store.dispatch('setOption', {
|
|
||||||
name: 'customThemeSource',
|
|
||||||
value: {
|
|
||||||
themeFileVersion: this.selectedVersion,
|
themeFileVersion: this.selectedVersion,
|
||||||
themeEngineVersion: CURRENT_VERSION,
|
themeEngineVersion: CURRENT_VERSION,
|
||||||
shadows: this.shadowsLocal,
|
shadows: this.shadowsLocal,
|
||||||
|
|
|
@ -255,6 +255,11 @@ const config = {
|
||||||
revert
|
revert
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
setThemeV2 ({ commit, dispatch }, { customTheme, customThemeSource }) {
|
||||||
|
commit('setOption', { name: 'customTheme', value: customTheme })
|
||||||
|
commit('setOption', { name: 'customThemeSource', value: customThemeSource })
|
||||||
|
dispatch('setTheme', { themeData: customThemeSource, recompile: true })
|
||||||
|
},
|
||||||
setOption ({ commit, dispatch, state }, { name, value }) {
|
setOption ({ commit, dispatch, state }, { name, value }) {
|
||||||
const exceptions = new Set([
|
const exceptions = new Set([
|
||||||
'useStreamingApi'
|
'useStreamingApi'
|
||||||
|
@ -272,6 +277,7 @@ const config = {
|
||||||
dispatch('disableMastoSockets')
|
dispatch('disableMastoSockets')
|
||||||
dispatch('setOption', { name: 'useStreamingApi', value: false })
|
dispatch('setOption', { name: 'useStreamingApi', value: false })
|
||||||
})
|
})
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -286,11 +292,6 @@ const config = {
|
||||||
case 'theme':
|
case 'theme':
|
||||||
dispatch('setTheme', { themeName: value, recompile: true })
|
dispatch('setTheme', { themeName: value, recompile: true })
|
||||||
break
|
break
|
||||||
case 'customTheme':
|
|
||||||
case 'customThemeSource': {
|
|
||||||
if (!value.ignore) dispatch('setTheme', { themeData: value })
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case 'themeDebug': {
|
case 'themeDebug': {
|
||||||
dispatch('setTheme', { recompile: true })
|
dispatch('setTheme', { recompile: true })
|
||||||
break
|
break
|
||||||
|
|
|
@ -255,10 +255,8 @@ const interfaceMod = {
|
||||||
let promise = null
|
let promise = null
|
||||||
|
|
||||||
if (themeName) {
|
if (themeName) {
|
||||||
// commit('setInstanceOption', { name: 'theme', value: themeName })
|
|
||||||
promise = getPreset(themeName)
|
promise = getPreset(themeName)
|
||||||
.then(themeData => {
|
.then(themeData => {
|
||||||
// commit('setInstanceOption', { name: 'themeData', value: themeData })
|
|
||||||
return normalizeThemeData(themeData)
|
return normalizeThemeData(themeData)
|
||||||
})
|
})
|
||||||
} else if (themeData) {
|
} else if (themeData) {
|
||||||
|
|
Loading…
Reference in a new issue