Skip to content

Commit

Permalink
Fix cancelLocalNotification on iOS (#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd authored May 23, 2020
1 parent 495d738 commit fae3af0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/ios/RNBridgeModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (void)setBridge:(RCTBridge *)bridge {
[_commandsHandler postLocalNotification:notification withId:notificationId];
}

RCT_EXPORT_METHOD(cancelLocalNotification:(NSString *)notificationId) {
RCT_EXPORT_METHOD(cancelLocalNotification:(nonnull NSNumber *)notificationId) {
[_commandsHandler cancelLocalNotification:notificationId];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ios/RNCommandsHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

- (void)postLocalNotification:(NSDictionary *)notification withId:(NSNumber *)notificationId;

- (void)cancelLocalNotification:(NSString *)notificationId;
- (void)cancelLocalNotification:(NSNumber *)notificationId;

- (void)cancelAllLocalNotifications;

Expand Down
2 changes: 1 addition & 1 deletion lib/ios/RNCommandsHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void)postLocalNotification:(NSDictionary *)notification withId:(NSNumber *)no
[_notificationCenter postLocalNotification:notification withId:notificationId];
}

- (void)cancelLocalNotification:(NSString *)notificationId {
- (void)cancelLocalNotification:(NSNumber *)notificationId {
[_notificationCenter cancelLocalNotification:notificationId];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ios/RNNotificationCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError

- (void)postLocalNotification:(NSDictionary *)notification withId:(NSNumber *)notificationId;

- (void)cancelLocalNotification:(NSString *)notificationId;
- (void)cancelLocalNotification:(NSNumber *)notificationId;

- (void)removeAllDeliveredNotifications;

Expand Down
4 changes: 2 additions & 2 deletions lib/ios/RNNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ - (void)postLocalNotification:(NSDictionary *)notification withId:(NSNumber *)no
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:localNotification withCompletionHandler:nil];
}

- (void)cancelLocalNotification:(NSString *)notificationId {
- (void)cancelLocalNotification:(NSNumber *)notificationId {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
[center removePendingNotificationRequestsWithIdentifiers:@[notificationId]];
[center removePendingNotificationRequestsWithIdentifiers:@[[notificationId stringValue]]];
}

- (void)removeAllDeliveredNotifications {
Expand Down

0 comments on commit fae3af0

Please sign in to comment.