forked from Louvorg/ReaderForSelfoss-multiplatform
Accept article IDs as Int in the Repository
It's cleaner to accept ints and not strings, because the ID is internally stored as an Int
This commit is contained in:
@ -114,7 +114,7 @@ class ReaderActivity : AppCompatActivity(), DIAware {
|
||||
private fun readItem(item: SelfossModel.Item) {
|
||||
if (markOnScroll) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
repository.markAsRead(item.id.toString())
|
||||
repository.markAsRead(item.id)
|
||||
// TODO: Handle failure
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapte
|
||||
private fun readItemAtIndex(position: Int, showSnackbar: Boolean = true) {
|
||||
val i = items[position]
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
repository.markAsRead(i.id.toString())
|
||||
repository.markAsRead(i.id)
|
||||
// TODO: update db
|
||||
|
||||
}
|
||||
@ -102,7 +102,7 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapte
|
||||
|
||||
private fun unreadItemAtIndex(position: Int, showSnackbar: Boolean = true) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
repository.unmarkAsRead(items[position].id.toString())
|
||||
repository.unmarkAsRead(items[position].id)
|
||||
// Todo: SharedItems.unreadItem(app, api, db, items[position])
|
||||
// TODO: update db
|
||||
|
||||
|
@ -170,7 +170,7 @@ class ArticleFragment : Fragment(), DIAware {
|
||||
R.id.unread_action -> if (context != null) {
|
||||
if (this@ArticleFragment.item.unread) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
repository.markAsRead(this@ArticleFragment.item.id.toString())
|
||||
repository.markAsRead(this@ArticleFragment.item.id)
|
||||
}
|
||||
this@ArticleFragment.item.unread = false
|
||||
Toast.makeText(
|
||||
@ -180,7 +180,7 @@ class ArticleFragment : Fragment(), DIAware {
|
||||
).show()
|
||||
} else {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
repository.unmarkAsRead(this@ArticleFragment.item.id.toString())
|
||||
repository.unmarkAsRead(this@ArticleFragment.item.id)
|
||||
}
|
||||
this@ArticleFragment.item.unread = true
|
||||
Toast.makeText(
|
||||
|
Reference in New Issue
Block a user