Allow offline filtering #75

Merged
AmineB merged 6 commits from davidoskky/ReaderForSelfoss-multiplatform:offline_filters into master 2022-10-14 07:18:43 +00:00
Showing only changes of commit 1d1c121aab - Show all commits

View File

@ -71,6 +71,10 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
displayedItems == ItemType.ALL ||

This should be something like this.

                    val dbItems = getDBItems().filter {
                        displayedItems == ItemType.ALL ||
                                (it.unread && displayedItems == ItemType.UNREAD) ||
                                (it.starred && displayedItems == ItemType.STARRED)
                    }
                    if (tagFilter != null) {
                        dbItems = dbItems.filter {
                            tagFilter == null || it.tags.contains(tagFilter!!.tag)
                        }
                    }
                    if (sourceFilter!= null) {
                        dbItems = dbItems.filter {
                            sourceFilter == null || it.sourcetitle == sourceFilter!!.title
                        }
                    }
                    return dbItems.map { it.toView() }
This should be something like this. ``` val dbItems = getDBItems().filter { displayedItems == ItemType.ALL || (it.unread && displayedItems == ItemType.UNREAD) || (it.starred && displayedItems == ItemType.STARRED) } if (tagFilter != null) { dbItems = dbItems.filter { tagFilter == null || it.tags.contains(tagFilter!!.tag) } } if (sourceFilter!= null) { dbItems = dbItems.filter { sourceFilter == null || it.sourcetitle == sourceFilter!!.title } } return dbItems.map { it.toView() } ```
(it.unread && displayedItems == ItemType.UNREAD) ||
(it.starred && displayedItems == ItemType.STARRED)
}.filter {
tagFilter == null || it.tags.contains(tagFilter!!.tag)

This should be dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) } (with dbItems being a var). Else, it does not filter anything.

This should be `dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) }` (with `dbItems` being a var). Else, it does not filter anything.
}.filter {
sourceFilter == null || it.sourcetitle == sourceFilter!!.title
}.map { it.toView() }

This should be dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) } (with dbItems being a var). Else, it does not filter anything.

This should be `dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) }` (with `dbItems` being a var). Else, it does not filter anything.

Right... I didn't write the tests correctly and assumed that worked...

Right... I didn't write the tests correctly and assumed that worked...
)
}