Skip to content

Commit 5c40c61

Browse files
committed
Fixing cached badge value if disable clearing is true
1 parent c2d4acf commit 5c40c61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,11 @@ + (BOOL)clearBadgeCount:(BOOL)fromNotifOpened {
764764
else
765765
_disableBadgeClearing = NO;
766766

767-
if (_disableBadgeClearing)
767+
if (_disableBadgeClearing) {
768+
// The customer could have manually changed the badge value. We must ensure our cached value will match the current state.
769+
[OneSignalUserDefaults.initShared saveIntegerForKey:ONESIGNAL_BADGE_KEY withValue:[UIApplication sharedApplication].applicationIconBadgeNumber];
768770
return false;
771+
}
769772

770773
bool wasBadgeSet = [UIApplication sharedApplication].applicationIconBadgeNumber > 0;
771774

0 commit comments

Comments
 (0)