Filter Duplicates in Chapter Selection (Closes #847)
This commit is contained in:
@@ -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',
|
||||
),
|
||||
]);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -126,7 +126,7 @@ const popularNovels = async (page: number) => {
|
||||
const NovelsOnlineScraper = {
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
// parseChapter,
|
||||
searchNovels,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user