mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 09:19:56 -05:00
fix: set rpc to idle when idle
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -154,6 +154,10 @@
|
||||
if (appState.status === 'ready') resetIdleTimer()
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
if (appState.idleSplash && settingsState.settings.discordRpc) setIdle().catch(() => {})
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
if (appState.status !== 'ready') return
|
||||
// capture phase so events from any component — including modals — reset the timer
|
||||
|
||||
Reference in New Issue
Block a user