mirror of
				https://github.com/Mastermindzh/tidal-hifi.git
				synced 2025-10-31 00:39:30 +01:00 
			
		
		
		
	Fixed bug: Triggering fullscreen from the Tidal web app would cause the menubar to be visible even if it was disabled in the settings (#96)
Co-authored-by: Diogo Oliveira <dromarques@outlook.com>
This commit is contained in:
		| @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. | |||||||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||||||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||||||
|  |  | ||||||
|  | ## 2.7.1 | ||||||
|  |  | ||||||
|  | - Fixed bug: Triggering fullscreen from the Tidal web app would cause the menubar to be visible even if it was disabled in the settings | ||||||
|  |  | ||||||
| ## 2.7.0 | ## 2.7.0 | ||||||
|  |  | ||||||
| - Switched to the native Notifier (removed node-notifier) | - Switched to the native Notifier (removed node-notifier) | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,12 +1,12 @@ | |||||||
| { | { | ||||||
|   "name": "tidal-hifi", |   "name": "tidal-hifi", | ||||||
|   "version": "2.7.0", |   "version": "2.7.1", | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 2, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "": { |     "": { | ||||||
|       "name": "tidal-hifi", |       "name": "tidal-hifi", | ||||||
|       "version": "2.7.0", |       "version": "2.7.1", | ||||||
|       "license": "MIT", |       "license": "MIT", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "discord-rpc": "^4.0.1", |         "discord-rpc": "^4.0.1", | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "tidal-hifi", |   "name": "tidal-hifi", | ||||||
|   "version": "2.7.0", |   "version": "2.7.1", | ||||||
|   "description": "Tidal on Electron with widevine(hifi) support", |   "description": "Tidal on Electron with widevine(hifi) support", | ||||||
|   "main": "src/main.js", |   "main": "src/main.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ const globalEvents = { | |||||||
|   previous: "previous", |   previous: "previous", | ||||||
|   updateInfo: "update-info", |   updateInfo: "update-info", | ||||||
|   hideSettings: "hideSettings", |   hideSettings: "hideSettings", | ||||||
|  |   refreshMenuBar: "refreshMenubar", | ||||||
|   showSettings: "showSettings", |   showSettings: "showSettings", | ||||||
|   storeChanged: "storeChanged", |   storeChanged: "storeChanged", | ||||||
|   error: "error", |   error: "error", | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								src/main.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.js
									
									
									
									
									
								
							| @@ -29,6 +29,14 @@ if (!app.isPackaged) { | |||||||
|   }); |   }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update the menuBarVisbility according to the store value | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | function syncMenuBarWithStore() { | ||||||
|  |   mainWindow.setMenuBarVisibility(store.get(settings.menuBar)); | ||||||
|  | } | ||||||
|  |  | ||||||
| function createWindow(options = {}) { | function createWindow(options = {}) { | ||||||
|   // Create the browser window. |   // Create the browser window. | ||||||
|   mainWindow = new BrowserWindow({ |   mainWindow = new BrowserWindow({ | ||||||
| @@ -48,7 +56,7 @@ function createWindow(options = {}) { | |||||||
|     }, |     }, | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   mainWindow.setMenuBarVisibility(store.get(settings.menuBar)); |   syncMenuBarWithStore(); | ||||||
|  |  | ||||||
|   // load the Tidal website |   // load the Tidal website | ||||||
|   mainWindow.loadURL(tidalUrl); |   mainWindow.loadURL(tidalUrl); | ||||||
| @@ -95,6 +103,7 @@ app.on("ready", () => { | |||||||
|   store.get(settings.trayIcon) && addTray({ icon }) && refreshTray(); |   store.get(settings.trayIcon) && addTray({ icon }) && refreshTray(); | ||||||
|   store.get(settings.api) && expressModule.run(mainWindow); |   store.get(settings.api) && expressModule.run(mainWindow); | ||||||
|   store.get(settings.enableDiscord) && discordModule.initRPC(); |   store.get(settings.enableDiscord) && discordModule.initRPC(); | ||||||
|  |   // mainWindow.webContents.openDevTools(); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| app.on("activate", function () { | app.on("activate", function () { | ||||||
| @@ -117,8 +126,12 @@ ipcMain.on(globalEvents.showSettings, (event, arg) => { | |||||||
|   showSettingsWindow(); |   showSettingsWindow(); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | ipcMain.on(globalEvents.refreshMenuBar, (event, arg) => { | ||||||
|  |   syncMenuBarWithStore(); | ||||||
|  | }); | ||||||
|  |  | ||||||
| ipcMain.on(globalEvents.storeChanged, (event, arg) => { | ipcMain.on(globalEvents.storeChanged, (event, arg) => { | ||||||
|   mainWindow.setMenuBarVisibility(store.get(settings.menuBar)); |   syncMenuBarWithStore(); | ||||||
|  |  | ||||||
|   if (store.get(settings.enableDiscord) && !discordModule.rpc) { |   if (store.get(settings.enableDiscord) && !discordModule.rpc) { | ||||||
|     discordModule.initRPC(); |     discordModule.initRPC(); | ||||||
|   | |||||||
| @@ -82,17 +82,20 @@ const elements = { | |||||||
|  |  | ||||||
|   getAlbumName: function () { |   getAlbumName: function () { | ||||||
|     //If listening to an album, get its name from the header title |     //If listening to an album, get its name from the header title | ||||||
|     if(window.location.href.includes('/album/')) { |     if (window.location.href.includes("/album/")) { | ||||||
|       const albumName = window.document.querySelector(this.album_header_title); |       const albumName = window.document.querySelector(this.album_header_title); | ||||||
|       if(albumName) { |       if (albumName) { | ||||||
|         return albumName.textContent; |         return albumName.textContent; | ||||||
|       } |       } | ||||||
|       //If listening to a playlist or a mix, get album name from the list |       //If listening to a playlist or a mix, get album name from the list | ||||||
|     } else if(window.location.href.includes('/playlist/') || window.location.href.includes('/mix/')) { |     } else if ( | ||||||
|       if(currentPlayStatus === statuses.playing) { |       window.location.href.includes("/playlist/") || | ||||||
|  |       window.location.href.includes("/mix/") | ||||||
|  |     ) { | ||||||
|  |       if (currentPlayStatus === statuses.playing) { | ||||||
|         const row = window.document.querySelector(this.playing_title).closest(this.tracklist_row); |         const row = window.document.querySelector(this.playing_title).closest(this.tracklist_row); | ||||||
|         if(row) { |         if (row) { | ||||||
|          return row.querySelector(this.album_name_cell).textContent; |           return row.querySelector(this.album_name_cell).textContent; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @@ -213,6 +216,12 @@ function handleLogout() { | |||||||
|   ); |   ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function addFullScreenListeners() { | ||||||
|  |   window.document.addEventListener("fullscreenchange", (event) => { | ||||||
|  |     ipcRenderer.send(globalEvents.refreshMenuBar); | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Add ipc event listeners. |  * Add ipc event listeners. | ||||||
|  * Some actions triggered outside of the site need info from the site. |  * Some actions triggered outside of the site need info from the site. | ||||||
| @@ -274,8 +283,8 @@ function convertDuration(duration) { | |||||||
| function updateMediaInfo(options, notify) { | function updateMediaInfo(options, notify) { | ||||||
|   if (options) { |   if (options) { | ||||||
|     ipcRenderer.send(globalEvents.updateInfo, options); |     ipcRenderer.send(globalEvents.updateInfo, options); | ||||||
|     if(store.get(settings.notifications) && notify) { |     if (store.get(settings.notifications) && notify) { | ||||||
|       new Notification({ title: options.title, body: options.message, icon: options.icon}).show(); |       new Notification({ title: options.title, body: options.message, icon: options.icon }).show(); | ||||||
|     } |     } | ||||||
|     if (player) { |     if (player) { | ||||||
|       player.metadata = { |       player.metadata = { | ||||||
| @@ -331,7 +340,7 @@ setInterval(function () { | |||||||
|     url: currentURL, |     url: currentURL, | ||||||
|     current: current, |     current: current, | ||||||
|     duration: duration, |     duration: duration, | ||||||
|     'app-name': appName, |     "app-name": appName, | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   const playStatusChanged = currentStatus !== currentPlayStatus; |   const playStatusChanged = currentStatus !== currentPlayStatus; | ||||||
| @@ -452,3 +461,4 @@ if (process.platform === "linux" && store.get(settings.mpris)) { | |||||||
|  |  | ||||||
| addHotKeys(); | addHotKeys(); | ||||||
| addIPCEventListeners(); | addIPCEventListeners(); | ||||||
|  | addFullScreenListeners(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user