Bugfix: load of subscriptions at startup (#1216)
This commit is contained in:
parent
0a8854f3e5
commit
52e600dc13
|
@ -41,6 +41,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
dataReady: false,
|
||||||
hideOutlines: true,
|
hideOutlines: true,
|
||||||
showUpdatesBanner: false,
|
showUpdatesBanner: false,
|
||||||
showBlogBanner: false,
|
showBlogBanner: false,
|
||||||
|
@ -85,26 +86,30 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.$store.dispatch('grabUserSettings').then((result) => {
|
const v = this
|
||||||
this.$store.dispatch('grabHistory')
|
this.$store.dispatch('grabUserSettings').then(() => {
|
||||||
this.$store.dispatch('grabAllProfiles', this.$t('Profile.All Channels'))
|
this.$store.dispatch('grabAllProfiles', this.$t('Profile.All Channels')).then(() => {
|
||||||
this.$store.dispatch('grabAllPlaylists')
|
this.$store.dispatch('grabHistory')
|
||||||
this.$store.commit('setUsingElectron', useElectron)
|
this.$store.dispatch('grabAllPlaylists')
|
||||||
this.checkThemeSettings()
|
this.$store.commit('setUsingElectron', useElectron)
|
||||||
this.checkLocale()
|
this.checkThemeSettings()
|
||||||
|
this.checkLocale()
|
||||||
|
|
||||||
if (useElectron) {
|
v.dataReady = true
|
||||||
console.log('User is using Electron')
|
|
||||||
this.activateKeyboardShortcuts()
|
|
||||||
this.openAllLinksExternally()
|
|
||||||
this.enableOpenUrl()
|
|
||||||
this.setBoundsOnClose()
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
if (useElectron) {
|
||||||
this.checkForNewUpdates()
|
console.log('User is using Electron')
|
||||||
this.checkForNewBlogPosts()
|
this.activateKeyboardShortcuts()
|
||||||
}, 500)
|
this.openAllLinksExternally()
|
||||||
|
this.enableOpenUrl()
|
||||||
|
this.setBoundsOnClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.checkForNewUpdates()
|
||||||
|
this.checkForNewBlogPosts()
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
/>
|
/>
|
||||||
</ft-flex-box>
|
</ft-flex-box>
|
||||||
<transition
|
<transition
|
||||||
|
v-if="dataReady"
|
||||||
mode="out-in"
|
mode="out-in"
|
||||||
name="fade"
|
name="fade"
|
||||||
>
|
>
|
||||||
|
|
|
@ -47,38 +47,44 @@ const getters = {
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
grabAllProfiles ({ rootState, dispatch, commit }, defaultName = null) {
|
grabAllProfiles ({ rootState, dispatch, commit }, defaultName = null) {
|
||||||
profileDb.find({}, (err, results) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!err) {
|
profileDb.find({}, (err, results) => {
|
||||||
if (results.length === 0) {
|
if (!err) {
|
||||||
dispatch('createDefaultProfile', defaultName)
|
if (results.length === 0) {
|
||||||
} else {
|
dispatch('createDefaultProfile', defaultName)
|
||||||
// We want the primary profile to always be first
|
} else {
|
||||||
// So sort with that then sort alphabetically by profile name
|
// We want the primary profile to always be first
|
||||||
const profiles = results.sort((a, b) => {
|
// So sort with that then sort alphabetically by profile name
|
||||||
if (a._id === 'allChannels') {
|
const profiles = results.sort((a, b) => {
|
||||||
return -1
|
if (a._id === 'allChannels') {
|
||||||
}
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
if (b._id === 'allChannels') {
|
if (b._id === 'allChannels') {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return b.name - a.name
|
return b.name - a.name
|
||||||
})
|
|
||||||
|
|
||||||
if (state.profileList.length < profiles.length) {
|
|
||||||
const profileIndex = profiles.findIndex((profile) => {
|
|
||||||
return profile._id === rootState.settings.defaultProfile
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (profileIndex !== -1) {
|
if (state.profileList.length < profiles.length) {
|
||||||
dispatch('updateActiveProfile', profileIndex)
|
const profileIndex = profiles.findIndex((profile) => {
|
||||||
|
return profile._id === rootState.settings.defaultProfile
|
||||||
|
})
|
||||||
|
|
||||||
|
if (profileIndex !== -1) {
|
||||||
|
commit('setActiveProfile', profileIndex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commit('setProfileList', profiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
commit('setProfileList', profiles)
|
resolve()
|
||||||
|
} else {
|
||||||
|
reject(err)
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue