network #28

Merged
AmineB merged 28 commits from davidoskky/ReaderForSelfoss-multiplatform:network into master 2022-08-22 19:01:16 +00:00
Showing only changes of commit 492e7e4aed - Show all commits

View File

@ -65,7 +65,6 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
items = ArrayList(fetchedItems)
}
} else {
AmineB marked this conversation as resolved Outdated

The error message should be displayed when the network status change, not after every api call.

Same for every comment like this one.

The error message should be displayed when the network status change, not after every api call. Same for every comment like this one.
// TODO: Provide an error message if the connection is not available.
// TODO: Get items from the database
}
return items
@ -88,7 +87,7 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
appendItems(fetchedItems)
AmineB marked this conversation as resolved Outdated

This should be moved after the else block

This should be moved after the `else` block
}
} else {
// TODO: Provide an error message
// TODO: Get items from the database
}
return items
}
@ -105,6 +104,7 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
null
)
} else {
// TODO: Provide an error message
AmineB marked this conversation as resolved Outdated

This should be a todo

This should be a todo
null
}
}
@ -186,7 +186,6 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
}
suspend fun unmarkAsRead(item: SelfossModel.Item): Boolean {
// TODO: Check internet connection
val success = unmarkAsReadById(item.id)
AmineB marked this conversation as resolved Outdated

This should be removed.

This should be removed.
if (success) {
@ -196,7 +195,6 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
}
suspend fun unmarkAsReadById(id: Int): Boolean {
// TODO: Check internet connection
var success = false
if (isConnectionAvailable.value && !offlineOverride) {
success = api.unmarkAsRead(id.toString())?.isSuccess == true
AmineB marked this conversation as resolved Outdated

Please refactor this

Please refactor this