Feature/download ahead trigger chapter downloads client side (#597)

* Trigger download ahead while reading client side

* Trigger download ahead while reading earlier

Download ahead was only triggered once the chapter got marked as read

* Optionally ignore dupe chapters for download ahead

* Consider current chapters scanlator for dupe check

* Update download ahead related settings

- add new metadata setting for download ahead limit
- previous setting
  - rename
  - update usage (auto download new chapters limit)

* Select chapter to auto delete while reading depending on ignore dupe setting

Currently, the n-th to last chapter always got deleted ignoring if "ignore dupes" setting was enabled or not.

* Only auto delete chapter while reading if it is read

In case not the last read but the n-th to last read chapter should get auto deleted while reading, it currently just got deleted ignoring if it has been read or not.
This commit is contained in:
schroda
2024-02-16 19:16:18 +01:00
committed by GitHub
parent 0edec685f9
commit 2acf2b6d33
10 changed files with 232 additions and 116 deletions

View File

@@ -1762,25 +1762,21 @@ export class RequestManager {
id: number,
patch: UpdateChapterPatchInput & {
chapterIdToDelete?: number;
downloadAheadMangaId?: number;
},
options?: MutationOptions<UpdateChapterMutation, UpdateChapterMutationVariables>,
): AbortableApolloMutationResponse<UpdateChapterMutation> {
const { chapterIdToDelete = -1, downloadAheadMangaId = -1, ...updatePatch } = patch;
const { chapterIdToDelete = -1, ...updatePatch } = patch;
return this.doRequest<UpdateChapterMutation, UpdateChapterMutationVariables>(
GQLMethod.MUTATION,
UPDATE_CHAPTER,
{
id,
input: { id, patch: updatePatch },
getBookmarked: patch.isBookmarked != null,
getRead: patch.isRead != null,
getLastPageRead: patch.lastPageRead != null,
chapterIdToDelete,
deleteChapter: chapterIdToDelete >= 0,
mangaId: downloadAheadMangaId,
downloadAhead: downloadAheadMangaId !== -1,
},
options,
);
@@ -1809,12 +1805,10 @@ export class RequestManager {
public updateChapters(
ids: number[],
patch: UpdateChapterPatchInput & { chapterIdsToDelete?: number[]; mangaIds?: number[] },
patch: UpdateChapterPatchInput & { chapterIdsToDelete?: number[] },
options?: MutationOptions<UpdateChaptersMutation, UpdateChaptersMutationVariables>,
): AbortableApolloMutationResponse<UpdateChaptersMutation> {
const { chapterIdsToDelete = [], mangaIds = [], ...updatePatch } = patch;
const downloadAhead = !!mangaIds.length;
const { chapterIdsToDelete = [], ...updatePatch } = patch;
return this.doRequest<UpdateChaptersMutation, UpdateChaptersMutationVariables>(
GQLMethod.MUTATION,
@@ -1826,9 +1820,6 @@ export class RequestManager {
getLastPageRead: patch.lastPageRead != null,
chapterIdsToDelete,
deleteChapters: !!chapterIdsToDelete.length,
mangaIds,
downloadAhead,
latestReadChapterIds: downloadAhead ? ids : [],
},
options,
);