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

@@ -2608,15 +2608,12 @@ export type UpdateChapterMutationVariables = Exact<{
getBookmarked: Scalars['Boolean']['input'];
getRead: Scalars['Boolean']['input'];
getLastPageRead: Scalars['Boolean']['input'];
id: Scalars['Int']['input'];
chapterIdToDelete: Scalars['Int']['input'];
deleteChapter: Scalars['Boolean']['input'];
mangaId: Scalars['Int']['input'];
downloadAhead: Scalars['Boolean']['input'];
}>;
export type UpdateChapterMutation = { __typename?: 'Mutation', updateChapter: { __typename?: 'UpdateChapterPayload', clientMutationId?: string | null, chapter: { __typename?: 'ChapterType', id: number, isBookmarked?: boolean, isRead?: boolean, lastReadAt?: any, lastPageRead?: number, manga?: { __typename?: 'MangaType', id: number, unreadCount: number, lastReadChapter?: { __typename?: 'ChapterType', id: number } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number } | null } } }, deleteDownloadedChapter?: { __typename?: 'DeleteDownloadedChapterPayload', clientMutationId?: string | null, chapters: { __typename?: 'ChapterType', id: number, isDownloaded: boolean, manga: { __typename?: 'MangaType', id: number, downloadCount: number } } }, downloadAhead?: { __typename?: 'DownloadAheadPayload', clientMutationId?: string | null } };
export type UpdateChapterMutation = { __typename?: 'Mutation', updateChapter: { __typename?: 'UpdateChapterPayload', clientMutationId?: string | null, chapter: { __typename?: 'ChapterType', id: number, isBookmarked?: boolean, isRead?: boolean, lastReadAt?: any, lastPageRead?: number, manga?: { __typename?: 'MangaType', id: number, unreadCount: number, lastReadChapter?: { __typename?: 'ChapterType', id: number } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number } | null } } }, deleteDownloadedChapter?: { __typename?: 'DeleteDownloadedChapterPayload', clientMutationId?: string | null, chapters: { __typename?: 'ChapterType', id: number, isDownloaded: boolean, manga: { __typename?: 'MangaType', id: number, downloadCount: number } } } };
export type UpdateChaptersMutationVariables = Exact<{
input: UpdateChaptersInput;
@@ -2625,13 +2622,10 @@ export type UpdateChaptersMutationVariables = Exact<{
getLastPageRead: Scalars['Boolean']['input'];
chapterIdsToDelete: Array<Scalars['Int']['input']> | Scalars['Int']['input'];
deleteChapters: Scalars['Boolean']['input'];
mangaIds: Array<Scalars['Int']['input']> | Scalars['Int']['input'];
latestReadChapterIds: Array<Scalars['Int']['input']> | Scalars['Int']['input'];
downloadAhead: Scalars['Boolean']['input'];
}>;
export type UpdateChaptersMutation = { __typename?: 'Mutation', updateChapters: { __typename?: 'UpdateChaptersPayload', clientMutationId?: string | null, chapters: Array<{ __typename?: 'ChapterType', id: number, isBookmarked?: boolean, isRead?: boolean, lastReadAt?: any, lastPageRead?: number, manga?: { __typename?: 'MangaType', id: number, unreadCount: number, lastReadChapter?: { __typename?: 'ChapterType', id: number } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number } | null } }> }, deleteDownloadedChapters?: { __typename?: 'DeleteDownloadedChaptersPayload', clientMutationId?: string | null, chapters: Array<{ __typename?: 'ChapterType', id: number, isDownloaded: boolean, manga: { __typename?: 'MangaType', id: number, downloadCount: number } }> }, downloadAhead?: { __typename?: 'DownloadAheadPayload', clientMutationId?: string | null } };
export type UpdateChaptersMutation = { __typename?: 'Mutation', updateChapters: { __typename?: 'UpdateChaptersPayload', clientMutationId?: string | null, chapters: Array<{ __typename?: 'ChapterType', id: number, isBookmarked?: boolean, isRead?: boolean, lastReadAt?: any, lastPageRead?: number, manga?: { __typename?: 'MangaType', id: number, unreadCount: number, lastReadChapter?: { __typename?: 'ChapterType', id: number } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number } | null } }> }, deleteDownloadedChapters?: { __typename?: 'DeleteDownloadedChaptersPayload', clientMutationId?: string | null, chapters: Array<{ __typename?: 'ChapterType', id: number, isDownloaded: boolean, manga: { __typename?: 'MangaType', id: number, downloadCount: number } }> } };
export type ClearDownloaderMutationVariables = Exact<{
input?: InputMaybe<ClearDownloaderInput>;

View File

@@ -93,11 +93,8 @@ export const UPDATE_CHAPTER = gql`
$getBookmarked: Boolean!
$getRead: Boolean!
$getLastPageRead: Boolean!
$id: Int!
$chapterIdToDelete: Int!
$deleteChapter: Boolean!
$mangaId: Int!
$downloadAhead: Boolean!
) {
updateChapter(input: $input) {
clientMutationId
@@ -130,9 +127,6 @@ export const UPDATE_CHAPTER = gql`
}
}
}
downloadAhead(input: { mangaIds: [$mangaId], latestReadChapterIds: [$id] }) @include(if: $downloadAhead) {
clientMutationId
}
}
`;
@@ -144,9 +138,6 @@ export const UPDATE_CHAPTERS = gql`
$getLastPageRead: Boolean!
$chapterIdsToDelete: [Int!]!
$deleteChapters: Boolean!
$mangaIds: [Int!]!
$latestReadChapterIds: [Int!]!
$downloadAhead: Boolean!
) {
updateChapters(input: $input) {
clientMutationId
@@ -179,9 +170,5 @@ export const UPDATE_CHAPTERS = gql`
}
}
}
downloadAhead(input: { mangaIds: $mangaIds, latestReadChapterIds: $latestReadChapterIds })
@include(if: $downloadAhead) {
clientMutationId
}
}
`;