mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 05:23:09 +01:00
Refactored nowPlaying code to always display the current state, even when the built-in UI is updated. fixes #351 #356 #370
This commit is contained in:
parent
4ef76c262e
commit
17b2818b70
@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- TIDAL will now close the previous notification if a new one is sent whilst the old is still visible. [#364](https://github.com/Mastermindzh/tidal-hifi/pull/364)
|
||||
- Updated developer documentation to get started in README [#365](https://github.com/Mastermindzh/tidal-hifi/pull/365)
|
||||
- Links in the about window now open in the user's default browser. fixes [#360](https://github.com/Mastermindzh/tidal-hifi/issues/360)
|
||||
- Refactored "nowPlaying" code to always display the current state, even when the built-in UI is updated.
|
||||
- fixes [#351](https://github.com/Mastermindzh/tidal-hifi/issues/351)
|
||||
- fixes [#356](https://github.com/Mastermindzh/tidal-hifi/issues/356)
|
||||
- fixes [#370](https://github.com/Mastermindzh/tidal-hifi/issues/370)
|
||||
|
||||
## [5.9.0]
|
||||
|
||||
|
@ -26,7 +26,8 @@ let player: Player;
|
||||
let currentPlayStatus = MediaStatus.paused;
|
||||
let currentListenBrainzDelayId: ReturnType<typeof setTimeout>;
|
||||
let scrobbleWaitingForDelay = false;
|
||||
let wasJustPausedOrResumed = false;
|
||||
|
||||
let currentlyPlaying = MediaStatus.paused;
|
||||
let currentMediaInfo: Options;
|
||||
let currentNotification: Electron.Notification;
|
||||
|
||||
@ -185,7 +186,6 @@ function getUpdateFrequency() {
|
||||
* Play or pause the current song
|
||||
*/
|
||||
function playPause() {
|
||||
wasJustPausedOrResumed = true;
|
||||
const play = elements.get("play");
|
||||
|
||||
if (play) {
|
||||
@ -361,7 +361,11 @@ function updateMediaInfo(options: Options, notify: boolean) {
|
||||
ipcRenderer.send(globalEvents.updateInfo, options);
|
||||
if (settingsStore.get(settings.notifications) && notify) {
|
||||
if (currentNotification) currentNotification.close();
|
||||
currentNotification = new Notification({ title: options.title, body: options.artists, icon: options.icon });
|
||||
currentNotification = new Notification({
|
||||
title: options.title,
|
||||
body: options.artists,
|
||||
icon: options.icon,
|
||||
});
|
||||
currentNotification.show();
|
||||
}
|
||||
updateMpris(options);
|
||||
@ -518,10 +522,12 @@ setInterval(function () {
|
||||
const current = elements.getText("current");
|
||||
const currentStatus = getCurrentlyPlayingStatus();
|
||||
|
||||
const playStateChanged = currentStatus != currentlyPlaying;
|
||||
|
||||
// update info if song changed or was just paused/resumed
|
||||
if (titleOrArtistsChanged || wasJustPausedOrResumed) {
|
||||
if (wasJustPausedOrResumed) {
|
||||
wasJustPausedOrResumed = false;
|
||||
if (titleOrArtistsChanged || playStateChanged) {
|
||||
if (playStateChanged) {
|
||||
currentlyPlaying = currentStatus;
|
||||
}
|
||||
skipArtistsIfFoundInSkippedArtistsList(artistsArray);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user