Added emailChange listener to API
This commit is contained in:
parent
63c017f8e6
commit
20444adbc9
|
@ -1955,7 +1955,8 @@ export default {
|
|||
}
|
||||
);
|
||||
|
||||
APP.UI.addListener(UIEvents.EMAIL_CHANGED, this.changeLocalEmail);
|
||||
APP.UI.addListener(UIEvents.EMAIL_CHANGED,
|
||||
this.changeLocalEmail.bind(this));
|
||||
room.addCommandListener(this.commands.defaults.EMAIL, (data, from) => {
|
||||
APP.store.dispatch(participantUpdated({
|
||||
conference: room,
|
||||
|
@ -2537,7 +2538,9 @@ export default {
|
|||
APP.store.dispatch(updateSettings({
|
||||
email: formattedEmail
|
||||
}));
|
||||
|
||||
APP.API.notifyEmailChanged(localId, {
|
||||
email: formattedEmail
|
||||
});
|
||||
sendData(commands.EMAIL, formattedEmail);
|
||||
},
|
||||
|
||||
|
|
14
doc/api.md
14
doc/api.md
|
@ -194,6 +194,15 @@ changes. The listener will receive an object with the following structure:
|
|||
}
|
||||
```
|
||||
|
||||
* **emailChange** - event notifications about email
|
||||
changes. The listener will receive an object with the following structure:
|
||||
```javascript
|
||||
{
|
||||
"id": id, // the id of the participant that changed his email
|
||||
"email": email // the new email
|
||||
}
|
||||
```
|
||||
|
||||
* **participantJoined** - event notifications about new participants who join the room. The listener will receive an object with the following structure:
|
||||
```javascript
|
||||
{
|
||||
|
@ -290,6 +299,11 @@ You can get the display name of a participant in the conference with the followi
|
|||
var displayName = api.getDisplayName(participantId);
|
||||
```
|
||||
|
||||
You can get the email of a participant in the conference with the following API function:
|
||||
```javascript
|
||||
var email = api.getEmail(participantId);
|
||||
```
|
||||
|
||||
You can get the iframe HTML element where Jitsi Meet is loaded with the following API function:
|
||||
```javascript
|
||||
var iframe = api.getIFrame();
|
||||
|
|
|
@ -363,6 +363,24 @@ class API {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify external application (if API is enabled) that user changed their
|
||||
* email.
|
||||
*
|
||||
* @param {string} id - User id.
|
||||
* @param {string} email - The new email of the participant.
|
||||
* @returns {void}
|
||||
*/
|
||||
notifyEmailChanged(
|
||||
id: string,
|
||||
{ email }: Object) {
|
||||
this._sendEvent({
|
||||
name: 'email-change',
|
||||
email,
|
||||
id
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify external application (if API is enabled) that the conference has
|
||||
* been joined.
|
||||
|
|
|
@ -40,6 +40,7 @@ const events = {
|
|||
'audio-availability-changed': 'audioAvailabilityChanged',
|
||||
'audio-mute-status-changed': 'audioMuteStatusChanged',
|
||||
'display-name-change': 'displayNameChange',
|
||||
'email-change': 'emailChange',
|
||||
'feedback-submitted': 'feedbackSubmitted',
|
||||
'incoming-message': 'incomingMessage',
|
||||
'outgoing-message': 'outgoingMessage',
|
||||
|
@ -398,6 +399,14 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'email-change': {
|
||||
const user = this._participants[userID];
|
||||
|
||||
if (user) {
|
||||
user.email = data.email;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'avatar-changed': {
|
||||
const user = this._participants[userID];
|
||||
|
||||
|
@ -633,6 +642,18 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
|
|||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the email of a participant.
|
||||
*
|
||||
* @param {string} participantId - The id of the participant.
|
||||
* @returns {string} The email.
|
||||
*/
|
||||
getEmail(participantId) {
|
||||
const { email } = this._participants[participantId] || {};
|
||||
|
||||
return email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the formatted display name of a participant.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue