Cleanup
This commit is contained in:
parent
27bb056397
commit
8dc3d319cd
@ -355,6 +355,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
|
|||||||
val drawerData = DrawerData(repository.getDBTags().map { it.toView() },
|
val drawerData = DrawerData(repository.getDBTags().map { it.toView() },
|
||||||
repository.getDBSources().map { it.toView() })
|
repository.getDBSources().map { it.toView() })
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
|
// TODO: All this logic should be handled by the repository, simplify and remove direct DB access
|
||||||
// Only refresh if there is no data in the DB, or if the `UpdateSources` setting is enabled
|
// Only refresh if there is no data in the DB, or if the `UpdateSources` setting is enabled
|
||||||
if (drawerData.sources?.isEmpty() == true || appSettingsService.isUpdateSourcesEnabled()) {
|
if (drawerData.sources?.isEmpty() == true || appSettingsService.isUpdateSourcesEnabled()) {
|
||||||
drawerApiCalls(drawerData)
|
drawerApiCalls(drawerData)
|
||||||
|
@ -391,8 +391,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
|||||||
api.refreshLoginInformation()
|
api.refreshLoginInformation()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This should be private
|
private suspend fun updateApiVersion() {
|
||||||
suspend fun updateApiVersion() {
|
|
||||||
val apiMajorVersion = appSettingsService.getApiVersion()
|
val apiMajorVersion = appSettingsService.getApiVersion()
|
||||||
|
|
||||||
if (isNetworkAvailable()) {
|
if (isNetworkAvailable()) {
|
||||||
@ -453,7 +452,6 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
|||||||
private fun updateDBItem(item: SelfossModel.Item) =
|
private fun updateDBItem(item: SelfossModel.Item) =
|
||||||
db.itemsQueries.updateItem(item.datetime, item.title.getHtmlDecoded(), item.content, item.unread, item.starred, item.thumbnail, item.icon, item.link, item.sourcetitle, item.tags.joinToString(","), item.id.toString())
|
db.itemsQueries.updateItem(item.datetime, item.title.getHtmlDecoded(), item.content, item.unread, item.starred, item.thumbnail, item.icon, item.link, item.sourcetitle, item.tags.joinToString(","), item.id.toString())
|
||||||
|
|
||||||
// TODO: This function should check for duplicate items
|
|
||||||
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item> {
|
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item> {
|
||||||
try {
|
try {
|
||||||
val newItems = getMaxItemsForBackground(ItemType.UNREAD)
|
val newItems = getMaxItemsForBackground(ItemType.UNREAD)
|
||||||
|
@ -874,7 +874,6 @@ class RepositoryTest() {
|
|||||||
coVerify(exactly = 1) {appSettingsService.refreshLoginInformation("https://test.com/selfoss/", "login", "password")}
|
coVerify(exactly = 1) {appSettingsService.refreshLoginInformation("https://test.com/selfoss/", "login", "password")}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This function should check if duplicate items are added to the database
|
|
||||||
@Test
|
@Test
|
||||||
fun `cache items`() {
|
fun `cache items`() {
|
||||||
val itemParameter1 = FakeItemParameters()
|
val itemParameter1 = FakeItemParameters()
|
||||||
|
Loading…
Reference in New Issue
Block a user