From a298ed81d76147809fbb9dad54cac4908cf25f49 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Thu, 4 Jan 2024 22:15:33 +0530 Subject: [PATCH] Add Exclude Downloads Filter (Closes #848) --- .../novel/components/NovelBottomSheet.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/screens/novel/components/NovelBottomSheet.js b/src/screens/novel/components/NovelBottomSheet.js index cb56247a5..05db2573c 100644 --- a/src/screens/novel/components/NovelBottomSheet.js +++ b/src/screens/novel/components/NovelBottomSheet.js @@ -34,12 +34,24 @@ const ChaptersSettingsSheet = ({ theme={theme} label="Downloaded" color={theme.primary} - status={filter.match('AND downloaded=1')} - onPress={() => + status={ filter.match('AND downloaded=1') - ? filterChapters(filter.replace(' AND downloaded=1', '')) - : filterChapters(filter + ' AND downloaded=1') + ? true + : filter.match('AND downloaded=0') + ? 'indeterminate' + : false } + onPress={() => { + if (filter.match('AND downloaded=0')) { + filterChapters( + filter.replace(' AND downloaded=0', ' AND downloaded=1'), + ); + } else if (filter.match('AND downloaded=1')) { + filterChapters(filter.replace(' AND downloaded=1', '')); + } else { + filterChapters(filter + ' AND downloaded=0'); + } + }} />