Skip to content

Commit

Permalink
Merge pull request zo0r#266 from tsugitta/regard_play_sound_as_true_b…
Browse files Browse the repository at this point in the history
…y_default

Use not default but passed soundName when playSound is not passed
  • Loading branch information
npomfret authored Nov 11, 2016
2 parents 62dc8c5 + 0e43673 commit a8a5fe9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,11 @@ Notifications.unregister = function() {
Notifications.localNotification = function(details: Object) {
if ( Platform.OS === 'ios' ) {
// https://developer.apple.com/reference/uikit/uilocalnotification

let soundName = 'default'; // play sound (and vibrate) as default behaviour

if(details.hasOwnProperty("playSound")) {
if(details.playSound) {
if(details.soundName) {
soundName = details.soundName;
}
} else {
soundName = '';// empty string results in no sound (and no vibration)
}
let soundName = details.soundName ? details.soundName : 'default'; // play sound (and vibrate) as default behaviour

if (details.hasOwnProperty('playSound') && !details.playSound) {
soundName = ''; // empty string results in no sound (and no vibration)
}

// for valid fields see: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html
Expand Down

0 comments on commit a8a5fe9

Please sign in to comment.