Add soundName config for UILocalNotification
Summary: Current version wasn't triggering any sound when a local notification was fired. I added the possibility to provide a custom sound and fallback to the default iOS sound if not provided. Closes https://github.com/facebook/react-native/pull/4836 Reviewed By: svcscm Differential Revision: D2807381 Pulled By: bestander fb-gh-sync-id: c25e8f3c30a0714a5d9558c0c1fe344d0e93321e
This commit is contained in:
parent
811079ede2
commit
ac72611bb1
|
@ -74,6 +74,7 @@ class PushNotificationIOS {
|
|||
* details is an object containing:
|
||||
*
|
||||
* - `alertBody` : The message displayed in the notification alert.
|
||||
* - `soundName` : The sound played when the notification is fired (optional).
|
||||
*
|
||||
*/
|
||||
static presentLocalNotification(details: Object) {
|
||||
|
@ -87,6 +88,7 @@ class PushNotificationIOS {
|
|||
*
|
||||
* - `fireDate` : The date and time when the system should deliver the notification.
|
||||
* - `alertBody` : The message displayed in the notification alert.
|
||||
* - `soundName` : The sound played when the notification is fired (optional).
|
||||
*
|
||||
*/
|
||||
static scheduleLocalNotification(details: Object) {
|
||||
|
|
|
@ -35,6 +35,7 @@ NSString *const RCTRemoteNotificationsRegistered = @"RemoteNotificationsRegister
|
|||
UILocalNotification *notification = [UILocalNotification new];
|
||||
notification.fireDate = [RCTConvert NSDate:details[@"fireDate"]] ?: [NSDate date];
|
||||
notification.alertBody = [RCTConvert NSString:details[@"alertBody"]];
|
||||
notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: UILocalNotificationDefaultSoundName;
|
||||
return notification;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue