💫 Fix unread count animations

This commit is contained in:
Stuart Breckenridge committed 2026-01-06 15:16:00 +08:00
1 parent fc7b29abac
commit 2bef030b37
1 file changed
+6 -6
@@ -31,7 +31,7 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell {
unreadCountLabel.isHidden = true
} else {
unreadCountLabel.isHidden = false
updateUnreadCount()
updateUnreadCountVisibility()
}
unreadCountLabel.text = newValue.formatted()
}
@@ -51,7 +51,7 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell {
var disclosureExpanded = true {
didSet {
updateExpandedState(animate: true)
updateUnreadCount()
updateUnreadCountVisibility()
}
}
@@ -75,13 +75,13 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell {
}
}
func updateUnreadCount() {
if !disclosureExpanded && unreadCount > 0 && unreadCountLabel.alpha != 1 {
UIView.animate(withDuration: 0.3) {
func updateUnreadCountVisibility() {
if !disclosureExpanded && unreadCount > 0 {
UIView.animate {
self.unreadCountLabel.alpha = 1
}
} else {
UIView.animate(withDuration: 0.3) {
UIView.animate {
self.unreadCountLabel.alpha = 0
}
}