Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate can Delete old Downloaded chapters #178

Merged
merged 2 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import Slide from '$lib/components/Slide.svelte';
import {
bindTrack,
deleteDownloadedChapters,
fetchChaptersMigration,
updateChapters,
updateMangaCategories,
Expand All @@ -22,6 +23,7 @@
import { getContextClient } from '@urql/svelte';
import { type ResultOf } from '$lib/gql/graphql';
import type { SvelteComponent } from 'svelte';
import { ErrorHelp } from '$lib/util';

const modalStore = getModalStore();
export let parent: SvelteComponent;
Expand All @@ -32,6 +34,7 @@
let doChapters = true;
let doCategories = true;
let doTracking = true;
let deleteDownloaded = manga.downloadCount > 0 ? true : false;

let MigrateLoading = false;
let CopyLoading = false;
Expand Down Expand Up @@ -76,9 +79,24 @@
if (doTracking) {
ToDo.push(CopyMangaTracking());
}
if (deleteDownloaded) {
ToDo.push(deleteDownloadedMangas());
}
await Promise.all(ToDo);
}

async function deleteDownloadedMangas() {
const ids = manga.chapters.nodes.map((e) => e.id);
await ErrorHelp(
'failed to delete Downloaded chapters',
client
.mutation(deleteDownloadedChapters, {
ids
})
.toPromise()
);
}

async function CopyMangaChapters() {
const newChapters = await client
.mutation(fetchChaptersMigration, { id })
Expand Down Expand Up @@ -167,6 +185,14 @@
>
Tracking
</Slide>
{#if manga.downloadCount > 0}
<Slide
class="p-1 pl-2 outline-0 hover:variant-glass-surface"
bind:checked={deleteDownloaded}
>
Delete old Downloaded chapters
</Slide>
{/if}
</div>
</div>
<div class="flex justify-between p-4">
Expand Down
2 changes: 1 addition & 1 deletion versionToServerVersionMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
{
"tag": "v1.0.0",
"uiVersion": "r601",
"uiVersion": "r605",
"serverVersion": "r1498"
}
]