From 3be942a80766b60712f6b064db0203f6529d1b41 Mon Sep 17 00:00:00 2001 From: davide Date: Wed, 20 Jul 2022 11:04:08 +0200 Subject: [PATCH] DI Repository setup --- .../repository/Repository.kt | 32 ++++++++ .../repository/RepositoryImpl.kt | 82 +++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/Repository.kt create mode 100644 shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/Repository.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/Repository.kt new file mode 100644 index 0000000..36d795d --- /dev/null +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/Repository.kt @@ -0,0 +1,32 @@ +package bou.amine.apps.readerforselfossv2.repository + +import bou.amine.apps.readerforselfossv2.rest.SelfossModel + +interface Repository { + + // TODO: remove the items variables in favor of storing everything in the database + var items: List + var selectedItems: List + + // API + fun getItems(): List + fun getMoreItems(): List + fun stats(): SelfossModel.Stats + fun getTags(): List + fun getSpouts(): List + fun getSources(): List + fun markAsRead(id: String): Boolean + fun unmarkAsRead(id: String): Boolean + fun starr(id: String): Boolean + fun unstarr(id: String): Boolean + fun markAllAsRead(ids: List): Boolean + fun createSource(title: String, + url: String, + spout: String, + tags: String, + filter: String): Boolean + fun deleteSource(id: Int): Boolean + fun updateRemote(): Boolean + fun login(): Boolean + fun refreshLoginInformation(): Boolean +} \ No newline at end of file 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 new file mode 100644 index 0000000..d1b5a5e --- /dev/null +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt @@ -0,0 +1,82 @@ +package bou.amine.apps.readerforselfossv2.repository + +import bou.amine.apps.readerforselfossv2.rest.SelfossApi +import bou.amine.apps.readerforselfossv2.rest.SelfossModel +import com.russhwolf.settings.Settings + +class RepositoryImpl(api: SelfossApi) : Repository { + val settings = Settings() + + override lateinit var items: List + override lateinit var selectedItems: List + + override fun getItems(): List { + return items + } + + override fun getMoreItems(): List { + TODO("Not yet implemented") + } + + override fun stats(): SelfossModel.Stats { + TODO("Not yet implemented") + } + + override fun getTags(): List { + TODO("Not yet implemented") + } + + override fun getSpouts(): List { + TODO("Not yet implemented") + } + + override fun getSources(): List { + TODO("Not yet implemented") + } + + override fun markAsRead(id: String): Boolean { + TODO("Not yet implemented") + } + + override fun unmarkAsRead(id: String): Boolean { + TODO("Not yet implemented") + } + + override fun starr(id: String): Boolean { + TODO("Not yet implemented") + } + + override fun unstarr(id: String): Boolean { + TODO("Not yet implemented") + } + + override fun markAllAsRead(ids: List): Boolean { + TODO("Not yet implemented") + } + + override fun createSource( + title: String, + url: String, + spout: String, + tags: String, + filter: String + ): Boolean { + TODO("Not yet implemented") + } + + override fun deleteSource(id: Int): Boolean { + TODO("Not yet implemented") + } + + override fun updateRemote(): Boolean { + TODO("Not yet implemented") + } + + override fun login(): Boolean { + TODO("Not yet implemented") + } + + override fun refreshLoginInformation(): Boolean { + TODO("Not yet implemented") + } +} \ No newline at end of file