diff --git a/modules/settings/Settings.js b/modules/settings/Settings.js index ebd7ab52a..1f629bb48 100644 --- a/modules/settings/Settings.js +++ b/modules/settings/Settings.js @@ -3,6 +3,7 @@ import UIUtil from '../UI/util/UIUtil'; let email = ''; +let avatarId = ''; let displayName = ''; let language = null; let cameraDeviceId = ''; @@ -35,6 +36,13 @@ if (supportsLocalStorage()) { } email = UIUtil.unescapeHtml(window.localStorage.email || ''); + avatarId = UIUtil.unescapeHtml(window.localStorage.avatarId || ''); + if (!avatarId) { + // if there is no avatar id, we generate a unique one and use it forever + avatarId = generateUniqueId(); + window.localStorage.avatarId = avatarId; + } + localFlipX = JSON.parse(window.localStorage.localFlipX || true); displayName = UIUtil.unescapeHtml(window.localStorage.displayname || ''); language = window.localStorage.language; @@ -105,6 +113,14 @@ export default { return email; }, + /** + * Returns avatar id of the local user. + * @returns {string} avatar id + */ + getAvatarId: function () { + return avatarId; + }, + /** * Sets new avatarUrl for local user and saves it to the local storage. * @param {string} newAvatarUrl new avatarUrl for the local user