diff --git a/src/main/index.js b/src/main/index.js index c3a560e2..b3f0da66 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -452,6 +452,36 @@ ipcMain.on('stop-public-streaming', (event, _) => { publicStreaming = null }) +let listStreaming = null + +ipcMain.on('start-list-streaming', (event, obj) => { + const account = new Account(accountDB) + account.getAccount(obj.account._id) + .catch((err) => { + log.error(err) + event.sender.send('error-start-list-streaming', err) + }) + .then((account) => { + // Stop old list streaming + if (listStreaming !== null) { + listStreaming.stop() + listStreaming = null + } + + listStreaming = new Streaming(account) + listStreaming.start( + `/streaming/list?list=${obj.list_id}`, + (update) => { + event.sender.send('update-start-list-streaming', update) + }, + (err) => { + log.error(err) + event.sendeer.send('error-start-list-streaming', err) + } + ) + }) +}) + // sounds ipcMain.on('fav-rt-action-sound', (event, _) => { const preferences = new Preferences(preferencesDBPath) diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index 312b0634..28eacd6f 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -50,37 +50,36 @@ export default { await this.clear() this.$store.dispatch('TimelineSpace/watchShortcutEvents') - try { - const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id) - try { - await this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account) - } catch (err) { - this.$message({ - message: 'Could not fetch timeline', - type: 'error' - }) - } - try { - await this.$store.dispatch('TimelineSpace/fetchNotifications', account) - } catch (err) { - this.$message({ - message: 'Could not fetch notification', - type: 'error' - }) - } - this.$store.dispatch('TimelineSpace/startUserStreaming', account) - .catch(() => { - this.$message({ - message: 'Failed to start streaming', - type: 'error' - }) - }) - } catch (err) { + const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch(() => { this.$message({ message: 'Could not find account', type: 'error' }) + }) + try { + await this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account) + } catch (err) { + this.$message({ + message: 'Could not fetch timeline', + type: 'error' + }) } + try { + await this.$store.dispatch('TimelineSpace/fetchNotifications', account) + } catch (err) { + this.$message({ + message: 'Could not fetch notification', + type: 'error' + }) + } + this.$store.dispatch('TimelineSpace/SideMenu/fetchLists', account) + this.$store.dispatch('TimelineSpace/startUserStreaming', account) + .catch(() => { + this.$message({ + message: 'Failed to start streaming', + type: 'error' + }) + }) } } } diff --git a/src/renderer/components/TimelineSpace/Contents/Lists.vue b/src/renderer/components/TimelineSpace/Contents/Lists.vue new file mode 100644 index 00000000..57522ccb --- /dev/null +++ b/src/renderer/components/TimelineSpace/Contents/Lists.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/renderer/components/TimelineSpace/HeaderMenu.vue b/src/renderer/components/TimelineSpace/HeaderMenu.vue index 52060b7b..0fe43850 100644 --- a/src/renderer/components/TimelineSpace/HeaderMenu.vue +++ b/src/renderer/components/TimelineSpace/HeaderMenu.vue @@ -1,27 +1,51 @@