Adds a method in callstats in order to check if it's enabled.

This commit is contained in:
yanas 2015-11-17 16:39:05 -06:00
parent 72c39a0162
commit 236c4bb37c
2 changed files with 20 additions and 5 deletions

View File

@ -79,7 +79,7 @@ var Feedback = {
init: function () {
// CallStats is the way we send feedback, so we don't have to initialise
// if callstats isn't enabled.
if (!config.callStatsID || !config.callStatsSecret)
if (!callStats.isEnabled())
return;
$("div.feedbackButton").css("display", "block");
@ -93,9 +93,7 @@ var Feedback = {
* @return true if the feedback functionality is enabled, false otherwise.
*/
isEnabled: function() {
var isCallStatsEnabled = (config.callStatsID && config.callStatsSecret);
return isCallStatsEnabled;
return callStats.isEnabled();
},
/**
* Opens the feedback window.

View File

@ -67,6 +67,16 @@ var CallStats = {
pendingErrors.length = 0;
}
},
/**
* Returns true if the callstats integration is enabled, otherwise returns
* false.
*
* @returns true if the callstats integration is enabled, otherwise returns
* false.
*/
isEnabled: function() {
return callStatsIntegrationEnabled;
},
pcCallback: function (err, msg) {
if (!callStats) {
return;
@ -125,7 +135,14 @@ var CallStats = {
callStats.sendUserFeedback(
this.confID, feedbackJSON);
},
/**
* Reports an error to callstats.
*
* @param type the type of the error, which will be one of the wrtcFuncNames
* @param e the error
* @param pc the peerconnection
* @private
*/
_reportError: function (type, e, pc) {
if (callStats) {
callStats.reportError(pc, this.confID, type, e);