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 let listStreaming = null
ipcMain.on('start-list-streaming', (event, obj) => { ipcMain.on('start-list-streaming', (event, obj) => {
accountManager.getAccount(obj.account._id) const { listID, account, useWebsocket } = obj
accountManager.getAccount(account._id)
.catch((err) => { .catch((err) => {
log.error(err) log.error(err)
event.sender.send('error-start-list-streaming', err) event.sender.send('error-start-list-streaming', err)
}) })
.then((account) => { .then((acct) => {
// Stop old list streaming // Stop old list streaming
if (listStreaming !== null) { if (listStreaming !== null) {
listStreaming.stop() listStreaming.stop()
listStreaming = null listStreaming = null
} }
listStreaming = new StreamingManager(account) listStreaming = new StreamingManager(acct, useWebsocket)
listStreaming.start( listStreaming.start(
'list', 'list',
`list=${obj.list_id}`, `list=${listID}`,
(update) => { (update) => {
event.sender.send('update-start-list-streaming', update) event.sender.send('update-start-list-streaming', update)
}, },

View File

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