refs #677 Adjust reload for customized streamings
This commit is contained in:
parent
5ac0f1e275
commit
8934d16cc8
11
src/constants/unreadNotification.js
Normal file
11
src/constants/unreadNotification.js
Normal file
@ -0,0 +1,11 @@
|
||||
export default {
|
||||
Direct: {
|
||||
default: false
|
||||
},
|
||||
Local: {
|
||||
default: true
|
||||
},
|
||||
Public: {
|
||||
default: true
|
||||
}
|
||||
}
|
@ -99,6 +99,9 @@ export default {
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeHeading', true)
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/mergeTimeline')
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/archiveTimeline')
|
||||
if (!this.unreadNotification.direct) {
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/clearTimeline')
|
||||
}
|
||||
if (document.getElementById('scrollable') !== undefined && document.getElementById('scrollable') !== null) {
|
||||
document.getElementById('scrollable').removeEventListener('scroll', this.onScroll)
|
||||
document.getElementById('scrollable').scrollTop = 0
|
||||
|
@ -99,6 +99,9 @@ export default {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', true)
|
||||
this.$store.commit('TimelineSpace/Contents/Local/mergeTimeline')
|
||||
this.$store.commit('TimelineSpace/Contents/Local/archiveTimeline')
|
||||
if (!this.unreadNotification.local) {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/clearTimeline')
|
||||
}
|
||||
if (document.getElementById('scrollable') !== undefined && document.getElementById('scrollable') !== null) {
|
||||
document.getElementById('scrollable').removeEventListener('scroll', this.onScroll)
|
||||
document.getElementById('scrollable').scrollTop = 0
|
||||
|
@ -128,15 +128,7 @@ export default {
|
||||
async reload () {
|
||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||
try {
|
||||
const account = await this.reloadable()
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.notification_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
|
||||
await this.reloadable()
|
||||
this.$store.dispatch('TimelineSpace/Contents/Notifications/resetBadge')
|
||||
} finally {
|
||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
|
@ -99,7 +99,9 @@ export default {
|
||||
this.$store.commit('TimelineSpace/Contents/Public/changeHeading', true)
|
||||
this.$store.commit('TimelineSpace/Contents/Public/mergeTimeline')
|
||||
this.$store.commit('TimelineSpace/Contents/Public/archiveTimeline')
|
||||
this.$store.commit('TimelineSpace/Contents/Public/clearTimeline')
|
||||
if (!this.unreadNotification.public) {
|
||||
this.$store.commit('TimelineSpace/Contents/Public/clearTimeline')
|
||||
}
|
||||
if (document.getElementById('scrollable') !== undefined && document.getElementById('scrollable') !== null) {
|
||||
document.getElementById('scrollable').removeEventListener('scroll', this.onScroll)
|
||||
document.getElementById('scrollable').scrollTop = 0
|
||||
@ -163,21 +165,6 @@ export default {
|
||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||
try {
|
||||
await this.reloadable()
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Public/stopPublicStreaming')
|
||||
await this.$store.dispatch('TimelineSpace/Contents/Public/fetchPublicTimeline')
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
this.$store.dispatch('TimelineSpace/Contents/Public/startPublicStreaming')
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.start_streaming_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
} finally {
|
||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
}
|
||||
|
@ -10,17 +10,9 @@ export default {
|
||||
})
|
||||
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)
|
||||
await this.$store.dispatch('TimelineSpace/stopStreamings', account)
|
||||
await this.$store.dispatch('TimelineSpace/fetchContentsTimelines', account)
|
||||
await this.$store.dispatch('TimelineSpace/startStreamings', account)
|
||||
return account
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
import unreadSettings from '~/src/constants/unreadNotification'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
unreadNotification: {
|
||||
direct: false,
|
||||
local: true,
|
||||
public: false
|
||||
direct: unreadSettings.Direct.default,
|
||||
local: unreadSettings.Local.default,
|
||||
public: unreadSettings.Public.default
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
@ -24,6 +25,11 @@ export default {
|
||||
})
|
||||
ipcRenderer.once('error-get-unread-notification', (event, err) => {
|
||||
ipcRenderer.removeAllListeners('response-get-unread-notification')
|
||||
commit('updateUnreadNotification', {
|
||||
direct: unreadSettings.Direct.default,
|
||||
local: unreadSettings.Local.default,
|
||||
public: unreadSettings.Public.default
|
||||
})
|
||||
resolve(null)
|
||||
})
|
||||
ipcRenderer.send('get-unread-notification', rootState.Settings.accountID)
|
||||
|
@ -5,6 +5,7 @@ import HeaderMenu from './TimelineSpace/HeaderMenu'
|
||||
import Modals from './TimelineSpace/Modals'
|
||||
import Contents from './TimelineSpace/Contents'
|
||||
import router from '../router'
|
||||
import unreadSettings from '~/src/constants/unreadNotification'
|
||||
|
||||
const TimelineSpace = {
|
||||
namespaced: true,
|
||||
@ -24,9 +25,9 @@ const TimelineSpace = {
|
||||
emojis: [],
|
||||
tootMax: 500,
|
||||
unreadNotification: {
|
||||
direct: false,
|
||||
local: true,
|
||||
public: false
|
||||
direct: unreadSettings.Direct.default,
|
||||
local: unreadSettings.Local.default,
|
||||
public: unreadSettings.Public.default
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
@ -156,6 +157,11 @@ const TimelineSpace = {
|
||||
})
|
||||
ipcRenderer.once('error-get-unread-notification', (event, err) => {
|
||||
ipcRenderer.removeAllListeners('response-get-unread-notification')
|
||||
commit('updateUnreadNotification', {
|
||||
direct: unreadSettings.Direct.default,
|
||||
local: unreadSettings.Local.default,
|
||||
public: unreadSettings.Public.default
|
||||
})
|
||||
resolve(null)
|
||||
})
|
||||
ipcRenderer.send('get-unread-notification', accountID)
|
||||
@ -270,7 +276,7 @@ const TimelineSpace = {
|
||||
ipcRenderer.on('update-start-public-streaming', (event, update) => {
|
||||
commit('TimelineSpace/Contents/Public/appendTimeline', update, { root: true })
|
||||
if (rootState.TimelineSpace.Contents.Public.heading && Math.random() > 0.8) {
|
||||
commit('TimelineSpace/Contents/Public/archiveTimeline')
|
||||
commit('TimelineSpace/Contents/Public/archiveTimeline', {}, { root: true })
|
||||
}
|
||||
})
|
||||
commit('TimelineSpace/SideMenu/changeUnreadPublicTimeline', true, { root: true })
|
||||
|
Loading…
x
Reference in New Issue
Block a user