浏览代码

feat: use participant id for avatar color

j8
Bettenbuk Zoltan 5 年前
父节点
当前提交
74d0013acc

+ 6
- 0
android/app/.classpath 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
4
+	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
+	<classpathentry kind="output" path="bin/default"/>
6
+</classpath>

+ 2
- 0
android/app/.settings/org.eclipse.buildship.core.prefs 查看文件

@@ -0,0 +1,2 @@
1
+connection.project.dir=..
2
+eclipse.preferences.version=1

+ 6
- 0
android/sdk/.classpath 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
4
+	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
+	<classpathentry kind="output" path="bin/default"/>
6
+</classpath>

+ 2
- 0
android/sdk/.settings/org.eclipse.buildship.core.prefs 查看文件

@@ -0,0 +1,2 @@
1
+connection.project.dir=..
2
+eclipse.preferences.version=1

+ 7
- 3
react/features/always-on-top/AlwaysOnTop.js 查看文件

@@ -5,7 +5,7 @@ import React, { Component } from 'react';
5 5
 // We need to reference these files directly to avoid loading things that are not available
6 6
 // in this environment (e.g. JitsiMeetJS or interfaceConfig)
7 7
 import StatelessAvatar from '../base/avatar/components/web/StatelessAvatar';
8
-import { getInitials } from '../base/avatar/functions';
8
+import { getAvatarColor, getInitials } from '../base/avatar/functions';
9 9
 
10 10
 import Toolbar from './Toolbar';
11 11
 
@@ -24,6 +24,7 @@ type State = {
24 24
     displayName: string,
25 25
     formattedDisplayName: string,
26 26
     isVideoDisplayed: boolean,
27
+    userID: string,
27 28
     visible: boolean
28 29
 };
29 30
 
@@ -50,6 +51,7 @@ export default class AlwaysOnTop extends Component<*, State> {
50 51
             displayName: '',
51 52
             formattedDisplayName: '',
52 53
             isVideoDisplayed: true,
54
+            userID: '',
53 55
             visible: true
54 56
         };
55 57
 
@@ -132,7 +134,8 @@ export default class AlwaysOnTop extends Component<*, State> {
132 134
             avatarURL,
133 135
             displayName,
134 136
             formattedDisplayName,
135
-            isVideoDisplayed
137
+            isVideoDisplayed,
138
+            userID
136 139
         });
137 140
     }
138 141
 
@@ -175,7 +178,7 @@ export default class AlwaysOnTop extends Component<*, State> {
175 178
      * @returns {ReactElement}
176 179
      */
177 180
     _renderVideoNotAvailableScreen() {
178
-        const { avatarURL, displayName, formattedDisplayName, isVideoDisplayed } = this.state;
181
+        const { avatarURL, displayName, formattedDisplayName, isVideoDisplayed, userID } = this.state;
179 182
 
180 183
         if (isVideoDisplayed) {
181 184
             return null;
@@ -185,6 +188,7 @@ export default class AlwaysOnTop extends Component<*, State> {
185 188
             <div id = 'videoNotAvailableScreen'>
186 189
                 <div id = 'avatarContainer'>
187 190
                     <StatelessAvatar
191
+                        color = { getAvatarColor(userID) }
188 192
                         id = 'avatar'
189 193
                         initials = { getInitials(displayName) }
190 194
                         url = { avatarURL } />)

+ 3
- 2
react/features/base/avatar/components/Avatar.js 查看文件

@@ -175,13 +175,14 @@ class Avatar<P: Props> extends PureComponent<P, State> {
175 175
  * @returns {Props}
176 176
  */
177 177
 export function _mapStateToProps(state: Object, ownProps: Props) {
178
-    const { displayName, participantId } = ownProps;
178
+    const { colorBase, displayName, participantId } = ownProps;
179 179
     const _participant = participantId && getParticipantById(state, participantId);
180 180
     const _initialsBase = (_participant && _participant.name) || displayName;
181 181
 
182 182
     return {
183 183
         _initialsBase,
184
-        _loadableAvatarUrl: _participant && _participant.loadableAvatarUrl
184
+        _loadableAvatarUrl: _participant && _participant.loadableAvatarUrl,
185
+        colorBase: !colorBase && _participant ? _participant.id : colorBase
185 186
     };
186 187
 }
187 188
 

正在加载...
取消
保存