fix: set rpc to idle when idle

This commit is contained in:
frozenKelp
2026-06-09 20:13:41 +05:30
parent 22c4a222d8
commit 32bdeb92ff
2 changed files with 15 additions and 2 deletions
+11 -2
View File
@@ -2,7 +2,7 @@
import { onMount, untrack, tick } from "svelte";
import { readerState, PAGE_STYLES } from "$lib/state/reader.svelte";
import { settingsState, updateSettings } from "$lib/state/settings.svelte";
import { app } from "$lib/state/app.svelte";
import { app, appState } from "$lib/state/app.svelte";
import { DEFAULT_KEYBINDS } from "$lib/core/keybinds/defaultBinds";
import { fetchPages, resolveUrl, preloadImage, measureAspect, buildPageGroups } from "$lib/components/reader/lib/pageLoader";
import { setupScrollTracking, appendNextChapter } from "$lib/components/reader/lib/scrollHandler";
@@ -321,11 +321,20 @@
ch.id, ch.name, readerState.pageNumber,
);
loadChapter(ch.id, useBlob, abortCtrl, startAtLastPageRef, markedRead, adjacent);
setReading(manga, ch).catch(() => {}); // update Discord presence to show current chapter
});
}
});
// Separate from chapter load: also re-fires when idle splash dismisses so presence is restored.
$effect(() => {
const ch = readerState.activeChapter;
const manga = readerState.activeManga;
const idle = appState.idleSplash;
if (ch && manga && !idle) {
untrack(() => setReading(manga, ch).catch(() => {}));
}
});
$effect(() => {
const page = readerState.pageNumber;
const chId = style === "longstrip"