diff --git a/public/locales/en.json b/public/locales/en.json index 5420cc12..e6a31023 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -855,6 +855,12 @@ "title": "Auto webtoon mode" }, "background_color": "Background color", + "chapter_transition": { + "warning": { + "missing_chapter": "Inform about missing chapters on chapter transition", + "scanlator_change": "Inform about changing scanlator on chapter transition" + } + }, "custom_filter": { "brightness": "Custom brightness", "contrast": "Custom contrast", diff --git a/src/modules/metadata/Metadata.constants.ts b/src/modules/metadata/Metadata.constants.ts index 601524ea..96783ebf 100644 --- a/src/modules/metadata/Metadata.constants.ts +++ b/src/modules/metadata/Metadata.constants.ts @@ -73,6 +73,8 @@ const APP_METADATA_OBJECT: Record = { autoScroll: undefined, shouldShowReadingModePreview: undefined, shouldShowTapZoneLayoutPreview: undefined, + shouldInformAboutMissingChapter: undefined, + shouldInformAboutScanlatorChange: undefined, }; export const VALID_APP_METADATA_KEYS = Object.keys(APP_METADATA_OBJECT); diff --git a/src/modules/reader/components/settings/behaviour/ReaderBehaviourSettings.tsx b/src/modules/reader/components/settings/behaviour/ReaderBehaviourSettings.tsx index 3abf315e..cf1ab2da 100644 --- a/src/modules/reader/components/settings/behaviour/ReaderBehaviourSettings.tsx +++ b/src/modules/reader/components/settings/behaviour/ReaderBehaviourSettings.tsx @@ -85,6 +85,16 @@ export const ReaderBehaviourSettings = ({ checked={settings.shouldUseAutoWebtoonMode} onChange={(_, checked) => updateSetting('shouldUseAutoWebtoonMode', checked)} /> + updateSetting('shouldInformAboutMissingChapter', checked)} + /> + updateSetting('shouldInformAboutScanlatorChange', checked)} + /> updateSetting('autoScroll', ...args)} diff --git a/src/modules/reader/constants/ReaderSettings.constants.tsx b/src/modules/reader/constants/ReaderSettings.constants.tsx index ff366fcd..3891eb4c 100644 --- a/src/modules/reader/constants/ReaderSettings.constants.tsx +++ b/src/modules/reader/constants/ReaderSettings.constants.tsx @@ -59,6 +59,8 @@ const GLOBAL_READER_SETTING_OBJECT: Record = { diff --git a/src/modules/reader/services/ReaderControls.ts b/src/modules/reader/services/ReaderControls.ts index 30070408..590d78b3 100644 --- a/src/modules/reader/services/ReaderControls.ts +++ b/src/modules/reader/services/ReaderControls.ts @@ -168,7 +168,8 @@ export class ReaderControls { static useOpenChapter(): (offset: 'previous' | 'next') => void { const { t } = useTranslation(); - const { readingMode } = ReaderService.useSettings(); + const { readingMode, shouldInformAboutMissingChapter, shouldInformAboutScanlatorChange } = + ReaderService.useSettings(); const { currentChapter, previousChapter, nextChapter } = useReaderStateChaptersContext(); const openPreviousChapter = ReaderService.useNavigateToChapter(previousChapter, ReaderResumeMode.END); @@ -178,12 +179,26 @@ export class ReaderControls { (offset) => { switch (offset) { case 'previous': - ReaderControls.checkNextChapterConsistency(t, offset, currentChapter, previousChapter) + ReaderControls.checkNextChapterConsistency( + t, + offset, + currentChapter, + previousChapter, + shouldInformAboutMissingChapter, + shouldInformAboutScanlatorChange, + ) .then(openPreviousChapter) .catch(defaultPromiseErrorHandler('ReaderControls::checkNextChapterConsistency: previous')); break; case 'next': - ReaderControls.checkNextChapterConsistency(t, offset, currentChapter, nextChapter) + ReaderControls.checkNextChapterConsistency( + t, + offset, + currentChapter, + nextChapter, + shouldInformAboutMissingChapter, + shouldInformAboutScanlatorChange, + ) .then(openNextChapter) .catch(defaultPromiseErrorHandler('ReaderControls::checkNextChapterConsistency: next')); break; @@ -191,23 +206,34 @@ export class ReaderControls { throw new Error(`Unexpected "offset" (${offset})`); } }, - [t, currentChapter?.id, openPreviousChapter, openNextChapter, readingMode.value], + [ + t, + currentChapter?.id, + openPreviousChapter, + openNextChapter, + readingMode.value, + shouldInformAboutMissingChapter, + shouldInformAboutScanlatorChange, + ], ); } private static async checkNextChapterConsistency( t: TFunction, offset: 'previous' | 'next', - currentChapter?: TChapterReader | null, - chapterToOpen?: TChapterReader | null, + currentChapter: TChapterReader | null | undefined, + chapterToOpen: TChapterReader | null | undefined, + shouldInformAboutMissingChapter: boolean, + shouldInformAboutScanlatorChange: boolean, ): Promise { if (!currentChapter || !chapterToOpen) { return; } const missingChapters = Math.abs(currentChapter.chapterNumber - chapterToOpen.chapterNumber); - const isSameScanlator = currentChapter.scanlator === chapterToOpen.scanlator; - const isContinuousChapter = missingChapters <= 1; + const isSameScanlator = + !shouldInformAboutScanlatorChange || currentChapter.scanlator === chapterToOpen.scanlator; + const isContinuousChapter = !shouldInformAboutMissingChapter || missingChapters <= 1; const showWarning = !isSameScanlator || !isContinuousChapter; if (!showWarning) { diff --git a/src/modules/reader/types/Reader.types.ts b/src/modules/reader/types/Reader.types.ts index 38a16ce9..b87d9809 100644 --- a/src/modules/reader/types/Reader.types.ts +++ b/src/modules/reader/types/Reader.types.ts @@ -134,6 +134,8 @@ export interface IReaderSettingsGlobal { }; shouldShowReadingModePreview: boolean; shouldShowTapZoneLayoutPreview: boolean; + shouldInformAboutMissingChapter: boolean; + shouldInformAboutScanlatorChange: boolean; } export interface IReaderSettingsManga {