Feature/download ahead while reading (#464)

* Download next chapters when marking chapter as read while reading

* Add "auto delete chapter" settings

* Delete chapter after finished reading

* Delete chapters after marking them as read

* Improve "mark previous as read" action

Send only ids of chapters that are actually unread
This commit is contained in:
schroda
2023-11-19 21:17:35 +01:00
committed by GitHub
parent e26907e2ce
commit d12ac27b61
10 changed files with 240 additions and 31 deletions

View File

@@ -2285,6 +2285,13 @@ export type StopDownloaderMutationVariables = Exact<{
export type StopDownloaderMutation = { __typename?: 'Mutation', stopDownloader: { __typename?: 'StopDownloaderPayload', clientMutationId?: string | null, downloadStatus: { __typename?: 'DownloadStatus', state: DownloaderState, queue: Array<{ __typename?: 'DownloadType', progress: number, state: DownloadState, tries: number, chapter: { __typename?: 'ChapterType', chapterNumber: number, fetchedAt: any, id: number, isBookmarked: boolean, isDownloaded: boolean, isRead: boolean, lastPageRead: number, lastReadAt: any, name: string, pageCount: number, realUrl?: string | null, scanlator?: string | null, sourceOrder: number, uploadDate: any, url: string, manga: { __typename?: 'MangaType', unreadCount: number, downloadCount: number, artist?: string | null, author?: string | null, chaptersLastFetchedAt?: any | null, description?: string | null, genre: Array<string>, id: number, inLibrary: boolean, inLibraryAt: any, initialized: boolean, lastFetchedAt?: any | null, realUrl?: string | null, status: MangaStatus, thumbnailUrl?: string | null, title: string, url: string, categories: { __typename?: 'CategoryNodeList', totalCount: number, nodes: Array<{ __typename?: 'CategoryType', default: boolean, id: number, includeInUpdate: IncludeInUpdate, name: string, order: number, meta: Array<{ __typename?: 'CategoryMetaType', key: string, value: string }>, mangas: { __typename?: 'MangaNodeList', totalCount: number } }> }, chapters: { __typename?: 'ChapterNodeList', totalCount: number }, meta: Array<{ __typename?: 'MangaMetaType', key: string, value: string }>, source?: { __typename?: 'SourceType', displayName: string, iconUrl: string, id: any, isConfigurable: boolean, isNsfw: boolean, lang: string, name: string, supportsLatest: boolean } | null }, meta: Array<{ __typename?: 'ChapterMetaType', key: string, value: string }> } }> } } };
export type DownloadAheadMutationVariables = Exact<{
input: DownloadAheadInput;
}>;
export type DownloadAheadMutation = { __typename?: 'Mutation', downloadAhead: { __typename?: 'DownloadAheadPayload', clientMutationId?: string | null } };
export type GetExtensionsFetchMutationVariables = Exact<{
input?: InputMaybe<FetchExtensionsInput>;
}>;

View File

@@ -128,3 +128,11 @@ export const STOP_DOWNLOADER = gql`
}
}
`;
export const DOWNLOAD_AHEAD = gql`
mutation DOWNLOAD_AHEAD($input: DownloadAheadInput!) {
downloadAhead(input: $input) {
clientMutationId
}
}
`;

View File

@@ -49,6 +49,8 @@ import {
DequeueChapterDownloadMutationVariables,
DequeueChapterDownloadsMutation,
DequeueChapterDownloadsMutationVariables,
DownloadAheadMutation,
DownloadAheadMutationVariables,
DownloadStatusSubscription,
DownloadStatusSubscriptionVariables,
EnqueueChapterDownloadMutation,
@@ -171,6 +173,7 @@ import {
DELETE_DOWNLOADED_CHAPTERS,
DEQUEUE_CHAPTER_DOWNLOAD,
DEQUEUE_CHAPTER_DOWNLOADS,
DOWNLOAD_AHEAD,
ENQUEUE_CHAPTER_DOWNLOAD,
ENQUEUE_CHAPTER_DOWNLOADS,
REORDER_CHAPTER_DOWNLOAD,
@@ -1909,6 +1912,12 @@ export class RequestManager {
): AbortableApolloUseMutationResponse<UpdateServerSettingsMutation, UpdateServerSettingsMutationVariables> {
return this.doRequest(GQLMethod.USE_MUTATION, UPDATE_SERVER_SETTINGS, undefined, options);
}
public useDownloadAhead(
options?: MutationHookOptions<DownloadAheadMutation, DownloadAheadMutationVariables>,
): AbortableApolloUseMutationResponse<DownloadAheadMutation, DownloadAheadMutationVariables> {
return this.doRequest(GQLMethod.USE_MUTATION, DOWNLOAD_AHEAD, undefined, options);
}
}
export const requestManager = new RequestManager();