Ver código fonte

add display name to stats debug info

master
Emil Ivov 10 anos atrás
pai
commit
097c008a63
2 arquivos alterados com 23 adições e 0 exclusões
  1. 17
    0
      modules/settings/Settings.js
  2. 6
    0
      modules/statistics/CallStats.js

+ 17
- 0
modules/settings/Settings.js Ver arquivo

@@ -36,16 +36,33 @@ if (supportsLocalStorage()) {
36 36
 }
37 37
 
38 38
 var Settings = {
39
+
40
+    /**
41
+     * Sets the local user display name and saves it to local storage
42
+     *
43
+     * @param newDisplayName the new display name for the local user
44
+     * @returns {string} the display name we just set
45
+     */
39 46
     setDisplayName: function (newDisplayName) {
40 47
         displayName = newDisplayName;
41 48
         window.localStorage.displayname = displayName;
42 49
         return displayName;
43 50
     },
51
+
52
+    /**
53
+     * Returns the currently used by the user
54
+     * @returns {string} currently valid user display name.
55
+     */
56
+    getDisplayName: function () {
57
+        return displayName;
58
+    },
59
+
44 60
     setEmail: function (newEmail) {
45 61
         email = newEmail;
46 62
         window.localStorage.email = newEmail;
47 63
         return email;
48 64
     },
65
+
49 66
     getSettings: function () {
50 67
         return {
51 68
             email: email,

+ 6
- 0
modules/statistics/CallStats.js Ver arquivo

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

Carregando…
Cancelar
Salvar