Cleaning.
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
aminecmi 2022-12-06 22:48:30 +01:00
parent 89c570f34f
commit bf8f7d8667
3 changed files with 40 additions and 51 deletions

View File

@ -61,11 +61,8 @@
<string name="card_height_on">Kartenhöhe passt sich Inhalt an</string> <string name="card_height_on">Kartenhöhe passt sich Inhalt an</string>
<string name="card_height_off">Kartenhöhe ist fix</string> <string name="card_height_off">Kartenhöhe ist fix</string>
<string name="source_code">Quellcode</string> <string name="source_code">Quellcode</string>
<string name="drawer_item_filters">Filter</string>
<string name="drawer_action_clear">leeren</string>
<string name="filter_item_tags">Tags</string> <string name="filter_item_tags">Tags</string>
<string name="filter_item_sources">Quellen</string> <string name="filter_item_sources">Quellen</string>
<string name="drawer_loading">Lade…</string>
<string name="menu_home_search">Suche</string> <string name="menu_home_search">Suche</string>
<string name="can_delete_source">Can\'t delete the source…</string> <string name="can_delete_source">Can\'t delete the source…</string>
<string name="base_url_error">Beim Versuch deine Selfoss-Instanz zu erreichen ist ein Fehler aufgetreten. Solltet dieser Fehler bestehen bleiben, trete bitte mit mir in Kontakt.</string> <string name="base_url_error">Beim Versuch deine Selfoss-Instanz zu erreichen ist ein Fehler aufgetreten. Solltet dieser Fehler bestehen bleiben, trete bitte mit mir in Kontakt.</string>

View File

@ -196,7 +196,7 @@ class RepositoryTest {
every { appSettingsService.isItemCachingEnabled() } returns true every { appSettingsService.isItemCachingEnabled() } returns true
initializeRepository(MutableStateFlow(false)) initializeRepository(MutableStateFlow(false))
repository.tagFilter = MutableStateFlow(SelfossModel.Tag("Test", "red", 3)) repository.setTagFilter(SelfossModel.Tag("Test", "red", 3))
runBlocking { runBlocking {
repository.getNewerItems() repository.getNewerItems()
} }
@ -224,16 +224,14 @@ class RepositoryTest {
every { appSettingsService.isItemCachingEnabled() } returns true every { appSettingsService.isItemCachingEnabled() } returns true
initializeRepository(MutableStateFlow(false)) initializeRepository(MutableStateFlow(false))
repository.sourceFilter = MutableStateFlow( repository.setSourceFilter(SelfossModel.Source(
SelfossModel.Source( 1,
1, "Test",
"Test", listOf("tags"),
listOf("tags"), "spouts\\rss\\fulltextrss",
"spouts\\rss\\fulltextrss", "",
"", "b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png" ))
)
)
runBlocking { runBlocking {
repository.getNewerItems() repository.getNewerItems()
} }
@ -1304,17 +1302,15 @@ class RepositoryTest {
) )
initializeRepository() initializeRepository()
repository.tagFilter = MutableStateFlow(SelfossModel.Tag("Tag", "read", 0)) repository.setTagFilter(SelfossModel.Tag("Tag", "read", 0))
repository.sourceFilter = MutableStateFlow( repository.setSourceFilter(SelfossModel.Source(
SelfossModel.Source( 1,
1, "First source",
"First source", listOf("Test", "second"),
listOf("Test", "second"), "spouts\\rss\\fulltextrss",
"spouts\\rss\\fulltextrss", "",
"", "d8c92cdb1ef119ea85c4b9205c879ca7.png"
"d8c92cdb1ef119ea85c4b9205c879ca7.png" ))
)
)
repository.searchFilter = "search" repository.searchFilter = "search"
runBlocking { runBlocking {
repository.tryToCacheItemsAndGetNewOnes() repository.tryToCacheItemsAndGetNewOnes()
@ -1329,17 +1325,15 @@ class RepositoryTest {
StatusAndData(success = false, data = generateTestApiItem()) StatusAndData(success = false, data = generateTestApiItem())
initializeRepository() initializeRepository()
repository.tagFilter = MutableStateFlow(SelfossModel.Tag("Tag", "read", 0)) repository.setTagFilter(SelfossModel.Tag("Tag", "read", 0))
repository.sourceFilter = MutableStateFlow( repository.setSourceFilter(SelfossModel.Source(
SelfossModel.Source( 1,
1, "First source",
"First source", listOf("Test", "second"),
listOf("Test", "second"), "spouts\\rss\\fulltextrss",
"spouts\\rss\\fulltextrss", "",
"", "d8c92cdb1ef119ea85c4b9205c879ca7.png"
"d8c92cdb1ef119ea85c4b9205c879ca7.png" ))
)
)
repository.searchFilter = "search" repository.searchFilter = "search"
runBlocking { runBlocking {
repository.tryToCacheItemsAndGetNewOnes() repository.tryToCacheItemsAndGetNewOnes()
@ -1354,17 +1348,15 @@ class RepositoryTest {
StatusAndData(success = false, data = generateTestApiItem()) StatusAndData(success = false, data = generateTestApiItem())
initializeRepository(MutableStateFlow(false)) initializeRepository(MutableStateFlow(false))
repository.tagFilter = MutableStateFlow(SelfossModel.Tag("Tag", "read", 0)) repository.setTagFilter(SelfossModel.Tag("Tag", "read", 0))
repository.sourceFilter = MutableStateFlow( repository.setSourceFilter(SelfossModel.Source(
SelfossModel.Source( 1,
1, "First source",
"First source", listOf("Test", "second"),
listOf("Test", "second"), "spouts\\rss\\fulltextrss",
"spouts\\rss\\fulltextrss", "",
"", "d8c92cdb1ef119ea85c4b9205c879ca7.png"
"d8c92cdb1ef119ea85c4b9205c879ca7.png" ))
)
)
repository.searchFilter = "search" repository.searchFilter = "search"
runBlocking { runBlocking {
repository.tryToCacheItemsAndGetNewOnes() repository.tryToCacheItemsAndGetNewOnes()

View File

@ -62,11 +62,11 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
(it.unread && displayedItems == ItemType.UNREAD) || (it.unread && displayedItems == ItemType.UNREAD) ||
(it.starred && displayedItems == ItemType.STARRED) (it.starred && displayedItems == ItemType.STARRED)
} }
if (tagFilter != null) { if (tagFilter.value != null) {
dbItems = dbItems.filter { it.tags.split(',').contains(tagFilter.value?.tag) } dbItems = dbItems.filter { it.tags.split(',').contains(tagFilter.value!!.tag) }
} }
if (sourceFilter != null) { if (sourceFilter.value != null) {
dbItems = dbItems.filter { it.sourcetitle == sourceFilter.value?.title } dbItems = dbItems.filter { it.sourcetitle == sourceFilter.value!!.title }
} }
fetchedItems = StatusAndData.succes( fetchedItems = StatusAndData.succes(
dbItems.map { it.toView() } dbItems.map { it.toView() }