Merge pull request #693 from h3poteto/iss-662
refs #662 Add streaming update for direct message
This commit is contained in:
commit
45fd989b34
|
@ -421,6 +421,43 @@ ipcMain.on('stop-user-streaming', (event, _) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let directMessagesStreaming = null
|
||||||
|
|
||||||
|
ipcMain.on('start-directmessages-streaming', (event, ac) => {
|
||||||
|
accountManager.getAccount(ac._id)
|
||||||
|
.catch((err) => {
|
||||||
|
log.error(err)
|
||||||
|
event.sender.send('error-start-directmessages-streaming', err)
|
||||||
|
})
|
||||||
|
.then((account) => {
|
||||||
|
// Stop old directmessages streaming
|
||||||
|
if (directMessagesStreaming !== null) {
|
||||||
|
directMessagesStreaming.stop()
|
||||||
|
directMessagesStreaming = null
|
||||||
|
}
|
||||||
|
|
||||||
|
directMessagesStreaming = new StreamingManager(account)
|
||||||
|
directMessagesStreaming.start(
|
||||||
|
'direct',
|
||||||
|
null,
|
||||||
|
(update) => {
|
||||||
|
event.sender.send('update-start-directmessages-streaming', update)
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
log.error(err)
|
||||||
|
event.sender.send('error-start-directmessages-streaming', err)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.on('stop-directmessages-streaming', (event, _) => {
|
||||||
|
if (directMessagesStreaming !== null) {
|
||||||
|
directMessagesStreaming.stop()
|
||||||
|
directMessagesStreaming = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
let localStreaming = null
|
let localStreaming = null
|
||||||
|
|
||||||
ipcMain.on('start-local-streaming', (event, ac) => {
|
ipcMain.on('start-local-streaming', (event, ac) => {
|
||||||
|
|
|
@ -74,6 +74,8 @@ export default {
|
||||||
window.removeEventListener('drop', this.handleDrop)
|
window.removeEventListener('drop', this.handleDrop)
|
||||||
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
||||||
|
this.$store.dispatch('TimelineSpace/stopDirectMessagesStreaming')
|
||||||
|
this.$store.dispatch('TimelineSpace/unbindDirectMessagesStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/unbindLocalStreaming')
|
this.$store.dispatch('TimelineSpace/unbindLocalStreaming')
|
||||||
},
|
},
|
||||||
|
@ -134,6 +136,8 @@ export default {
|
||||||
})
|
})
|
||||||
this.$store.dispatch('TimelineSpace/bindLocalStreaming', account)
|
this.$store.dispatch('TimelineSpace/bindLocalStreaming', account)
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
||||||
|
this.$store.dispatch('TimelineSpace/bindDirectMessagesStreaming', account)
|
||||||
|
this.$store.dispatch('TimelineSpace/startDirectMessagesStreaming', account)
|
||||||
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
||||||
this.$store.dispatch('TimelineSpace/fetchInstance', account)
|
this.$store.dispatch('TimelineSpace/fetchInstance', account)
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,10 +32,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from './Cards/Toot'
|
import Toot from './Cards/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'directmessages',
|
name: 'directmessages',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
focusedId: null
|
focusedId: null
|
||||||
|
@ -132,33 +134,7 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline', account)
|
|
||||||
.catch(() => {
|
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.timeline_fetch_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
.catch(() => {
|
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.start_streaming_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
} finally {
|
} finally {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from './Cards/Toot'
|
import Toot from './Cards/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'favourites',
|
name: 'favourites',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
heading: true,
|
heading: true,
|
||||||
|
@ -123,19 +125,7 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
const account = await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Favourites/fetchFavourites', account)
|
await this.$store.dispatch('TimelineSpace/Contents/Favourites/fetchFavourites', account)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -143,9 +133,6 @@ export default {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
} finally {
|
} finally {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
@selectToot="focusToot(index)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,10 +31,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '../Cards/Toot'
|
import Toot from '../Cards/Toot'
|
||||||
import scrollTop from '../../../utils/scroll'
|
import scrollTop from '../../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'tag',
|
name: 'tag',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
props: ['tag'],
|
props: ['tag'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -158,20 +160,8 @@ export default {
|
||||||
const tag = this.tag
|
const tag = this.tag
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/stopStreaming')
|
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/stopStreaming')
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetchTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetch', tag)
|
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetch', tag)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -179,9 +169,6 @@ export default {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/startStreaming', tag)
|
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/startStreaming', tag)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|
|
@ -32,10 +32,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from './Cards/Toot'
|
import Toot from './Cards/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'home',
|
name: 'home',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
focusedId: null
|
focusedId: null
|
||||||
|
@ -132,33 +134,7 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
|
||||||
.catch(() => {
|
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.timeline_fetch_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
.catch(() => {
|
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.start_streaming_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
} finally {
|
} finally {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '../Cards/Toot'
|
import Toot from '../Cards/Toot'
|
||||||
import scrollTop from '../../../utils/scroll'
|
import scrollTop from '../../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'list',
|
name: 'list',
|
||||||
props: ['list_id'],
|
props: ['list_id'],
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
focusedId: null
|
focusedId: null
|
||||||
|
@ -157,20 +159,8 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/stopStreaming')
|
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/stopStreaming')
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', this.list_id)
|
await this.$store.dispatch('TimelineSpace/Contents/Lists/Show/fetchTimeline', this.list_id)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -178,9 +168,6 @@ export default {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/Contents/Lists/Show/startStreaming', this.list_id)
|
this.$store.dispatch('TimelineSpace/Contents/Lists/Show/startStreaming', this.list_id)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|
|
@ -32,10 +32,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from './Cards/Toot'
|
import Toot from './Cards/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'local',
|
name: 'local',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
focusedId: null
|
focusedId: null
|
||||||
|
@ -131,33 +133,7 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
.catch(() => {
|
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.timeline_fetch_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
.catch(() => {
|
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.start_streaming_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} finally {
|
} finally {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Notification from './Cards/Notification'
|
import Notification from './Cards/Notification'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
components: { Notification },
|
components: { Notification },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
focusedId: null
|
focusedId: null
|
||||||
|
@ -126,18 +128,7 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
const account = await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
|
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -147,8 +138,6 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/Contents/Notifications/resetBadge')
|
this.$store.dispatch('TimelineSpace/Contents/Notifications/resetBadge')
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
} finally {
|
} finally {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,12 @@
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from './Cards/Toot'
|
import Toot from './Cards/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'public',
|
name: 'public',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mixins: [reloadable],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
focusedId: null
|
focusedId: null
|
||||||
|
@ -151,19 +153,8 @@ export default {
|
||||||
async reload () {
|
async reload () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
try {
|
try {
|
||||||
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
await this.reloadable()
|
||||||
this.$message({
|
|
||||||
message: this.$t('message.account_load_error'),
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Public/stopPublicStreaming')
|
await this.$store.dispatch('TimelineSpace/Contents/Public/stopPublicStreaming')
|
||||||
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
||||||
await this.$store.dispatch('TimelineSpace/Contents/Public/fetchPublicTimeline')
|
await this.$store.dispatch('TimelineSpace/Contents/Public/fetchPublicTimeline')
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -171,9 +162,6 @@ export default {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
|
||||||
this.$store.dispatch('TimelineSpace/Contents/Public/startPublicStreaming')
|
this.$store.dispatch('TimelineSpace/Contents/Public/startPublicStreaming')
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'reloadable',
|
||||||
|
methods: {
|
||||||
|
async reloadable () {
|
||||||
|
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch((err) => {
|
||||||
|
this.$message({
|
||||||
|
message: this.$t('message.account_load_error'),
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
throw err
|
||||||
|
})
|
||||||
|
await this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
||||||
|
await this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||||
|
await this.$store.dispatch('TimelineSpace/stopDirectMessagesStreaming')
|
||||||
|
|
||||||
|
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
||||||
|
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
||||||
|
await this.$store.dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline', account)
|
||||||
|
|
||||||
|
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
||||||
|
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
||||||
|
this.$store.dispatch('TimelineSpace/startDirectMessagesStreaming', account)
|
||||||
|
return account
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -135,6 +135,23 @@ const TimelineSpace = {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
bindDirectMessagesStreaming ({ commit, rootState }) {
|
||||||
|
ipcRenderer.on('update-start-directmessages-streaming', (event, update) => {
|
||||||
|
commit('TimelineSpace/Contents/DirectMessages/appendTimeline', update, { root: true })
|
||||||
|
if (rootState.TimelineSpace.Contents.DirectMessages.heading && Math.random() > 0.8) {
|
||||||
|
commit('TimelineSpace/Contents/DirectMessages/archiveTimeline', {}, { root: true })
|
||||||
|
}
|
||||||
|
commit('TimelineSpace/SideMenu/changeUnreadDirectMessagesTimeline', true, { root: true })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
startDirectMessagesStreaming (_, account) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
ipcRenderer.send('start-directmessages-streaming', account)
|
||||||
|
ipcRenderer.once('error-start-directmessages-streaming', (event, err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
unbindUserStreaming () {
|
unbindUserStreaming () {
|
||||||
ipcRenderer.removeAllListeners('update-start-user-streaming')
|
ipcRenderer.removeAllListeners('update-start-user-streaming')
|
||||||
ipcRenderer.removeAllListeners('notification-start-user-streaming')
|
ipcRenderer.removeAllListeners('notification-start-user-streaming')
|
||||||
|
@ -150,6 +167,13 @@ const TimelineSpace = {
|
||||||
stopLocalStreaming () {
|
stopLocalStreaming () {
|
||||||
ipcRenderer.send('stop-local-streaming')
|
ipcRenderer.send('stop-local-streaming')
|
||||||
},
|
},
|
||||||
|
unbindDirectMessagesStreaming () {
|
||||||
|
ipcRenderer.removeAllListeners('error-start-directmessages-streaming')
|
||||||
|
ipcRenderer.removeAllListeners('update-start-directmessages-streaming')
|
||||||
|
},
|
||||||
|
stopDirectMessagesStreaming () {
|
||||||
|
ipcRenderer.send('stop-drectmessages-streaming')
|
||||||
|
},
|
||||||
watchShortcutEvents ({ commit, dispatch }) {
|
watchShortcutEvents ({ commit, dispatch }) {
|
||||||
ipcRenderer.on('CmdOrCtrl+N', () => {
|
ipcRenderer.on('CmdOrCtrl+N', () => {
|
||||||
dispatch('TimelineSpace/Modals/NewToot/openModal', {}, { root: true })
|
dispatch('TimelineSpace/Modals/NewToot/openModal', {}, { root: true })
|
||||||
|
|
Loading…
Reference in New Issue