DI Repository setup

This commit is contained in:
davide 2022-07-20 11:04:08 +02:00
parent bbec7745fe
commit 3be942a807
2 changed files with 114 additions and 0 deletions

View File

@ -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<SelfossModel.Item>
var selectedItems: List<SelfossModel.Item>
// API
fun getItems(): List<SelfossModel.Item>
fun getMoreItems(): List<SelfossModel.Item>
fun stats(): SelfossModel.Stats
fun getTags(): List<SelfossModel.Tag>
fun getSpouts(): List<SelfossModel.Spout>
fun getSources(): List<SelfossModel.Source>
fun markAsRead(id: String): Boolean
fun unmarkAsRead(id: String): Boolean
fun starr(id: String): Boolean
fun unstarr(id: String): Boolean
fun markAllAsRead(ids: List<String>): 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
}

View File

@ -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<SelfossModel.Item>
override lateinit var selectedItems: List<SelfossModel.Item>
override fun getItems(): List<SelfossModel.Item> {
return items
}
override fun getMoreItems(): List<SelfossModel.Item> {
TODO("Not yet implemented")
}
override fun stats(): SelfossModel.Stats {
TODO("Not yet implemented")
}
override fun getTags(): List<SelfossModel.Tag> {
TODO("Not yet implemented")
}
override fun getSpouts(): List<SelfossModel.Spout> {
TODO("Not yet implemented")
}
override fun getSources(): List<SelfossModel.Source> {
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<String>): 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")
}
}