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