refs #625 Load hide/show status when reopen app

This commit is contained in:
AkiraFukushima 2018-10-23 22:21:04 +09:00
parent b21ccd9152
commit b2fb2206b0
4 changed files with 15 additions and 17 deletions

View File

@ -50,6 +50,7 @@ export default {
},
async initialize () {
await this.$store.dispatch('GlobalHeader/removeShortcutEvents')
this.$store.dispatch('GlobalHeader/loadHide')
this.$store.dispatch('GlobalHeader/watchShortcutEvents')
try {
const accounts = await this.$store.dispatch('GlobalHeader/listAccounts')

View File

@ -109,12 +109,12 @@ export default {
unreadLocalTimeline: state => state.unreadLocalTimeline,
lists: state => state.lists,
tags: state => state.tags,
collapse: state => state.collapse,
hideGlobalHeader: state => state.hideGlobalHeader
collapse: state => state.collapse
}),
...mapState({
account: state => state.TimelineSpace.account,
themeColor: state => state.App.theme.side_menu_color
themeColor: state => state.App.theme.side_menu_color,
hideGlobalHeader: state => state.GlobalHeader.hide
})
},
created () {
@ -151,7 +151,7 @@ export default {
this.$store.dispatch('TimelineSpace/SideMenu/changeCollapse', false)
},
changeGlobalHeader (value) {
this.$store.dispatch('TimelineSpace/SideMenu/changeGlobalHeader', value)
this.$store.dispatch('GlobalHeader/switchHide', value)
}
}
}
@ -270,6 +270,8 @@ export default {
position: fixed;
bottom: 0;
color: #dcdfe6;
margin: 0;
padding: 0;
}
}
</style>

View File

@ -67,11 +67,17 @@ const GlobalHeader = {
ipcRenderer.removeAllListeners('change-account')
return 'removeShortcutEvents'
},
reloadHide ({ commit }) {
loadHide ({ commit }) {
ipcRenderer.send('get-global-header')
ipcRenderer.once('response-get-global-header', (event, value) => {
commit('changeHide', value)
})
},
switchHide ({ dispatch }, value) {
ipcRenderer.send('change-global-header', value)
ipcRenderer.once('response-change-global-header', (event, _) => {
dispatch('loadHide')
})
}
}
}

View File

@ -9,8 +9,7 @@ const SideMenu = {
unreadLocalTimeline: false,
lists: [],
tags: [],
collapse: false,
hideGlobalHeader: false
collapse: false
},
mutations: {
changeUnreadHomeTimeline (state, value) {
@ -30,9 +29,6 @@ const SideMenu = {
},
updateTags (state, tags) {
state.tags = tags
},
changeGlobalHeader (state, hide) {
state.hideGlobalHeader = hide
}
},
actions: {
@ -57,13 +53,6 @@ const SideMenu = {
commit('changeCollapse', value)
ipcRenderer.send('change-collapse', value)
},
changeGlobalHeader ({ commit, dispatch }, value) {
commit('changeGlobalHeader', value)
ipcRenderer.send('change-global-header', value)
ipcRenderer.once('response-change-global-header', (event, _) => {
dispatch('GlobalHeader/reloadHide', {}, { root: true })
})
},
readCollapse ({ commit }) {
ipcRenderer.send('get-collapse')
ipcRenderer.once('response-get-collapse', (event, value) => {