add display name to stats debug info

This commit is contained in:
Emil Ivov 2015-10-04 16:13:28 -05:00
parent 9e4b4bc540
commit 097c008a63
2 changed files with 23 additions and 0 deletions

View File

@ -36,16 +36,33 @@ if (supportsLocalStorage()) {
} }
var Settings = { var Settings = {
/**
* Sets the local user display name and saves it to local storage
*
* @param newDisplayName the new display name for the local user
* @returns {string} the display name we just set
*/
setDisplayName: function (newDisplayName) { setDisplayName: function (newDisplayName) {
displayName = newDisplayName; displayName = newDisplayName;
window.localStorage.displayname = displayName; window.localStorage.displayname = displayName;
return displayName; return displayName;
}, },
/**
* Returns the currently used by the user
* @returns {string} currently valid user display name.
*/
getDisplayName: function () {
return displayName;
},
setEmail: function (newEmail) { setEmail: function (newEmail) {
email = newEmail; email = newEmail;
window.localStorage.email = newEmail; window.localStorage.email = newEmail;
return email; return email;
}, },
getSettings: function () { getSettings: function () {
return { return {
email: email, email: email,

View File

@ -1,4 +1,6 @@
/* global config, $, APP, Strophe, callstats */ /* global config, $, APP, Strophe, callstats */
var Settings = require('../settings/Settings');
var jsSHA = require('jssha'); var jsSHA = require('jssha');
var io = require('socket.io-client'); var io = require('socket.io-client');
var callStats = null; var callStats = null;
@ -20,6 +22,10 @@ var CallStats = {
this.userID = APP.xmpp.myResource(); this.userID = APP.xmpp.myResource();
//use whatever the user said to facilitate debugging
if(Settings.getDisplayName())
this.userID = Settings.getDisplayName();
var location = window.location; var location = window.location;
this.confID = location.hostname + location.pathname; this.confID = location.hostname + location.pathname;