mirror of
				https://github.com/Mastermindzh/tidal-hifi.git
				synced 2025-10-31 16:59:09 +01:00 
			
		
		
		
	fix: Notifications are now send at the end of the update process, allowing other events to happen sooner.
This commit is contained in:
		| @@ -2,7 +2,7 @@ | ||||
|   "openapi": "3.1.0", | ||||
|   "info": { | ||||
|     "title": "TIDAL Hi-Fi API", | ||||
|     "version": "5.15.0", | ||||
|     "version": "5.16.0", | ||||
|     "description": "", | ||||
|     "license": { | ||||
|       "name": "MIT", | ||||
|   | ||||
| @@ -394,18 +394,30 @@ function updateMediaInfo(mediaInfo: MediaInfo, notify: boolean) { | ||||
|   if (mediaInfo) { | ||||
|     currentMediaInfo = mediaInfo; | ||||
|     ipcRenderer.send(globalEvents.updateInfo, mediaInfo); | ||||
|     if (settingsStore.get(settings.notifications) && notify) { | ||||
|       if (currentNotification) currentNotification.close(); | ||||
|       currentNotification = new Notification({ | ||||
|         title: mediaInfo.title, | ||||
|         body: mediaInfo.artists, | ||||
|         icon: mediaInfo.icon, | ||||
|       }); | ||||
|       currentNotification.show(); | ||||
|     } | ||||
|  | ||||
|     updateMpris(mediaInfo); | ||||
|     updateListenBrainz(mediaInfo); | ||||
|     if (notify) { | ||||
|       sendNotification(mediaInfo); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * send a desktop notification if enabled in settings | ||||
|  * @param mediaInfo | ||||
|  * @param notify Whether to notify | ||||
|  */ | ||||
| async function sendNotification(mediaInfo: MediaInfo) { | ||||
|   if (settingsStore.get(settings.notifications)) { | ||||
|     if (currentNotification) { | ||||
|       currentNotification.close(); | ||||
|     } | ||||
|     currentNotification = new Notification({ | ||||
|       title: mediaInfo.title, | ||||
|       body: mediaInfo.artists, | ||||
|       icon: mediaInfo.icon, | ||||
|     }); | ||||
|     currentNotification.show(); | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user