Kaynağa Gözat

aot: jigasi participant icon

master
Bettenbuk Zoltan 6 yıl önce
ebeveyn
işleme
ad7892ebce

+ 2
- 3
react/features/base/avatar/components/Avatar.js Dosyayı Görüntüle

@@ -175,15 +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 { colorBase, displayName, participantId, url } = 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 184
         _loadableAvatarUrl: _participant && _participant.loadableAvatarUrl,
185
-        colorBase: !colorBase && _participant ? _participant.id : colorBase,
186
-        url: !url && _participant && _participant.isJigasi ? 'icon://phone' : url
185
+        colorBase: !colorBase && _participant ? _participant.id : colorBase
187 186
     };
188 187
 }
189 188
 

+ 7
- 0
react/features/base/participants/constants.js Dosyayı Görüntüle

@@ -13,6 +13,13 @@
13 13
  */
14 14
 export const DEFAULT_AVATAR_RELATIVE_PATH = 'images/avatar.png';
15 15
 
16
+/**
17
+ * Icon URL for jigasi participants.
18
+ *
19
+ * @type {string}
20
+ */
21
+export const JIGASI_PARTICIPANT_ICON = 'icon://phone';
22
+
16 23
 /**
17 24
  * The local participant might not have real ID until she joins a conference,
18 25
  * so use 'local' as her default ID.

+ 14
- 0
react/features/base/participants/functions.js Dosyayı Görüntüle

@@ -9,6 +9,7 @@ import { getTrackByMediaTypeAndParticipant } from '../tracks';
9 9
 import { createDeferred } from '../util';
10 10
 
11 11
 import {
12
+    JIGASI_PARTICIPANT_ICON,
12 13
     MAX_DISPLAY_NAME_LENGTH,
13 14
     PARTICIPANT_ROLE
14 15
 } from './constants';
@@ -24,6 +25,9 @@ const AVATAR_QUEUE = [];
24 25
 const AVATAR_CHECKED_URLS = new Map();
25 26
 /* eslint-disable arrow-body-style */
26 27
 const AVATAR_CHECKER_FUNCTIONS = [
28
+    participant => {
29
+        return participant && participant.isJigasi ? JIGASI_PARTICIPANT_ICON : null;
30
+    },
27 31
     participant => {
28 32
         return participant && participant.avatarURL ? participant.avatarURL : null;
29 33
     },
@@ -257,6 +261,16 @@ export function isEveryoneModerator(stateful: Object | Function) {
257 261
     return true;
258 262
 }
259 263
 
264
+/**
265
+ * Checks a URL string and returns true if it's an icon url.
266
+ *
267
+ * @param {string?} url - The URL string to check.
268
+ * @returns {boolean}
269
+ */
270
+export function isIconUrl(url: ?string) {
271
+    return Boolean(url && url.match(/icon:\/\/(.+)/i));
272
+}
273
+
260 274
 /**
261 275
  * Returns true if the current local participant is a moderator in the
262 276
  * conference.

+ 6
- 0
react/features/base/participants/preloadImage.native.js Dosyayı Görüntüle

@@ -3,6 +3,8 @@
3 3
 
4 4
 import { Image } from 'react-native';
5 5
 
6
+import { isIconUrl } from './functions';
7
+
6 8
 /**
7 9
  * Tries to preload an image.
8 10
  *
@@ -10,6 +12,10 @@ import { Image } from 'react-native';
10 12
  * @returns {Promise}
11 13
  */
12 14
 export function preloadImage(src: string): Promise<string> {
15
+    if (isIconUrl(src)) {
16
+        return Promise.resolve(src);
17
+    }
18
+
13 19
     return new Promise((resolve, reject) => {
14 20
         Image.prefetch(src).then(() => resolve(src), reject);
15 21
     });

+ 6
- 0
react/features/base/participants/preloadImage.web.js Dosyayı Görüntüle

@@ -1,6 +1,8 @@
1 1
 
2 2
 // @flow
3 3
 
4
+import { isIconUrl } from './functions';
5
+
4 6
 declare var config: Object;
5 7
 
6 8
 /**
@@ -10,6 +12,10 @@ declare var config: Object;
10 12
  * @returns {Promise}
11 13
  */
12 14
 export function preloadImage(src: string): Promise<string> {
15
+    if (isIconUrl(src)) {
16
+        return Promise.resolve(src);
17
+    }
18
+
13 19
     if (typeof config === 'object' && config.disableThirdPartyRequests) {
14 20
         return Promise.reject();
15 21
     }

Loading…
İptal
Kaydet