aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-10 16:52:28 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-10 16:52:28 -0700
commit8ba7a5fa6ef7274339c3c709a2babb790e11e32b (patch)
treeb396647b37fe85cd23aba92346621c3ec3869945 /Hotline/Models
parent4a4fab030b69ec799fae42f9a444392e7be7a43a (diff)
Further work on threaded news UI: better icons, tweaked indentation, post count, keyboard navigation.
Diffstat (limited to 'Hotline/Models')
-rw-r--r--Hotline/Models/Hotline.swift1
-rw-r--r--Hotline/Models/NewsInfo.swift4
2 files changed, 5 insertions, 0 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index 48266a9..5dc61ab 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -387,6 +387,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate {
if let parentID = article.parentID,
parentID != 0,
let parentArticle = articleMap[parentID] {
+ article.expanded = true
parentArticle.children.append(article)
}
else {
diff --git a/Hotline/Models/NewsInfo.swift b/Hotline/Models/NewsInfo.swift
index b635138..eecd550 100644
--- a/Hotline/Models/NewsInfo.swift
+++ b/Hotline/Models/NewsInfo.swift
@@ -26,6 +26,10 @@ enum NewsInfoType {
var articleDate: Date?
var read: Bool = false
+ var expandable: Bool {
+ self.type == .bundle || self.type == .category || self.children.count > 0
+ }
+
init(hotlineNewsCategory: HotlineNewsCategory) {
self.categoryID = hotlineNewsCategory.id
self.articleID = nil