Skip to content

Commit 5039759

Browse files
Titozzzmikehardy
authored andcommitted
fix(messaging): Refactor code to avoid bugs
When NotificationIOS only contains badge, it's not serialized... So I fixed it
1 parent 2c44281 commit 5039759

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/messaging/ios/RNFBMessaging/RNFBMessagingSerializer.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ + (NSDictionary *)remoteMessageUserInfoToDict:(NSDictionary *)userInfo {
176176
notificationIOS[@"subtitleLocArgs"] = apsAlertDict[@"subtitle-loc-args"];
177177
}
178178
}
179-
180-
notification[@"ios"] = notificationIOS;
181-
message[@"notification"] = notification;
182179
}
183180

184181
// message.notification.ios.sound
@@ -208,11 +205,14 @@ + (NSDictionary *)remoteMessageUserInfoToDict:(NSDictionary *)userInfo {
208205
// message.notification.ios.sound
209206
notificationIOS[@"sound"] = notificationIOSSound;
210207
}
211-
212-
notification[@"ios"] = notificationIOS;
213-
message[@"notification"] = notification;
214208
}
215209
}
210+
if ([notificationIOS count] > 0) {
211+
notification[@"ios"] = notificationIOS;
212+
}
213+
if ([notification count] > 0) {
214+
message[@"notification"] = notification;
215+
}
216216

217217
return message;
218218
}

0 commit comments

Comments
 (0)