mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2024-12-28 09:41:09 +01:00
refs #921 Clean up unused codes
This commit is contained in:
parent
0f6b4ecf86
commit
12e44ac5cd
@ -493,68 +493,11 @@ ipcMain.on('stop-all-user-streamings', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// streaming
|
||||
let userStreaming: StreamingManager | null = null
|
||||
|
||||
type StreamingSetting = {
|
||||
account: LocalAccount
|
||||
useWebsocket: boolean
|
||||
}
|
||||
|
||||
ipcMain.on('start-user-streaming', (event: Event, obj: StreamingSetting) => {
|
||||
const { account, useWebsocket } = obj
|
||||
accountManager
|
||||
.getAccount(account._id!)
|
||||
.then(acct => {
|
||||
// Stop old user streaming
|
||||
if (userStreaming !== null) {
|
||||
userStreaming.stop()
|
||||
userStreaming = null
|
||||
}
|
||||
|
||||
userStreaming = new StreamingManager(acct, useWebsocket)
|
||||
userStreaming.startUser(
|
||||
(update: Status) => {
|
||||
event.sender.send('update-start-user-streaming', update)
|
||||
},
|
||||
(notification: Notification) => {
|
||||
event.sender.send('notification-start-user-streaming', notification)
|
||||
// Does not exist a endpoint for only mention. And mention is a part of notification.
|
||||
// So we have to get mention from notification.
|
||||
if (notification.type === 'mention') {
|
||||
event.sender.send('mention-start-user-streaming', notification)
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setBadge('•')
|
||||
}
|
||||
},
|
||||
(id: string) => {
|
||||
event.sender.send('delete-start-user-streaming', id)
|
||||
},
|
||||
(err: Error) => {
|
||||
log.error(err)
|
||||
// In macOS, sometimes window is closed (not quit).
|
||||
// When window is closed, we can not send event to webContents; because it is destroyed.
|
||||
// So we have to guard it.
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-user-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
.catch(err => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-user-streaming', err)
|
||||
})
|
||||
})
|
||||
|
||||
ipcMain.on('stop-user-streaming', () => {
|
||||
if (userStreaming !== null) {
|
||||
userStreaming.stop()
|
||||
userStreaming = null
|
||||
}
|
||||
})
|
||||
|
||||
let directMessagesStreaming: StreamingManager | null = null
|
||||
|
||||
ipcMain.on('start-directmessages-streaming', (event: Event, obj: StreamingSetting) => {
|
||||
|
@ -339,19 +339,6 @@ const actions: ActionTree<TimelineSpaceState, RootState> = {
|
||||
commit('TimelineSpace/Contents/Mentions/deleteToot', id, { root: true })
|
||||
})
|
||||
},
|
||||
// startUserStreaming: ({ state }): Promise<{}> => {
|
||||
// // @ts-ignore
|
||||
// return new Promise((resolve, reject) => {
|
||||
// // eslint-disable-line no-unused-vars
|
||||
// ipcRenderer.send('start-user-streaming', {
|
||||
// account: state.account,
|
||||
// useWebsocket: state.useWebsocket
|
||||
// })
|
||||
// ipcRenderer.once('error-start-user-streaming', (_, err: Error) => {
|
||||
// reject(err)
|
||||
// })
|
||||
// })
|
||||
// },
|
||||
bindLocalStreaming: ({ commit, rootState }) => {
|
||||
ipcRenderer.on('update-start-local-streaming', (_, update: Status) => {
|
||||
commit('TimelineSpace/Contents/Local/appendTimeline', update, { root: true })
|
||||
@ -439,9 +426,6 @@ const actions: ActionTree<TimelineSpaceState, RootState> = {
|
||||
console.info('previous account does not exist')
|
||||
}
|
||||
},
|
||||
// stopUserStreaming: () => {
|
||||
// ipcRenderer.send('stop-user-streaming')
|
||||
// },
|
||||
unbindLocalStreaming: () => {
|
||||
ipcRenderer.removeAllListeners('error-start-local-streaming')
|
||||
ipcRenderer.removeAllListeners('update-start-local-streaming')
|
||||
|
Loading…
Reference in New Issue
Block a user