From add385cd26977c25e671352a2f0834dabcc4c342 Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Wed, 20 Aug 2014 13:42:03 -0700 Subject: [PATCH] Updating tizen api checks to avoid failure if they don't exist Change-Id: I5e1064c41993bf29e941a0b257ee609ec4141cf1 --- css/car/components/bottomPanel/bottomPanel.js | 2 +- css/car/components/topBarIcons/topBarIcons.js | 4 ++-- js/services/speech.js | 7 +++---- packaging/modello-common.changes | 3 +++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/css/car/components/bottomPanel/bottomPanel.js b/css/car/components/bottomPanel/bottomPanel.js index 6110fc4..cf8af44 100644 --- a/css/car/components/bottomPanel/bottomPanel.js +++ b/css/car/components/bottomPanel/bottomPanel.js @@ -45,7 +45,7 @@ */ onBackButtonClick: function () { BottomPanel.thisObj.trigger("clickOnBackButton"); - if (typeof tizen !== "undefined") { + if (typeof (tizen.application.getCurrentApplication) !== "undefined") { tizen.application.getCurrentApplication().exit(); } } diff --git a/css/car/components/topBarIcons/topBarIcons.js b/css/car/components/topBarIcons/topBarIcons.js index ae4d650..a7be155 100644 --- a/css/car/components/topBarIcons/topBarIcons.js +++ b/css/car/components/topBarIcons/topBarIcons.js @@ -168,7 +168,7 @@ function launchApplication(id) { */ init: function() { TopBarIcons.initLaunchingAppsByVoiceRecognition(); - TopBarIcons.runningAppName = typeof(tizen) === 'undefined' ? "" : tizen.application.getCurrentApplication().appInfo.id; + TopBarIcons.runningAppName = typeof(tizen.application.getCurrentApplication) === 'undefined' ? "" : tizen.application.getCurrentApplication().appInfo.id; this.empty(); this.addClass("topBarIcons"); @@ -186,7 +186,7 @@ function launchApplication(id) { _getApps: function() { try { - if (typeof(tizen) !== 'undefined') { + if (typeof(tizen.application.getAppsInfo) !== 'undefined') { tizen.application.getAppsInfo(TopBarIcons.onAppInfoSuccess, function(err) { // Workaround due to https://bugs.tizen.org/jira/browse/TIVI-2018 window.setTimeout(function() { diff --git a/js/services/speech.js b/js/services/speech.js index 9d2a21c..e8aafba 100644 --- a/js/services/speech.js +++ b/js/services/speech.js @@ -52,9 +52,8 @@ var Speech = (function() { Speech.prototype._initVoiceRecognition = function() { var self = this; console.log("Speech init voice recognition called."); - if (typeof (tizen) !== 'undefined' && typeof (tizen.speech) !== 'undefined' && typeof (tizen.speech.setCBListener) !== 'undefined') { + if (typeof (tizen.speech.setCBListener) !== 'undefined') { try { - tizen.speech.setCBListener(function(result) { console.log("Speech: onresult received"); for ( var i = 0; i < result.length; i++) { @@ -190,7 +189,7 @@ var Speech = (function() { */ Speech.prototype.vocalizeString = function(string) { console.log("Speech vocalize string called."); - if (typeof (tizen) !== 'undefined' && typeof (tizen.speech) !== 'undefined' && typeof (tizen.speech.vocalizeString) !== 'undefined') { + if (typeof (tizen.speech.vocalizeString) !== 'undefined') { try { tizen.speech.vocalizeString(string); } catch (err) { @@ -208,7 +207,7 @@ var Speech = (function() { * @method readCurrentAppName */ Speech.prototype.readCurrentAppName = function() { - if (typeof (tizen) !== 'undefined') { + if (typeof (tizen.application.getCurrentApplication) !== 'undefined') { var appName = tizen.application.getCurrentApplication().appInfo.name.toString().trim().toLowerCase(); if (appName === "modello hvac") { appName = "air conditioning"; diff --git a/packaging/modello-common.changes b/packaging/modello-common.changes index f11a771..ef10285 100644 --- a/packaging/modello-common.changes +++ b/packaging/modello-common.changes @@ -1,3 +1,6 @@ +* Wed Aug 20 2014 Brian Jones accepted/tizen/ivi/20140814.201957-2-g5b6386a +- Updating tizen api checks to avoid failure if they don't exist + * Thu Aug 14 2014 Jimmy Huang accepted/tizen/ivi/20140814.201957-1-g4c3a4b4 - Clear the cached bluetooth devices due to UI bug -- 2.7.4