From: bg.chun Date: Thu, 12 May 2016 07:41:13 +0000 (+0900) Subject: [Dialog] change the way of get TV Notification sound path X-Git-Tag: submit/tizen/20160519.080635~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ac65dc83058bf13d3863b0290061ec37cdd56a2;p=platform%2Fcore%2Fapi%2Fcordova-plugins.git [Dialog] change the way of get TV Notification sound path [Verification] Cordova Dialog TCT 100% pass Change-Id: Ida344bf5d558fd800838100623a49c0902a05af3 Signed-off-by: bg.chun --- diff --git a/src/lib/plugins/cordova-plugin-dialogs/tizen/Notification.js b/src/lib/plugins/cordova-plugin-dialogs/tizen/Notification.js index 044e5df..0e8b519 100755 --- a/src/lib/plugins/cordova-plugin-dialogs/tizen/Notification.js +++ b/src/lib/plugins/cordova-plugin-dialogs/tizen/Notification.js @@ -25,8 +25,11 @@ var _document = document || {}; var playback = (function() { var soundElement; var counter = 1; + var soundPathArray = ['/usr/share/feedback/sound/operation/operation.wav', '/usr/share/feedback/sound/operation/back.wav']; + var soundPathCount = 0; function win(v) { + console.log('Success to get the notification sound: ' + v); soundElement = new Audio(v); soundElement.addEventListener('ended', function() { if (--counter > 0) { @@ -39,10 +42,25 @@ var playback = (function() { console.error('Failed to get the notification sound: ' + e); } + function recursiveFailCallback(e) { + fail(e); + console.warn("Retry with another path"); + + if(soundPathCount >= soundPathArray.length){ + console.error('Failed to get the notification sound: There is no available sound file path'); + return; + } + + tizen.filesystem.resolve(soundPathArray[soundPathCount++], function(file) { + win(file.toURI()); + }, recursiveFailCallback, 'r'); + + } + if ('tv' === tizen.systeminfo.getCapability('http://tizen.org/feature/profile').toLowerCase()) { - tizen.filesystem.resolve('/usr/share/feedback/sound/operation/operation.wav', function(file) { + tizen.filesystem.resolve(soundPathArray[soundPathCount++], function(file) { win(file.toURI()); - }, fail, 'r'); + }, recursiveFailCallback, 'r'); } else { tizen.systemsetting.getProperty('NOTIFICATION_EMAIL', win, fail); }