Artwork caching (sorta)

This commit is contained in:
Core 2022-07-31 23:58:32 +01:00
commit c8985c806b
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
2 changed files with 24 additions and 17 deletions

View file

@ -228,7 +228,10 @@
"darkModeSupport": true, "darkModeSupport": true,
"target": [ "target": [
"dmg" "dmg"
] ],
"extendInfo": {
"NSUserNotificationAlertStyle": "alert"
}
} }
} }
} }

View file

@ -44,11 +44,12 @@ export default class playbackNotifications {
'text': 'Next' 'text': 'Next'
} }
], ],
toastXml: `<toast> toastXml: `
<toast>
<visual> <visual>
<binding template="ToastGeneric"> <binding template="ToastText02">
<text id="1">${a.name ?? ''}</text> <text id="1">${a?.name.replace(/&/g, '&amp;')}</text>
<text id="2">${a.artistName ?? ''} - ${a.albumName ?? ''}</text> <text id="2">${a?.artistName.replace(/&/g, '&amp;')} ${a?.albumName.replace(/&/g, '&amp;')}</text>
</binding> </binding>
</visual> </visual>
<actions> <actions>
@ -58,19 +59,22 @@ export default class playbackNotifications {
</toast>` </toast>`
}); });
this._notification.on('click', (event: any) => { // image implementation in windows toasts
//<image id="1" src="path to image" alt="img"/>
this._notification.on('click', (_: any) => {
this._utils.getWindow().show() this._utils.getWindow().show()
this._utils.getWindow().focus() this._utils.getWindow().focus()
}) })
this._notification.on('close', (event: any) => { this._notification.on('close', (_: any) => {
this._notification = undefined; this._notification = undefined;
}) })
this._notification.on('action', (event: any, action: any) => { this._notification.on('action', (event: any, action: any) => {
if (action === 'Play/Pause') { if (action === 0) {
this._utils.playback.playPause() this._utils.playback.playPause()
} else if (action === 'Next') { } else if (action === 1) {
this._utils.playback.next() this._utils.playback.next()
} }
}) })