From 8bfe14c01944afef1fcae13875a1777c1db2b419 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Fri, 14 Oct 2022 00:10:35 +0200 Subject: [PATCH] Actually filter database items --- .../apps/readerforselfossv2/repository/RepositoryImpl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt index 4c7a03d..e0ae5e0 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt @@ -66,16 +66,16 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap } else { if (appSettingsService.isItemCachingEnabled()) { fromDB = true - val dbItems = getDBItems().filter { + var dbItems = getDBItems().filter { displayedItems == ItemType.ALL || (it.unread && displayedItems == ItemType.UNREAD) || (it.starred && displayedItems == ItemType.STARRED) } if (tagFilter != null) { - dbItems.filter { it.tags.contains(tagFilter!!.tag) } + dbItems = dbItems.filter { it.tags.split(',').contains(tagFilter!!.tag) } } if (sourceFilter != null) { - dbItems.filter { it.sourcetitle == sourceFilter!!.title } + dbItems = dbItems.filter { it.sourcetitle == sourceFilter!!.title } } fetchedItems = SelfossModel.StatusAndData.succes( dbItems.map { it.toView() }