refs #769 Switch list streaming method

This commit is contained in:
AkiraFukushima 2018-12-18 23:26:59 +09:00
parent 13eaa22832
commit c94bfce7eb
2 changed files with 8 additions and 6 deletions

View File

@ -547,22 +547,23 @@ ipcMain.on('stop-public-streaming', (event, _) => {
let listStreaming = null
ipcMain.on('start-list-streaming', (event, obj) => {
accountManager.getAccount(obj.account._id)
const { listID, account, useWebsocket } = obj
accountManager.getAccount(account._id)
.catch((err) => {
log.error(err)
event.sender.send('error-start-list-streaming', err)
})
.then((account) => {
.then((acct) => {
// Stop old list streaming
if (listStreaming !== null) {
listStreaming.stop()
listStreaming = null
}
listStreaming = new StreamingManager(account)
listStreaming = new StreamingManager(acct, useWebsocket)
listStreaming.start(
'list',
`list=${obj.list_id}`,
`list=${listID}`,
(update) => {
event.sender.send('update-start-list-streaming', update)
},

View File

@ -91,8 +91,9 @@ const Show = {
})
return new Promise((resolve, reject) => {
ipcRenderer.send('start-list-streaming', {
list_id: listID,
account: rootState.TimelineSpace.account
listID: listID,
account: rootState.TimelineSpace.account,
useWebsocket: rootState.TimelineSpace.useWebsocket
})
ipcRenderer.once('error-start-list-streaming', (event, err) => {
reject(err)