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() },
|
||||
repository.getDBSources().map { it.toView() })
|
||||
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
|
||||
if (drawerData.sources?.isEmpty() == true || appSettingsService.isUpdateSourcesEnabled()) {
|
||||
drawerApiCalls(drawerData)
|
||||
|
@ -391,8 +391,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
api.refreshLoginInformation()
|
||||
}
|
||||
|
||||
// TODO: This should be private
|
||||
suspend fun updateApiVersion() {
|
||||
private suspend fun updateApiVersion() {
|
||||
val apiMajorVersion = appSettingsService.getApiVersion()
|
||||
|
||||
if (isNetworkAvailable()) {
|
||||
@ -453,7 +452,6 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
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())
|
||||
|
||||
// TODO: This function should check for duplicate items
|
||||
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item> {
|
||||
try {
|
||||
val newItems = getMaxItemsForBackground(ItemType.UNREAD)
|
||||
|
@ -874,7 +874,6 @@ class RepositoryTest() {
|
||||
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
|
||||
fun `cache items`() {
|
||||
val itemParameter1 = FakeItemParameters()
|
||||
|
Loading…
Reference in New Issue
Block a user