Skip to content

Commit

Permalink
fix(messaging, badge): use new iOS JSON location for FCM badge inform…
Browse files Browse the repository at this point in the history
…ation (#4560)

Co-authored-by: Yunarta Kartawahyudi <[email protected]>
  • Loading branch information
yunarta and Yunarta Kartawahyudi authored Nov 23, 2020
1 parent f9935e7 commit bda2d67
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/messaging/ios/RNFBMessaging/RNFBMessagingSerializer.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ + (NSDictionary *)remoteMessageUserInfoToDict:(NSDictionary *)userInfo {
message[@"mutableContent"] = @([RCTConvert BOOL:apsDict[@"mutable-content"]]);
}

// iOS only
// message.notification.ios.badge
if (apsDict[@"badge"] != nil) {
notificationIOS[@"badge"] = apsDict[@"badge"];
}

// message.notification.*
if (apsDict[@"alert"] != nil) {
// can be a string or dictionary
Expand Down Expand Up @@ -169,15 +175,8 @@ + (NSDictionary *)remoteMessageUserInfoToDict:(NSDictionary *)userInfo {
if (apsAlertDict[@"subtitle-loc-args"] != nil) {
notificationIOS[@"subtitleLocArgs"] = apsAlertDict[@"subtitle-loc-args"];
}

// iOS only
// message.notification.ios.badge
if (apsAlertDict[@"badge"] != nil) {
notificationIOS[@"badge"] = apsAlertDict[@"badge"];
}
}


notification[@"ios"] = notificationIOS;
message[@"notification"] = notification;
}
Expand Down

0 comments on commit bda2d67

Please sign in to comment.