浏览代码

Adds avatarId to Settings.

master
damencho 9 年前
父节点
当前提交
3852b34397
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16
    0
      modules/settings/Settings.js

+ 16
- 0
modules/settings/Settings.js 查看文件

3
 import UIUtil from '../UI/util/UIUtil';
3
 import UIUtil from '../UI/util/UIUtil';
4
 
4
 
5
 let email = '';
5
 let email = '';
6
+let avatarId = '';
6
 let displayName = '';
7
 let displayName = '';
7
 let language = null;
8
 let language = null;
8
 let cameraDeviceId = '';
9
 let cameraDeviceId = '';
35
     }
36
     }
36
 
37
 
37
     email = UIUtil.unescapeHtml(window.localStorage.email || '');
38
     email = UIUtil.unescapeHtml(window.localStorage.email || '');
39
+    avatarId = UIUtil.unescapeHtml(window.localStorage.avatarId || '');
40
+    if (!avatarId) {
41
+        // if there is no avatar id, we generate a unique one and use it forever
42
+        avatarId = generateUniqueId();
43
+        window.localStorage.avatarId = avatarId;
44
+    }
45
+
38
     localFlipX = JSON.parse(window.localStorage.localFlipX || true);
46
     localFlipX = JSON.parse(window.localStorage.localFlipX || true);
39
     displayName = UIUtil.unescapeHtml(window.localStorage.displayname || '');
47
     displayName = UIUtil.unescapeHtml(window.localStorage.displayname || '');
40
     language = window.localStorage.language;
48
     language = window.localStorage.language;
105
         return email;
113
         return email;
106
     },
114
     },
107
 
115
 
116
+    /**
117
+     * Returns avatar id of the local user.
118
+     * @returns {string} avatar id
119
+     */
120
+    getAvatarId: function () {
121
+        return avatarId;
122
+    },
123
+
108
     /**
124
     /**
109
      * Sets new avatarUrl for local user and saves it to the local storage.
125
      * Sets new avatarUrl for local user and saves it to the local storage.
110
      * @param {string} newAvatarUrl new avatarUrl for the local user
126
      * @param {string} newAvatarUrl new avatarUrl for the local user

正在加载...
取消
保存