refs #921 Restart all user streamings when reload
This commit is contained in:
parent
1b5c9cee32
commit
5201a65b9f
|
@ -484,6 +484,15 @@ ipcMain.on('start-all-user-streamings', (event: Event, accounts: Array<LocalAcco
|
|||
})
|
||||
})
|
||||
|
||||
ipcMain.on('stop-all-user-streamings', () => {
|
||||
Object.keys(userStreamings).map((key: string) => {
|
||||
if (userStreamings[key]) {
|
||||
userStreamings[key]!.stop()
|
||||
userStreamings[key] = null
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// streaming
|
||||
let userStreaming: StreamingManager | null = null
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ export default {
|
|||
this.$store.commit('TimelineSpace/HeaderMenu/changeReload', true)
|
||||
break
|
||||
default:
|
||||
console.log('Not implemented')
|
||||
console.error('Not implemented')
|
||||
}
|
||||
},
|
||||
reloadable() {
|
||||
|
|
|
@ -2,17 +2,19 @@
|
|||
export default {
|
||||
name: 'reloadable',
|
||||
methods: {
|
||||
async reloadable () {
|
||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
||||
async reloadable() {
|
||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch(err => {
|
||||
this.$message({
|
||||
message: this.$t('message.account_load_error'),
|
||||
type: 'error'
|
||||
})
|
||||
throw err
|
||||
})
|
||||
await this.$store.dispatch('GlobalHeader/stopUserStreamings')
|
||||
await this.$store.dispatch('TimelineSpace/stopStreamings')
|
||||
await this.$store.dispatch('TimelineSpace/fetchContentsTimelines', account)
|
||||
await this.$store.dispatch('TimelineSpace/startStreamings', account)
|
||||
await this.$store.dispatch('TimelineSpace/fetchContentsTimelines')
|
||||
await this.$store.dispatch('TimelineSpace/startStreamings')
|
||||
this.$store.dispatch('GlobalHeader/startUserStreamings')
|
||||
return account
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,9 @@ const actions: ActionTree<GlobalHeaderState, RootState> = {
|
|||
ipcRenderer.send('start-all-user-streamings', state.accounts)
|
||||
})
|
||||
},
|
||||
stopUserStreamings: () => {
|
||||
ipcRenderer.send('stop-all-user-streamings')
|
||||
},
|
||||
bindUserStreamingsForNotify: ({ rootState }) => {
|
||||
ipcRenderer.on('notification-start-all-user-streamings', (_, accountNotification: AccountNotification) => {
|
||||
const { id, notification } = accountNotification
|
||||
|
|
|
@ -118,7 +118,7 @@ const actions: ActionTree<TimelineSpaceState, RootState> = {
|
|||
dispatch('TimelineSpace/SideMenu/fetchFollowRequests', account, { root: true })
|
||||
await dispatch('loadUnreadNotification', accountId)
|
||||
commit(MUTATION_TYPES.CHANGE_LOADING, false)
|
||||
await dispatch('fetchContentsTimelines', account).catch(_ => {
|
||||
await dispatch('fetchContentsTimelines').catch(_ => {
|
||||
throw new TimelineFetchError()
|
||||
})
|
||||
return account
|
||||
|
|
Loading…
Reference in New Issue