File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
iOS_SDK/OneSignalSDK/Source Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 2727
2828#import < Foundation/Foundation.h>
2929
30+ #import < UIKit/UIKit.h>
31+
3032#import " OSNotification+Internal.h"
3133
3234#import " OneSignal.h"
3335
3436#import " OneSignalCommonDefines.h"
3537
38+ #import " OneSignalUserDefaults.h"
39+
3640@implementation OSNotification
3741
3842 OSNotificationDisplayResponse _completion;
@@ -298,6 +302,14 @@ - (void)setCompletionBlock:(OSNotificationDisplayResponse)completion {
298302
299303 - (OSNotificationDisplayResponse)getCompletionBlock {
300304 OSNotificationDisplayResponse block = ^(OSNotification *notification){
305+ /*
306+ If notification is null here then display was cancelled and we need to
307+ reset the badge count to the value prior to receipt of this notif
308+ */
309+ if (!notification) {
310+ NSInteger previousBadgeCount = [UIApplication sharedApplication ].applicationIconBadgeNumber ;
311+ [OneSignalUserDefaults.initShared saveIntegerForKey: ONESIGNAL_BADGE_KEY withValue: previousBadgeCount];
312+ }
301313 [self complete: notification];
302314 };
303315 return block;
You can’t perform that action at this time.
0 commit comments