mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
fix discord status clearing when song loops
This commit is contained in:
parent
4b4df28641
commit
41f8c34f6e
1 changed files with 7 additions and 7 deletions
|
|
@ -26,10 +26,8 @@ export const useDiscordRpc = () => {
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (
|
||||||
!current[0] || // No track
|
!current[0] || // No track
|
||||||
(current[0] &&
|
current[1] === 0 || // Start of track
|
||||||
current[2] === 'paused' && // Track paused
|
(current[2] === 'paused' && !discordSettings.showPaused) // Track paused with show paused setting disabled
|
||||||
(discordSettings.showPaused ? current[1] === 0 : true)) || // Beginning of track (only if show paused setting enabled)
|
|
||||||
(discordSettings.showPaused ? false : current[1] === 0) // Beginning of track (only if show paused setting disabled)
|
|
||||||
)
|
)
|
||||||
return discordRpc?.clearActivity();
|
return discordRpc?.clearActivity();
|
||||||
|
|
||||||
|
|
@ -38,11 +36,13 @@ export const useDiscordRpc = () => {
|
||||||
const trackChanged = lastUniqueId !== song.uniqueId;
|
const trackChanged = lastUniqueId !== song.uniqueId;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1. If we jump more then 1.2 seconds from last state, update status to match
|
1. If the song has just started, update status
|
||||||
2. If the current song id is completely different, update status
|
2. If we jump more then 1.2 seconds from last state, update status to match
|
||||||
3. If the player state changed, update status
|
3. If the current song id is completely different, update status
|
||||||
|
4. If the player state changed, update status
|
||||||
*/
|
*/
|
||||||
if (
|
if (
|
||||||
|
previous[1] === 0 ||
|
||||||
Math.abs((current[1] as number) - (previous[1] as number)) > 1.2 ||
|
Math.abs((current[1] as number) - (previous[1] as number)) > 1.2 ||
|
||||||
trackChanged ||
|
trackChanged ||
|
||||||
current[2] !== previous[2]
|
current[2] !== previous[2]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue