Do not store articles if connectivity is available.
This commit is contained in:
parent
b14b34441b
commit
442e4bf876
@ -60,14 +60,14 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
|
|||||||
search)
|
search)
|
||||||
|
|
||||||
if (fetchedItems != null) {
|
if (fetchedItems != null) {
|
||||||
storeItems(fetchedItems)
|
items = ArrayList(fetchedItems)
|
||||||
}
|
}
|
||||||
return filterSelectedItems(items)
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getOlderItems(): ArrayList<SelfossModel.Item> {
|
override suspend fun getOlderItems(): ArrayList<SelfossModel.Item> {
|
||||||
// TODO: Check connectivity
|
// TODO: Check connectivity
|
||||||
val offset = filterSelectedItems(items).size
|
val offset = items.size
|
||||||
val fetchedItems = api.getItems(selectedType,
|
val fetchedItems = api.getItems(selectedType,
|
||||||
settings.getString("prefer_api_items_number", "200").toInt(),
|
settings.getString("prefer_api_items_number", "200").toInt(),
|
||||||
offset,
|
offset,
|
||||||
@ -76,9 +76,9 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
|
|||||||
search)
|
search)
|
||||||
|
|
||||||
if (fetchedItems != null) {
|
if (fetchedItems != null) {
|
||||||
storeItems(fetchedItems)
|
items = ArrayList(fetchedItems)
|
||||||
}
|
}
|
||||||
return filterSelectedItems(items)
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeItems(fetchedItems: List<SelfossModel.Item>) {
|
private fun storeItems(fetchedItems: List<SelfossModel.Item>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user