Enable custom sound for local notification in PushNotificationIOS
Summary: Add soundName property in NativePushNotificationManagerIOS JS module and deliver to native local notification API. Changelog: [iOS][Fixed] - Enable custom sound for local push notifications. Reviewed By: RSNara Differential Revision: D33898630 fbshipit-source-id: c6362032601f0f6d20479465ce1f0a84c450ea72
This commit is contained in:
Родитель
3633a05299
Коммит
eb19499484
|
@ -29,6 +29,7 @@ type Notification = {|
|
|||
+repeatInterval?: ?string,
|
||||
+applicationIconBadgeNumber?: ?number,
|
||||
+isSilent?: ?boolean,
|
||||
+soundName?: ?string,
|
||||
|};
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
|
|
|
@ -367,6 +367,9 @@ RCT_EXPORT_METHOD(presentLocalNotification:(JS::NativePushNotificationManagerIOS
|
|||
}
|
||||
if (notification.isSilent()) {
|
||||
notificationDict[@"isSilent"] = @(*notification.isSilent());
|
||||
if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
|
||||
notificationDict[@"soundName"] = notification.soundName();
|
||||
}
|
||||
}
|
||||
[RCTSharedApplication() presentLocalNotificationNow:[RCTConvert UILocalNotification:notificationDict]];
|
||||
}
|
||||
|
@ -388,6 +391,9 @@ RCT_EXPORT_METHOD(scheduleLocalNotification:(JS::NativePushNotificationManagerIO
|
|||
}
|
||||
if (notification.isSilent()) {
|
||||
notificationDict[@"isSilent"] = @(*notification.isSilent());
|
||||
if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
|
||||
notificationDict[@"soundName"] = notification.soundName();
|
||||
}
|
||||
}
|
||||
[RCTSharedApplication() scheduleLocalNotification:[RCTConvert UILocalNotification:notificationDict]];
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче