Fix list timeline no content view being added repetedly on refresh

This commit is contained in:
Shadowfacts 2024-08-21 16:17:57 -04:00
parent 4249ab30ca
commit 37b9673b12
1 changed files with 7 additions and 0 deletions

View File

@ -56,6 +56,10 @@ class ListTimelineViewController: TimelineViewController {
} }
private func createNoContentView() { private func createNoContentView() {
guard noContentView == nil else {
return
}
let title = UILabel() let title = UILabel()
title.textColor = .secondaryLabel title.textColor = .secondaryLabel
title.font = .preferredFont(forTextStyle: .title1).withTraits(.traitBold)! title.font = .preferredFont(forTextStyle: .title1).withTraits(.traitBold)!
@ -133,6 +137,9 @@ class ListTimelineViewController: TimelineViewController {
override func handleReplaceAllItems(_ timelineItems: [String]) async { override func handleReplaceAllItems(_ timelineItems: [String]) async {
if timelineItems.isEmpty { if timelineItems.isEmpty {
createNoContentView() createNoContentView()
} else {
noContentView?.removeFromSuperview()
noContentView = nil
} }
await super.handleReplaceAllItems(timelineItems) await super.handleReplaceAllItems(timelineItems)
} }