File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ declare module 'cleverpush-react-native' {
1616 static setAutoResubscribe ( autoResubscribe : boolean ) : void ;
1717 static setBadgeCount ( count : number ) : void ;
1818 static getBadgeCount ( callback : ( error , count : number ) => void ) : void ;
19+ static clearNotificationsFromNotificationCenter ( ) : void ;
1920
2021 static addEventListener (
2122 type : EventType ,
Original file line number Diff line number Diff line change @@ -293,4 +293,11 @@ export default class CleverPush {
293293
294294 RNCleverPush . getBadgeCount ( callback ) ;
295295 }
296+
297+ // iOS only
298+ static clearNotificationsFromNotificationCenter ( ) {
299+ if ( ! checkIfInitialized ( ) ) return ;
300+
301+ RNCleverPush . clearNotificationsFromNotificationCenter ( ) ;
302+ }
296303}
Original file line number Diff line number Diff line change 11#import " RCTCleverPushEventEmitter.h"
22#import < CleverPush/CleverPush.h>
3+ #import < UserNotifications/UserNotifications.h>
34
45#import " RCTCleverPush.h"
56
@@ -237,4 +238,8 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
237238 [CleverPush setShowNotificationsInForeground: show];
238239}
239240
241+ RCT_EXPORT_METHOD (clearNotificationsFromNotificationCenter) {
242+ [[UNUserNotificationCenter currentNotificationCenter ] removeAllDeliveredNotifications ];
243+ }
244+
240245@end
You can’t perform that action at this time.
0 commit comments