Skip to content

Commit

Permalink
dont send callback on playPause() if still handling data from new song
Browse files Browse the repository at this point in the history
fix notifications showing thumbnail of last song
  • Loading branch information
Araxeus committed Jan 4, 2022
1 parent 4d595f5 commit 98f990f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions providers/song-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,22 @@ const registerCallback = (callback) => {
callbacks.push(callback);
};

let handlingData = false;

const registerProvider = (win) => {
// This will be called when the song-info-front finds a new request with song data
ipcMain.on("video-src-changed", async (_, responseText) => {
handlingData = true;
await handleData(responseText, win);
handlingData = false;
callbacks.forEach((c) => {
c(songInfo);
});
});
ipcMain.on("playPaused", (_, { isPaused, elapsedSeconds }) => {
songInfo.isPaused = isPaused;
songInfo.elapsedSeconds = elapsedSeconds;
if (handlingData) return;
callbacks.forEach((c) => {
c(songInfo);
});
Expand Down

0 comments on commit 98f990f

Please sign in to comment.