var itemsLoaded = false
var itemsLoading = false
+ // Is this FeedCollection actually a FeedGroup?
+ // In that case, id is the FeedGroup id
+ var isGroup = false
+
fun updateReadStatus(isRead: Boolean) {
items.forEach { it.isRead = isRead }
}
items.update()
}
+ fun loadFeedGroup(group: FeedGroup) {
+ var load = false
+ group.feeds.forEach { feed ->
+ if(!feed.itemsLoaded) {
+ load = true
+ feed.itemsLoading = true
+ }
+ }
+
+ val collection = FeedCollection(group.id, "")
+ collection.isGroup = true
+
+ showFeed = collection
+ if(load) {
+ GlobalScope.launch(Dispatchers.IO) {
+ group.feeds.forEach { feed ->
+ feed.items = Database.getItems(feed, 10000)
+ feed.itemsLoaded = true
+ }
+ GlobalScope.launch(ToolkitDispatcher) {
+ group.feeds.forEach { feed ->
+ feed.itemsLoading = false
+ }
+ if(showFeed == collection) {
+ loadFeedGroup(group)
+ }
+ }
+ }
+ return
+ }
+
+ group.feeds.forEach { feed ->
+ feed.items.forEach { item ->
+ collection.items.add(item)
+ }
+ }
+ collection.items.sortByDescending { it.pubDate }
+ collection.itemsLoaded = true
+
+ loadFeed(collection)
+ }
+
fun reloadCurrentFeed() {
currentFeed?.let { loadFeed(it) }
}
var feedName: String? = null
var feedUrl: String? = null
+ var collection: FeedCollection? = null
+
fun getContent(): Content {
contentHtml?.let {
return Content(it, "text/html")