network #28
@ -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
|
||||
// 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
AmineB
commented
This should be moved after the 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
AmineB
commented
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
AmineB
commented
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
AmineB
commented
Please refactor this Please refactor this
|
||||
|
Loading…
Reference in New Issue
Block a user
The error message should be displayed when the network status change, not after every api call.
Same for every comment like this one.