Always cache images in background
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
@ -456,16 +456,19 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
db.itemsQueries.updateItem(item.datetime, item.title.getHtmlDecoded(), item.content, item.unread, item.starred, item.thumbnail, item.icon, item.link, item.sourcetitle, item.tags.joinToString(","), item.id.toString())
|
||||
|
||||
// TODO: This function should check for duplicate items
|
||||
suspend fun tryToCacheItemsAndGetNewOnes() {
|
||||
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item> {
|
||||
try {
|
||||
val previousNewItems = getDBItems().count { it.unread }
|
||||
val newItems = getMaxItemsForBackground(ItemType.UNREAD)
|
||||
val allItems = getMaxItemsForBackground(ItemType.ALL)
|
||||
val starredItems = getMaxItemsForBackground(ItemType.STARRED)
|
||||
val fullItemsList = newItems + allItems + starredItems
|
||||
insertDBItems(fullItemsList)
|
||||
return fullItemsList
|
||||
} catch (e: Throwable) {
|
||||
// We do nothing
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
// TODO: Add tests
|
||||
|
Reference in New Issue
Block a user