fix: callback for time-changed event (#2577)

Co-authored-by: Derek Alsop <15299183+Azorant@users.noreply.github.com>
This commit is contained in:
JellyBrick
2024-11-03 19:18:06 +09:00
committed by GitHub
parent 516fbff3d7
commit 1e4cd699db
13 changed files with 137 additions and 91 deletions

View File

@ -5,7 +5,10 @@ import is from 'electron-is';
import { notificationImage } from './utils';
import interactive from './interactive';
import registerCallback, { type SongInfo } from '@/providers/song-info';
import registerCallback, {
type SongInfo,
SongInfoEvent,
} from '@/providers/song-info';
import type { NotificationsPluginConfig } from './index';
import type { BackendContext } from '@/types/contexts';
@ -30,8 +33,9 @@ const setup = () => {
let oldNotification: Notification;
let currentUrl: string | undefined;
registerCallback((songInfo: SongInfo) => {
registerCallback((songInfo: SongInfo, event) => {
if (
event !== SongInfoEvent.TimeChanged &&
!songInfo.isPaused &&
(songInfo.url !== currentUrl || config.unpauseNotification)
) {