Started investigating default profile loading inconsistency
This commit is contained in:
parent
da89e5bd56
commit
15c02baf80
|
@ -85,26 +85,27 @@ export default Vue.extend({
|
|||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.$store.dispatch('grabUserSettings')
|
||||
this.$store.dispatch('grabHistory')
|
||||
this.$store.dispatch('grabAllProfiles', this.$t('Profile.All Channels'))
|
||||
this.$store.dispatch('grabAllPlaylists')
|
||||
this.$store.commit('setUsingElectron', useElectron)
|
||||
this.checkThemeSettings()
|
||||
this.checkLocale()
|
||||
this.$store.dispatch('grabUserSettings').then(() => {
|
||||
this.$store.dispatch('grabHistory')
|
||||
this.$store.dispatch('grabAllProfiles', this.$t('Profile.All Channels'))
|
||||
this.$store.dispatch('grabAllPlaylists')
|
||||
this.$store.commit('setUsingElectron', useElectron)
|
||||
this.checkThemeSettings()
|
||||
this.checkLocale()
|
||||
|
||||
if (useElectron) {
|
||||
console.log('User is using Electron')
|
||||
this.activateKeyboardShortcuts()
|
||||
this.openAllLinksExternally()
|
||||
this.enableOpenUrl()
|
||||
this.setBoundsOnClose()
|
||||
}
|
||||
if (useElectron) {
|
||||
console.log('User is using Electron')
|
||||
this.activateKeyboardShortcuts()
|
||||
this.openAllLinksExternally()
|
||||
this.enableOpenUrl()
|
||||
this.setBoundsOnClose()
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.checkForNewUpdates()
|
||||
this.checkForNewBlogPosts()
|
||||
}, 500)
|
||||
setTimeout(() => {
|
||||
this.checkForNewUpdates()
|
||||
this.checkForNewBlogPosts()
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
checkLocale: function () {
|
||||
|
|
|
@ -263,6 +263,7 @@ export default Vue.extend({
|
|||
|
||||
const currentProfile = JSON.parse(JSON.stringify(this.profileList[this.activeProfile]))
|
||||
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
|
||||
console.log("PRIMARY PROFILE:", primaryProfile)
|
||||
|
||||
if (this.isSubscribed) {
|
||||
currentProfile.subscriptions = currentProfile.subscriptions.filter((channel) => {
|
||||
|
|
|
@ -13,7 +13,7 @@ if (window && window.process && window.process.type === 'renderer') {
|
|||
|
||||
const remote = require('@electron/remote')
|
||||
dbLocation = remote.app.getPath('userData')
|
||||
|
||||
console.log("DB", dbLocation)
|
||||
dbLocation = dbLocation + '/history.db'
|
||||
} else {
|
||||
dbLocation = 'history.db'
|
||||
|
|
|
@ -27,7 +27,7 @@ const profileDb = new Datastore({
|
|||
const state = {
|
||||
profileList: [{
|
||||
_id: 'allChannels',
|
||||
name: 'All Channels',
|
||||
name: 'Brudi Channels',
|
||||
bgColor: '#000000',
|
||||
textColor: '#FFFFFF',
|
||||
subscriptions: []
|
||||
|
@ -54,6 +54,7 @@ const actions = {
|
|||
} else {
|
||||
// We want the primary profile to always be first
|
||||
// So sort with that then sort alphabetically by profile name
|
||||
console.log('PROFILE DB RESULTS', results)
|
||||
const profiles = results.sort((a, b) => {
|
||||
if (a._id === 'allChannels') {
|
||||
return -1
|
||||
|
@ -67,10 +68,13 @@ const actions = {
|
|||
})
|
||||
|
||||
if (state.profileList.length < profiles.length) {
|
||||
console.log("STATE LIST LESS RTHAN PROFILES LENGTH")
|
||||
console.log(profiles, state.profileList)
|
||||
console.log("ROOTSTATE:SETTINGDEFATL", rootState.settings.defaultProfile)
|
||||
const profileIndex = profiles.findIndex((profile) => {
|
||||
return profile._id === rootState.settings.defaultProfile
|
||||
})
|
||||
|
||||
console.log("INDEX", profileIndex)
|
||||
if (profileIndex !== -1) {
|
||||
dispatch('updateActiveProfile', profileIndex)
|
||||
}
|
||||
|
@ -103,7 +107,7 @@ const actions = {
|
|||
textColor: textColor,
|
||||
subscriptions: []
|
||||
}
|
||||
console.log(defaultProfile)
|
||||
console.log('DIS DEFAULT', defaultProfile)
|
||||
profileDb.update({ _id: 'allChannels' }, defaultProfile, { upsert: true }, (err, numReplaced) => {
|
||||
if (!err) {
|
||||
dispatch('grabAllProfiles')
|
||||
|
|
|
@ -280,6 +280,7 @@ const actions = {
|
|||
commit('setBackendFallback', result.value)
|
||||
break
|
||||
case 'defaultProfile':
|
||||
console.log("IN SETTING DEFAULT:", result.value)
|
||||
commit('setDefaultProfile', result.value)
|
||||
break
|
||||
case 'checkForUpdates':
|
||||
|
|
Loading…
Reference in New Issue