Skip to content

Commit 7fe3148

Browse files
committed
clearBadgeCount method does not need to return bool
* The `clearBadgeCount` was returning a bool flag to indicate if badge was set within the method. However, nothing is consuming this flag, and with the Apple API to get application icon badge number deprecated (https://developer.apple.com/documentation/uikit/uiapplication/applicationiconbadgenumber?language=objc), the SDK's ability to get accurate badge count at any particular moment is reduced.
1 parent 50ece19 commit 7fe3148

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ NS_SWIFT_NAME(onClick(event:));
114114

115115
+ (void)handleWillShowInForegroundForNotification:(OSNotification *_Nonnull)notification completion:(OSNotificationDisplayResponse _Nonnull)completion;
116116
+ (void)handleNotificationActionWithUrl:(NSString* _Nullable)url actionID:(NSString* _Nonnull)actionID;
117-
+ (BOOL)clearBadgeCount:(BOOL)fromNotifOpened fromClearAll:(BOOL)fromClearAll;
117+
+ (void)clearBadgeCount:(BOOL)fromNotifOpened fromClearAll:(BOOL)fromClearAll;
118118

119119
+ (BOOL)receiveRemoteNotification:(UIApplication* _Nonnull)application UserInfo:(NSDictionary* _Nonnull)userInfo completionHandler:(void (^_Nonnull)(UIBackgroundFetchResult))completionHandler;
120120
+ (void)notificationReceived:(NSDictionary* _Nonnull)messageDict wasOpened:(BOOL)opened;

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ + (void)displayWebView:(NSURL*)url {
784784
openUrlBlock(true);
785785
}
786786

787-
+ (BOOL)clearBadgeCount:(BOOL)fromNotifOpened fromClearAll:(BOOL)fromClearAll {
787+
+ (void)clearBadgeCount:(BOOL)fromNotifOpened fromClearAll:(BOOL)fromClearAll {
788788

789789
NSNumber *disableBadgeNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:ONESIGNAL_DISABLE_BADGE_CLEARING];
790790

@@ -796,7 +796,7 @@ + (BOOL)clearBadgeCount:(BOOL)fromNotifOpened fromClearAll:(BOOL)fromClearAll {
796796
if (_disableBadgeClearing && !fromClearAll) {
797797
// The customer could have manually changed the badge value. We must ensure our cached value will match the current state.
798798
[OneSignalUserDefaults.initShared saveIntegerForKey:ONESIGNAL_BADGE_KEY withValue:[UIApplication sharedApplication].applicationIconBadgeNumber];
799-
return false;
799+
return;
800800
}
801801

802802
bool wasBadgeSet = [UIApplication sharedApplication].applicationIconBadgeNumber > 0;
@@ -806,8 +806,6 @@ + (BOOL)clearBadgeCount:(BOOL)fromNotifOpened fromClearAll:(BOOL)fromClearAll {
806806
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
807807
}];
808808
}
809-
810-
return wasBadgeSet;
811809
}
812810

813811
+ (BOOL)handleIAMPreview:(OSNotification *)notification {

0 commit comments

Comments
 (0)