From 442e4bf87674d36956fef618173d502eddc30879 Mon Sep 17 00:00:00 2001 From: davide Date: Wed, 27 Jul 2022 19:15:04 +0200 Subject: [PATCH] Do not store articles if connectivity is available. --- .../readerforselfossv2/repository/RepositoryImpl.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 de0375c..e933ff6 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 @@ -60,14 +60,14 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet search) if (fetchedItems != null) { - storeItems(fetchedItems) + items = ArrayList(fetchedItems) } - return filterSelectedItems(items) + return items } override suspend fun getOlderItems(): ArrayList { // TODO: Check connectivity - val offset = filterSelectedItems(items).size + val offset = items.size val fetchedItems = api.getItems(selectedType, settings.getString("prefer_api_items_number", "200").toInt(), offset, @@ -76,9 +76,9 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet search) if (fetchedItems != null) { - storeItems(fetchedItems) + items = ArrayList(fetchedItems) } - return filterSelectedItems(items) + return items } private fun storeItems(fetchedItems: List) {