From 5377e6c0f8648170b988c0cbeb75f0b2824a0440 Mon Sep 17 00:00:00 2001 From: davide Date: Sat, 13 Aug 2022 17:48:13 +0200 Subject: [PATCH] Make items read by swiping disappear --- .../android/adapters/ItemsAdapter.kt | 17 +++++++---------- .../repository/RepositoryImpl.kt | 2 ++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt index c905b38..5ba7463 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt @@ -80,17 +80,14 @@ abstract class ItemsAdapter : RecyclerView.Adapte val i = items[position] CoroutineScope(Dispatchers.IO).launch { repository.markAsRead(i.id) - // TODO: update db - } - // Todo: -// if (SharedItems.displayedItems == "unread") { -// items.remove(i) -// notifyItemRemoved(position) -// updateItems(items) -// } else { -// notifyItemChanged(position) -// } + if (repository.displayedItems == "unread") { + items.remove(i) + notifyItemRemoved(position) + updateItems(items) + } else { + notifyItemChanged(position) + } if (showSnackbar) { unmarkSnackbar(i, position) } 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 07752d8..e7b36b8 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 @@ -300,4 +300,6 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet apiMajorVersion = settings.getInt("apiVersionMajor", 0) } } + + // TODO: Handle offline actions } \ No newline at end of file