File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -99,10 +99,15 @@ export default class JPush {
9999 }
100100
101101 /**
102- * Android Only
102+ * Android Only.
103+ * 删除通知栏指定的推送。
103104 */
104105 static clearNotificationById ( id ) {
105- JPushModule . clearNotificationById ( id )
106+ if ( Platform . OS == "android" ) {
107+ JPushModule . clearNotificationById ( id )
108+ } else {
109+ console . warn ( "iOS 没有提供该方法!" )
110+ }
106111 }
107112
108113 /**
@@ -631,22 +636,14 @@ export default class JPush {
631636 * 移除所有的本地通知
632637 */
633638 static clearLocalNotifications ( ) {
634- if ( Platform . OS == "android" ) {
635639 JPushModule . clearLocalNotifications ( )
636- } else {
637-
638- }
639640 }
640641
641642 /**
642- * 移除指定的本地通知
643+ * 移除指定未触发的本地通知。
643644 */
644645 static removeLocalNotification ( id ) {
645- if ( Platform . OS == "android" ) {
646646 JPushModule . removeLocalNotification ( id )
647- } else {
648-
649- }
650647 }
651648
652649 /**
Original file line number Diff line number Diff line change @@ -870,12 +870,17 @@ - (void)didRegistRemoteNotification:(NSString *)token {
870870 }
871871}
872872
873- RCT_EXPORT_METHOD (clearNotificationById :(NSInteger )identify) {
873+ RCT_EXPORT_METHOD (removeLocalNotification :(NSInteger )identify) {
874874 JPushNotificationIdentifier *pushIdentify = [[JPushNotificationIdentifier alloc ] init ];
875875 pushIdentify.identifiers = @[[@(identify) description ]];
876876 [JPUSHService removeNotification: pushIdentify];
877877}
878878
879+ RCT_EXPORT_METHOD (clearLocalNotifications) {
880+ [JPUSHService removeNotification: nil ];
881+ }
882+
883+
879884- (void )jpushNotificationCenter : (UNUserNotificationCenter *)center willPresentNotification : (UNNotification *)notification withCompletionHandler : (void (^)(NSInteger ))completionHandler {
880885 NSDictionary * userInfo = notification.request .content .userInfo ;
881886 [JPUSHService handleRemoteNotification: userInfo];
You can’t perform that action at this time.
0 commit comments