chore: clean up discord RPC hooks

This commit is contained in:
frozenKelp
2026-06-09 15:12:39 +05:30
parent 9f6996dcdb
commit 3926b5d064
2 changed files with 13 additions and 6 deletions
+2 -1
View File
@@ -216,6 +216,7 @@
? () => goForward(style, adjacent, lastPage, maybeMarkCurrentRead, startAtLast) ? () => goForward(style, adjacent, lastPage, maybeMarkCurrentRead, startAtLast)
: () => goBack(style, adjacent, startAtLast)); : () => goBack(style, adjacent, startAtLast));
// clear Discord presence before closing
function handleCloseReader() { function handleCloseReader() {
clearReading().catch(() => {}); clearReading().catch(() => {});
readerState.closeReader(); readerState.closeReader();
@@ -314,7 +315,7 @@
ch.id, ch.name, readerState.pageNumber, ch.id, ch.name, readerState.pageNumber,
); );
loadChapter(ch.id, useBlob, abortCtrl, startAtLastPageRef, markedRead, adjacent); loadChapter(ch.id, useBlob, abortCtrl, startAtLastPageRef, markedRead, adjacent);
setReading(manga, ch).catch(() => {}); setReading(manga, ch).catch(() => {}); // update Discord presence to show current chapter
}); });
} }
}); });
+7 -1
View File
@@ -204,7 +204,13 @@ class LibraryState {
this.tabFilters = { ...this.tabFilters, [tab]: {} }; this.tabFilters = { ...this.tabFilters, [tab]: {} };
} }
syncFromSettings(s: { hiddenLibraryTabs?: string[]; libraryPinnedTabOrder?: string[]; defaultLibraryCategoryId?: number | null; libraryShowAllInSaved?: boolean; libraryHideCompletedInSaved?: boolean }) { syncFromSettings(s: {
hiddenLibraryTabs?: string[];
libraryPinnedTabOrder?: string[];
defaultLibraryCategoryId?: number | null;
libraryShowAllInSaved?: boolean;
libraryHideCompletedInSaved?: boolean;
}) {
if (s.hiddenLibraryTabs) this.hiddenTabs = new Set(s.hiddenLibraryTabs); if (s.hiddenLibraryTabs) this.hiddenTabs = new Set(s.hiddenLibraryTabs);
if (s.libraryPinnedTabOrder) this.pinnedTabOrder = s.libraryPinnedTabOrder; if (s.libraryPinnedTabOrder) this.pinnedTabOrder = s.libraryPinnedTabOrder;
if (s.defaultLibraryCategoryId !== undefined) this.defaultCategoryId = s.defaultLibraryCategoryId ?? null; if (s.defaultLibraryCategoryId !== undefined) this.defaultCategoryId = s.defaultLibraryCategoryId ?? null;