diff --git a/src/screens/novel/NovelScreen.js b/src/screens/novel/NovelScreen.js index 3db34ac88..3fd5514b6 100644 --- a/src/screens/novel/NovelScreen.js +++ b/src/screens/novel/NovelScreen.js @@ -68,6 +68,7 @@ import { getChapterScreenRouteParams } from '../../utils/NavigationUtils'; import NovelScreenLoading from './components/LoadingAnimation/NovelScreenLoading'; import { useTrackerReducer } from '@redux/hooks'; import EpubIconButton from './components/EpubIconButton'; +import { uniqBy } from 'lodash-es'; const Novel = ({ route, navigation }) => { const item = route.params; @@ -290,25 +291,37 @@ const Novel = ({ route, navigation }) => { if (lastSelectedChapter.chapterId !== chapter.chapterId) { if (lastSelectedChapter.chapterId > chapter.chapterId) { - setSelected(sel => [ - ...sel, - chapter, - ...chapters.filter( - chap => - (chap.chapterId <= chapter.chapterId || - chap.chapterId >= lastSelectedChapter.chapterId) === false, + setSelected(sel => + uniqBy( + [ + ...sel, + chapter, + ...chapters.filter( + chap => + (chap.chapterId <= chapter.chapterId || + chap.chapterId >= lastSelectedChapter.chapterId) === + false, + ), + ], + 'chapterId', ), - ]); + ); } else { - setSelected(sel => [ - ...sel, - chapter, - ...chapters.filter( - chap => - (chap.chapterId >= chapter.chapterId || - chap.chapterId <= lastSelectedChapter.chapterId) === false, + setSelected(sel => + uniqBy( + [ + ...sel, + chapter, + ...chapters.filter( + chap => + (chap.chapterId >= chapter.chapterId || + chap.chapterId <= lastSelectedChapter.chapterId) === + false, + ), + ], + 'chapterId', ), - ]); + ); } } } diff --git a/src/screens/novel/components/NovelBottomSheet.js b/src/screens/novel/components/NovelBottomSheet.js index 05db2573c..fa818fb22 100644 --- a/src/screens/novel/components/NovelBottomSheet.js +++ b/src/screens/novel/components/NovelBottomSheet.js @@ -42,14 +42,14 @@ const ChaptersSettingsSheet = ({ : false } onPress={() => { - if (filter.match('AND downloaded=0')) { + if (filter.match('AND downloaded=1')) { filterChapters( - filter.replace(' AND downloaded=0', ' AND downloaded=1'), + filter.replace(' AND downloaded=1', ' AND downloaded=0'), ); - } else if (filter.match('AND downloaded=1')) { - filterChapters(filter.replace(' AND downloaded=1', '')); + } else if (filter.match('AND downloaded=0')) { + filterChapters(filter.replace(' AND downloaded=0', '')); } else { - filterChapters(filter + ' AND downloaded=0'); + filterChapters(filter + ' AND downloaded=1'); } }} /> diff --git a/src/sources/en/NovelOnline.ts b/src/sources/en/NovelOnline.ts index b987b8a8f..05d671bdc 100644 --- a/src/sources/en/NovelOnline.ts +++ b/src/sources/en/NovelOnline.ts @@ -126,7 +126,7 @@ const popularNovels = async (page: number) => { const NovelsOnlineScraper = { popularNovels, parseNovelAndChapters, - parseChapter, + // parseChapter, searchNovels, };