fix: lower bound on status bar count

This commit is contained in:
relikd
2025-10-25 12:36:12 +02:00
parent 0a23819428
commit 3235bffdca

View File

@@ -70,7 +70,7 @@
/// Assign total unread count value directly.
- (void)setUnreadCountAbsolute:(NSUInteger)count {
_unreadCountTotal = (NSInteger)count;
_unreadCountTotal = count > 0 ? (NSInteger)count : 0;
[self updateBarIcon];
[NotifyEndpoint setGlobalCount:count];
}
@@ -78,6 +78,9 @@
/// Assign new value by adding @c count to total unread count (may be negative).
- (void)setUnreadCountRelative:(NSInteger)count {
_unreadCountTotal += count;
if (_unreadCountTotal < 0) {
_unreadCountTotal = 0;
}
[self updateBarIcon];
[NotifyEndpoint setGlobalCount:(NSUInteger)_unreadCountTotal];
}