forked from shadowfacts/Tusker
Fix list timeline no content view being added repetedly on refresh
This commit is contained in:
parent
4249ab30ca
commit
37b9673b12
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue