CB-6411 [BlackBerry10] Updates to beep - Update to embedded wav file to prevent long fade out - Fix issues when quantity is not a number - Fix issues when beep called while previous beep still playing
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/bd7354ec Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/bd7354ec Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/bd7354ec Branch: refs/heads/dev Commit: bd7354ec0baebcb901cb0c8eb3a9cb49d34fc1ee Parents: 52febea Author: Bryan Higgins <[email protected]> Authored: Mon Apr 7 13:20:02 2014 -0400 Committer: Archana Naik <[email protected]> Committed: Tue Apr 15 17:48:43 2014 -0700 ---------------------------------------------------------------------- plugin.xml | 1 + www/blackberry10/beep.js | 29 +++++++++++++--------------- www/blackberry10/notification-beep.wav | Bin 0 -> 16630 bytes 3 files changed, 14 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/bd7354ec/plugin.xml ---------------------------------------------------------------------- diff --git a/plugin.xml b/plugin.xml index c115ba8..e24afea 100644 --- a/plugin.xml +++ b/plugin.xml @@ -105,6 +105,7 @@ <js-module src="www/blackberry10/beep.js" name="beep"> <clobbers target="window.navigator.notification.beep" /> </js-module> + <source-file src="www/blackberry10/notification-beep.wav" /> </platform> <!-- wp7 --> http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/bd7354ec/www/blackberry10/beep.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/beep.js b/www/blackberry10/beep.js index 6d4a77a..1b1dedc 100644 --- a/www/blackberry10/beep.js +++ b/www/blackberry10/beep.js @@ -18,25 +18,22 @@ * under the License. * */ -var beep, - count = 0, - beepObj = new Audio('file:///usr/share/sounds/notification_text_message_im_received.wav'); -beep = function (quantity) { - var callback = function () { - if (--count > 0) { - beepObj.play(); - } else { - beepObj.removeEventListener("ended", callback); - delete beepObj; - } - }; +module.exports = function (quantity) { + var count = 0, + beepObj = new Audio('local:///chrome/plugin/org.apache.cordova.dialogs/notification-beep.wav'), + callback = function () { + if (--count > 0) { + beepObj.play(); + } else { + beepObj.removeEventListener("ended", callback); + delete beepObj; + } + }; - count += quantity; - if (count === quantity) { + count += quantity || 1; + if (count > 0) { beepObj.addEventListener("ended", callback); beepObj.play(); } }; - -module.exports = beep; http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/bd7354ec/www/blackberry10/notification-beep.wav ---------------------------------------------------------------------- diff --git a/www/blackberry10/notification-beep.wav b/www/blackberry10/notification-beep.wav new file mode 100644 index 0000000..d0ad085 Binary files /dev/null and b/www/blackberry10/notification-beep.wav differ
