Skip to content

Commit

Permalink
fix(ios): revert accidental change to category "callback" (#328)
Browse files Browse the repository at this point in the history
* fix(ios): revert an accidental change to iOS's action property key 'callback'
* fix(ios): actionCallback not set correctly for category
  • Loading branch information
erisu authored Dec 9, 2024
1 parent 41ef28d commit 0a7d5bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ - (void)didReceiveNotificationResponse:(NSNotification *)notification {
NSDictionary *originalUserInfo = response.notification.request.content.userInfo;
NSMutableDictionary *modifiedUserInfo = [originalUserInfo mutableCopy];
[modifiedUserInfo setObject:applicationStateNumber forKey:@"applicationState"];
[modifiedUserInfo setObject:response.actionIdentifier forKey:@"actionCallback"];

switch (applicationState) {
case UIApplicationStateActive:
Expand Down Expand Up @@ -491,7 +492,8 @@ - (void)notificationReceived {
// Remove "actionCallback" when application state is not foreground. Only applied to foreground.
NSNumber *applicationStateNumber = mutableNotificationMessage[@"applicationState"];
UIApplicationState applicationState = (UIApplicationState)[applicationStateNumber intValue];
if (applicationState != UIApplicationStateActive) {
if (applicationState != UIApplicationStateActive
&& [[mutableNotificationMessage objectForKey:@"actionCallback"] isEqualToString:UNNotificationDefaultActionIdentifier]) {
[mutableNotificationMessage removeObjectForKey:@"actionCallback"];
}
// @todo do not sent applicationState data to front for now. Figure out if we can add
Expand Down
2 changes: 1 addition & 1 deletion src/ios/PushPluginSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ - (UNNotificationAction *)createActionFromDictionary:(NSDictionary *)dictionary
return nil;
}

NSString *identifier = [dictionary objectForKey:@"identifier"];
NSString *identifier = [dictionary objectForKey:@"callback"];
NSString *title = [dictionary objectForKey:@"title"];

if (!title || !identifier) {
Expand Down

0 comments on commit 0a7d5bc

Please sign in to comment.