diff --git a/src/main/base/store.ts b/src/main/base/store.ts index a2a98363..f0ea4d16 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -231,6 +231,11 @@ export class Store { settings: false, }, }, + musickit: { + "stored-attributes": { + autoplayEnabled: "", + }, + }, }; private migrations: any = {}; private schema: ElectronStore.Schema = { diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 1bf457d5..a3d7ea87 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -292,6 +292,21 @@ const app = new Vue({ setWindowHash(route = "") { window.location.hash = `#${route}`; }, + monitorMusickit() { + if (!app.cfg.musickit) return; + + for (const [attr, value] of Object.entries(app.cfg.musickit["stored-attributes"])) { + console.log(`Musickit value: ` + app.mk[attr]); + console.log(`Config value: ` + value); + if (value !== "" && app.mk[attr] !== value) { + app.mk[attr] = value; + } + this.$watch(`mk.${attr}`, (val) => { + console.log(`MK ${attr} changed to ${val}`); + app.cfg.musickit["stored-attributes"][attr] = val; + }); + } + }, async oobeInit() { this.appMode = "oobe"; for (const [k, v] of Object.entries(ipcRenderer.sendSync("get-i18n-listing"))) { @@ -826,6 +841,7 @@ const app = new Vue({ }; } MusicKitInterop.init(); + this.monitorMusickit(); // Set the volume // Check the value of this.cfg.audio.muted