Compare commits
2 Commits
02098a7aa9
...
8bfe14c019
Author | SHA1 | Date | |
---|---|---|---|
8bfe14c019 | |||
208babbce3 |
@ -66,16 +66,16 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
|||||||
} else {
|
} else {
|
||||||
if (appSettingsService.isItemCachingEnabled()) {
|
if (appSettingsService.isItemCachingEnabled()) {
|
||||||
fromDB = true
|
fromDB = true
|
||||||
val dbItems = getDBItems().filter {
|
var dbItems = getDBItems().filter {
|
||||||
displayedItems == ItemType.ALL ||
|
displayedItems == ItemType.ALL ||
|
||||||
(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 != null) {
|
||||||
dbItems.filter { it.tags.contains(tagFilter!!.tag) }
|
dbItems = dbItems.filter { it.tags.split(',').contains(tagFilter!!.tag) }
|
||||||
}
|
}
|
||||||
if (sourceFilter != null) {
|
if (sourceFilter != null) {
|
||||||
dbItems.filter { it.sourcetitle == sourceFilter!!.title }
|
dbItems = dbItems.filter { it.sourcetitle == sourceFilter!!.title }
|
||||||
}
|
}
|
||||||
fetchedItems = SelfossModel.StatusAndData.succes(
|
fetchedItems = SelfossModel.StatusAndData.succes(
|
||||||
dbItems.map { it.toView() }
|
dbItems.map { it.toView() }
|
||||||
|
@ -179,12 +179,12 @@ class RepositoryTest() {
|
|||||||
val itemParameter2 = FakeItemParameters()
|
val itemParameter2 = FakeItemParameters()
|
||||||
val itemParameter3 = FakeItemParameters()
|
val itemParameter3 = FakeItemParameters()
|
||||||
itemParameter2.tags = "Test, Stuff"
|
itemParameter2.tags = "Test, Stuff"
|
||||||
|
itemParameter2.id = "2"
|
||||||
itemParameter3.tags = "Other, Tag"
|
itemParameter3.tags = "Other, Tag"
|
||||||
coEvery { db.itemsQueries.items().executeAsList() } returnsMany listOf(
|
itemParameter3.id = "3"
|
||||||
generateTestDBItems(itemParameter1),
|
coEvery { db.itemsQueries.items().executeAsList() } returns generateTestDBItems(itemParameter1) +
|
||||||
generateTestDBItems(itemParameter2),
|
generateTestDBItems(itemParameter2) +
|
||||||
generateTestDBItems(itemParameter3)
|
generateTestDBItems(itemParameter3)
|
||||||
)
|
|
||||||
|
|
||||||
every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false)
|
every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false)
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
@ -206,12 +206,12 @@ class RepositoryTest() {
|
|||||||
val itemParameter2 = FakeItemParameters()
|
val itemParameter2 = FakeItemParameters()
|
||||||
val itemParameter3 = FakeItemParameters()
|
val itemParameter3 = FakeItemParameters()
|
||||||
itemParameter2.sourcetitle = "Test"
|
itemParameter2.sourcetitle = "Test"
|
||||||
|
itemParameter2.id = "2"
|
||||||
itemParameter3.sourcetitle = "Other"
|
itemParameter3.sourcetitle = "Other"
|
||||||
coEvery { db.itemsQueries.items().executeAsList() } returnsMany listOf(
|
itemParameter3.id = "3"
|
||||||
generateTestDBItems(itemParameter1),
|
coEvery { db.itemsQueries.items().executeAsList() } returns generateTestDBItems(itemParameter1) +
|
||||||
generateTestDBItems(itemParameter2),
|
generateTestDBItems(itemParameter2) +
|
||||||
generateTestDBItems(itemParameter3)
|
generateTestDBItems(itemParameter3)
|
||||||
)
|
|
||||||
|
|
||||||
every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false)
|
every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false)
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
|
Loading…
Reference in New Issue
Block a user