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

@@ -21,6 +21,7 @@ import { convertToGqlMeta, requestUpdateServerMetadata } from '@/util/metadata.t
import { makeToast } from '@/components/util/Toast.tsx';
import { DeleteChaptersWhileReadingSetting } from '@/components/settings/downloads/DeleteChaptersWhileReadingSetting.tsx';
import { CategoriesInclusionSetting } from '@/components/settings/CategoriesInclusionSetting.tsx';
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
type DownloadSettingsType = Pick<
ServerSettings,
@@ -100,7 +101,7 @@ export const DownloadSettings = () => {
</ListItem>
<List
subheader={
<ListSubheader component="div" id="download-settings-auto-download">
<ListSubheader component="div" id="download-settings-auto-delete-downloads">
{t('download.settings.delete_chapters.title')}
</ListSubheader>
}
@@ -143,6 +144,29 @@ export const DownloadSettings = () => {
onChange={(e) => updateSetting('autoDownloadNewChapters', e.target.checked)}
/>
</ListItem>
<NumberSetting
disabled={!downloadSettings?.autoDownloadNewChapters}
settingTitle={t('download.settings.auto_download.download_limit.label.title')}
dialogDescription={t('download.settings.auto_download.download_limit.label.description')}
value={downloadSettings?.autoDownloadAheadLimit ?? 0}
settingValue={
// eslint-disable-next-line no-nested-ternary
downloadSettings?.autoDownloadAheadLimit !== undefined
? !downloadSettings.autoDownloadAheadLimit
? t('global.label.none')
: t('download.settings.download_ahead.label.value', {
chapters: downloadSettings.autoDownloadAheadLimit,
count: downloadSettings.autoDownloadAheadLimit,
})
: undefined
}
defaultValue={0}
minValue={0}
maxValue={20}
showSlider
valueUnit={t('chapter.title')}
handleUpdate={(downloadAheadLimit) => updateSetting('autoDownloadAheadLimit', downloadAheadLimit)}
/>
<ListItem disabled={!downloadSettings?.autoDownloadNewChapters}>
<ListItemText primary={t('download.settings.auto_download.label.ignore_with_unread_chapters')} />
<Switch