mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-11-29 05:30:13 +01:00
Move timestamps to utils store
This commit is contained in:
parent
e12bea9af3
commit
15a739b6a0
@ -145,7 +145,7 @@ export default defineComponent({
|
|||||||
return posts
|
return posts
|
||||||
}))).flatMap((o) => o)
|
}))).flatMap((o) => o)
|
||||||
postList.push(...postListFromRemote)
|
postList.push(...postListFromRemote)
|
||||||
this.updateLastCommunityRefreshTimestamp(new Date())
|
this.setLastCommunityRefreshTimestamp(new Date())
|
||||||
postList.sort((a, b) => {
|
postList.sort((a, b) => {
|
||||||
return calculatePublishedDate(b.publishedText) - calculatePublishedDate(a.publishedText)
|
return calculatePublishedDate(b.publishedText) - calculatePublishedDate(a.publishedText)
|
||||||
})
|
})
|
||||||
@ -216,12 +216,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateLastCommunityRefreshTimestamp',
|
|
||||||
'updateShowProgressBar',
|
'updateShowProgressBar',
|
||||||
'updateSubscriptionPostsCacheByChannel',
|
'updateSubscriptionPostsCacheByChannel',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
|
'setLastCommunityRefreshTimestamp',
|
||||||
'setProgressBarPercentage'
|
'setProgressBarPercentage'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ export default defineComponent({
|
|||||||
return videos
|
return videos
|
||||||
}))).flatMap((o) => o)
|
}))).flatMap((o) => o)
|
||||||
videoList.push(...videoListFromRemote)
|
videoList.push(...videoListFromRemote)
|
||||||
this.updateLastLiveRefreshTimestamp(new Date())
|
this.setLastLiveRefreshTimestamp(new Date())
|
||||||
|
|
||||||
this.videoList = updateVideoListAfterProcessing(videoList)
|
this.videoList = updateVideoListAfterProcessing(videoList)
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
@ -340,12 +340,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateLastLiveRefreshTimestamp',
|
|
||||||
'updateShowProgressBar',
|
'updateShowProgressBar',
|
||||||
'updateSubscriptionLiveCacheByChannel',
|
'updateSubscriptionLiveCacheByChannel',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
|
'setLastLiveRefreshTimestamp',
|
||||||
'setProgressBarPercentage'
|
'setProgressBarPercentage'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ export default defineComponent({
|
|||||||
return videos
|
return videos
|
||||||
}))).flatMap((o) => o)
|
}))).flatMap((o) => o)
|
||||||
videoList.push(...videoListFromRemote)
|
videoList.push(...videoListFromRemote)
|
||||||
this.updateLastShortRefreshTimestamp(new Date())
|
this.setLastShortRefreshTimestamp(new Date())
|
||||||
|
|
||||||
this.videoList = updateVideoListAfterProcessing(videoList)
|
this.videoList = updateVideoListAfterProcessing(videoList)
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
@ -230,12 +230,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateLastShortRefreshTimestamp',
|
|
||||||
'updateShowProgressBar',
|
'updateShowProgressBar',
|
||||||
'updateSubscriptionShortsCacheByChannel',
|
'updateSubscriptionShortsCacheByChannel',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
|
'setLastShortRefreshTimestamp',
|
||||||
'setProgressBarPercentage'
|
'setProgressBarPercentage'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ export default defineComponent({
|
|||||||
return videos
|
return videos
|
||||||
}))).flatMap((o) => o)
|
}))).flatMap((o) => o)
|
||||||
videoList.push(...videoListFromRemote)
|
videoList.push(...videoListFromRemote)
|
||||||
this.updateLastVideoRefreshTimestamp(new Date())
|
this.setLastVideoRefreshTimestamp(new Date())
|
||||||
|
|
||||||
this.videoList = updateVideoListAfterProcessing(videoList)
|
this.videoList = updateVideoListAfterProcessing(videoList)
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
@ -342,12 +342,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateLastVideoRefreshTimestamp',
|
|
||||||
'updateShowProgressBar',
|
'updateShowProgressBar',
|
||||||
'updateSubscriptionVideosCacheByChannel',
|
'updateSubscriptionVideosCacheByChannel',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
|
'setLastVideoRefreshTimestamp',
|
||||||
'setProgressBarPercentage'
|
'setProgressBarPercentage'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -227,12 +227,6 @@ const state = {
|
|||||||
hideChapters: false,
|
hideChapters: false,
|
||||||
showDistractionFreeTitles: false,
|
showDistractionFreeTitles: false,
|
||||||
landingPage: 'subscriptions',
|
landingPage: 'subscriptions',
|
||||||
lastVideoRefreshTimestamp: '',
|
|
||||||
lastShortRefreshTimestamp: '',
|
|
||||||
lastLiveRefreshTimestamp: '',
|
|
||||||
lastCommunityRefreshTimestamp: '',
|
|
||||||
lastPopularRefreshTimestamp: '',
|
|
||||||
lastTrendingRefreshTimestamp: '',
|
|
||||||
listType: 'grid',
|
listType: 'grid',
|
||||||
maxVideoPlaybackRate: 3,
|
maxVideoPlaybackRate: 3,
|
||||||
playNextVideo: false,
|
playNextVideo: false,
|
||||||
|
@ -44,7 +44,13 @@ const state = {
|
|||||||
externalPlayerNames: [],
|
externalPlayerNames: [],
|
||||||
externalPlayerNameTranslationKeys: [],
|
externalPlayerNameTranslationKeys: [],
|
||||||
externalPlayerValues: [],
|
externalPlayerValues: [],
|
||||||
externalPlayerCmdArguments: {}
|
externalPlayerCmdArguments: {},
|
||||||
|
lastVideoRefreshTimestamp: '',
|
||||||
|
lastShortRefreshTimestamp: '',
|
||||||
|
lastLiveRefreshTimestamp: '',
|
||||||
|
lastCommunityRefreshTimestamp: '',
|
||||||
|
lastPopularRefreshTimestamp: '',
|
||||||
|
lastTrendingRefreshTimestamp: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
@ -118,6 +124,30 @@ const getters = {
|
|||||||
|
|
||||||
getExternalPlayerCmdArguments () {
|
getExternalPlayerCmdArguments () {
|
||||||
return state.externalPlayerCmdArguments
|
return state.externalPlayerCmdArguments
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastTrendingRefreshTimestamp () {
|
||||||
|
return state.lastTrendingRefreshTimestamp
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastPopularRefreshTimestamp () {
|
||||||
|
return state.lastPopularRefreshTimestamp
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastCommunityRefreshTimestamp () {
|
||||||
|
return state.lastCommunityRefreshTimestamp
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastShortRefreshTimestamp () {
|
||||||
|
return state.lastShortRefreshTimestamp
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastLiveRefreshTimestamp () {
|
||||||
|
return state.lastLiveRefreshTimestamp
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastVideoRefreshTimestamp () {
|
||||||
|
return state.lastVideoRefreshTimestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,6 +733,30 @@ const mutations = {
|
|||||||
state.trendingCache[page] = value
|
state.trendingCache[page] = value
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setLastTrendingRefreshTimestamp (state, value) {
|
||||||
|
state.lastTrendingRefreshTimestamp = value
|
||||||
|
},
|
||||||
|
|
||||||
|
setLastPopularRefreshTimestamp (state, value) {
|
||||||
|
state.lastPopularRefreshTimestamp = value
|
||||||
|
},
|
||||||
|
|
||||||
|
setLastCommunityRefreshTimestamp (state, value) {
|
||||||
|
state.lastCommunityRefreshTimestamp = value
|
||||||
|
},
|
||||||
|
|
||||||
|
setLastShortRefreshTimestamp (state, value) {
|
||||||
|
state.lastShortRefreshTimestamp = value
|
||||||
|
},
|
||||||
|
|
||||||
|
setLastLiveRefreshTimestamp (state, value) {
|
||||||
|
state.lastLiveRefreshTimestamp = value
|
||||||
|
},
|
||||||
|
|
||||||
|
setLastVideoRefreshTimestamp (state, value) {
|
||||||
|
state.lastVideoRefreshTimestamp = value
|
||||||
|
},
|
||||||
|
|
||||||
clearTrendingCache(state) {
|
clearTrendingCache(state) {
|
||||||
state.trendingCache = {
|
state.trendingCache = {
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue'
|
||||||
import { mapActions } from 'vuex'
|
import { mapMutations } from 'vuex'
|
||||||
import FtLoader from '../../components/ft-loader/ft-loader.vue'
|
import FtLoader from '../../components/ft-loader/ft-loader.vue'
|
||||||
import FtCard from '../../components/ft-card/ft-card.vue'
|
import FtCard from '../../components/ft-card/ft-card.vue'
|
||||||
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
|
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
|
||||||
@ -69,7 +69,7 @@ export default defineComponent({
|
|||||||
this.shownResults = result.filter((item) => {
|
this.shownResults = result.filter((item) => {
|
||||||
return item.type === 'video' || item.type === 'shortVideo' || item.type === 'channel' || item.type === 'playlist'
|
return item.type === 'video' || item.type === 'shortVideo' || item.type === 'channel' || item.type === 'playlist'
|
||||||
})
|
})
|
||||||
this.updateLastPopularRefreshTimestamp(new Date())
|
this.setLastPopularRefreshTimestamp(new Date())
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
this.$store.commit('setPopularCache', this.shownResults)
|
this.$store.commit('setPopularCache', this.shownResults)
|
||||||
},
|
},
|
||||||
@ -96,8 +96,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapMutations([
|
||||||
'updateLastPopularRefreshTimestamp'
|
'setLastPopularRefreshTimestamp'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue'
|
||||||
import { mapActions } from 'vuex'
|
import { mapActions, mapMutations } from 'vuex'
|
||||||
import FtCard from '../../components/ft-card/ft-card.vue'
|
import FtCard from '../../components/ft-card/ft-card.vue'
|
||||||
import FtLoader from '../../components/ft-loader/ft-loader.vue'
|
import FtLoader from '../../components/ft-loader/ft-loader.vue'
|
||||||
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
|
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
|
||||||
@ -96,7 +96,7 @@ export default defineComponent({
|
|||||||
this.getTrendingInfoLocal()
|
this.getTrendingInfoLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateLastTrendingRefreshTimestamp(new Date())
|
this.setLastTrendingRefreshTimestamp(new Date())
|
||||||
},
|
},
|
||||||
|
|
||||||
getTrendingInfoLocal: async function () {
|
getTrendingInfoLocal: async function () {
|
||||||
@ -198,8 +198,11 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateLastTrendingRefreshTimestamp',
|
|
||||||
'showOutlines'
|
'showOutlines'
|
||||||
|
]),
|
||||||
|
|
||||||
|
...mapMutations([
|
||||||
|
'setLastTrendingRefreshTimestamp'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user