refs #769 Switch hashtag streaming method

This commit is contained in:
AkiraFukushima 2018-12-18 23:30:04 +09:00
parent c94bfce7eb
commit 4253bb791d
2 changed files with 7 additions and 5 deletions

View File

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

View File

@ -91,7 +91,8 @@ const Tag = {
return new Promise((resolve, reject) => {
ipcRenderer.send('start-tag-streaming', {
tag: encodeURIComponent(tag),
account: rootState.TimelineSpace.account
account: rootState.TimelineSpace.account,
useWebsocket: rootState.TimelineSpace.useWebsocket
})
ipcRenderer.once('error-start-tag-streaming', (event, err) => {
reject(err)