Bladeren bron

aot: jigasi participant icon

master
Bettenbuk Zoltan 6 jaren geleden
bovenliggende
commit
ad7892ebce

+ 2
- 3
react/features/base/avatar/components/Avatar.js Bestand weergeven

175
  * @returns {Props}
175
  * @returns {Props}
176
  */
176
  */
177
 export function _mapStateToProps(state: Object, ownProps: Props) {
177
 export function _mapStateToProps(state: Object, ownProps: Props) {
178
-    const { colorBase, displayName, participantId, url } = ownProps;
178
+    const { colorBase, displayName, participantId } = ownProps;
179
     const _participant = participantId && getParticipantById(state, participantId);
179
     const _participant = participantId && getParticipantById(state, participantId);
180
     const _initialsBase = (_participant && _participant.name) || displayName;
180
     const _initialsBase = (_participant && _participant.name) || displayName;
181
 
181
 
182
     return {
182
     return {
183
         _initialsBase,
183
         _initialsBase,
184
         _loadableAvatarUrl: _participant && _participant.loadableAvatarUrl,
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 Bestand weergeven

13
  */
13
  */
14
 export const DEFAULT_AVATAR_RELATIVE_PATH = 'images/avatar.png';
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
  * The local participant might not have real ID until she joins a conference,
24
  * The local participant might not have real ID until she joins a conference,
18
  * so use 'local' as her default ID.
25
  * so use 'local' as her default ID.

+ 14
- 0
react/features/base/participants/functions.js Bestand weergeven

9
 import { createDeferred } from '../util';
9
 import { createDeferred } from '../util';
10
 
10
 
11
 import {
11
 import {
12
+    JIGASI_PARTICIPANT_ICON,
12
     MAX_DISPLAY_NAME_LENGTH,
13
     MAX_DISPLAY_NAME_LENGTH,
13
     PARTICIPANT_ROLE
14
     PARTICIPANT_ROLE
14
 } from './constants';
15
 } from './constants';
24
 const AVATAR_CHECKED_URLS = new Map();
25
 const AVATAR_CHECKED_URLS = new Map();
25
 /* eslint-disable arrow-body-style */
26
 /* eslint-disable arrow-body-style */
26
 const AVATAR_CHECKER_FUNCTIONS = [
27
 const AVATAR_CHECKER_FUNCTIONS = [
28
+    participant => {
29
+        return participant && participant.isJigasi ? JIGASI_PARTICIPANT_ICON : null;
30
+    },
27
     participant => {
31
     participant => {
28
         return participant && participant.avatarURL ? participant.avatarURL : null;
32
         return participant && participant.avatarURL ? participant.avatarURL : null;
29
     },
33
     },
257
     return true;
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
  * Returns true if the current local participant is a moderator in the
275
  * Returns true if the current local participant is a moderator in the
262
  * conference.
276
  * conference.

+ 6
- 0
react/features/base/participants/preloadImage.native.js Bestand weergeven

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

+ 6
- 0
react/features/base/participants/preloadImage.web.js Bestand weergeven

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

Laden…
Annuleren
Opslaan