Fix for notifications

This commit is contained in:
Core 2021-12-17 18:55:56 +00:00
parent aa4c2fb6e6
commit 49a6725e82

View file

@ -257,7 +257,7 @@ const app = new Vue({
this.mk.authorize() this.mk.authorize()
this.$forceUpdate() this.$forceUpdate()
this.mk.privateEnabled = true this.mk.privateEnabled = true
// this.platform = ipcRenderer.sendSync('cider-platform'); this.platform = ipcRenderer.sendSync('cider-platform');
// Set profile name // Set profile name
this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "") this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "")
// API Fallback // API Fallback
@ -334,20 +334,18 @@ const app = new Vue({
app.getNowPlayingArtworkBG(32); app.getNowPlayingArtworkBG(32);
app.loadLyrics() app.loadLyrics()
try { // Playback Notifications
// Playback Notifications if ((app.platform === "darwin" || app.platform === "linux") && !document.hasFocus()) {
if ((app.platform === "darwin" || app.platform === "linux") && !document.hasFocus()) { if (this.notification) {
if (this.notification) { this.notification.close()
this.notification.close()
}
this.notification = new Notification(a.name, {
body: a.artistName,
icon: (a.artwork.url.replace('/{w}x{h}bb', '/512x512bb')).replace('/2000x2000bb', '/35x35bb'),
silent: true
})
} }
} catch (_) { this.notification = new Notification(a.name, {
body: a.artistName,
icon: (a.artwork.url.replace('/{w}x{h}bb', '/512x512bb')).replace('/2000x2000bb', '/35x35bb'),
silent: true
})
} }
}) })
this.mk.addEventListener(MusicKit.Events.playbackVolumeDidChange, (_a) => { this.mk.addEventListener(MusicKit.Events.playbackVolumeDidChange, (_a) => {