feat(api): notify of password required

This commit is contained in:
Leonard Kim 2019-06-08 10:35:11 -07:00 committed by virtuacoplenny
parent 97e0303065
commit ae3b70eb13
4 changed files with 52 additions and 1 deletions

View File

@ -192,6 +192,11 @@ The `command` parameter is String object with the name of the command. The follo
api.executeCommand('displayName', 'New Nickname');
```
* **password** - Sets the password for the room. This command requires one argument - the password name to be set.
```javascript
api.executeCommand('password', 'The Password');
```
* **subject** - Sets the subject of the conference. This command requires one argument - the new subject to be set.
```javascript
api.executeCommand('subject', 'New Conference Subject');
@ -389,6 +394,8 @@ changes. The listener will receive an object with the following structure:
}
```
* **passwordRequired** - event notifications fired when failing to join a room because it has a password.
* **videoConferenceJoined** - event notifications fired when the local user has joined the video conference. The listener will receive an object with the following structure:
```javascript
{

View File

@ -5,7 +5,7 @@ import {
createApiEvent,
sendAnalytics
} from '../../react/features/analytics';
import { setSubject } from '../../react/features/base/conference';
import { setPassword, setSubject } from '../../react/features/base/conference';
import { parseJWTFromURLParams } from '../../react/features/base/jwt';
import { invite } from '../../react/features/invite';
import { toggleTileView } from '../../react/features/video-layout';
@ -65,6 +65,28 @@ function initCommands() {
sendAnalytics(createApiEvent('display.name.changed'));
APP.conference.changeLocalDisplayName(displayName);
},
'password': password => {
const { conference, passwordRequired }
= APP.store.getState()['features/base/conference'];
if (passwordRequired) {
sendAnalytics(createApiEvent('submit.password'));
APP.store.dispatch(setPassword(
passwordRequired,
passwordRequired.join,
password
));
} else {
sendAnalytics(createApiEvent('password.changed'));
APP.store.dispatch(setPassword(
conference,
conference.lock,
password
));
}
},
'proxy-connection-event': event => {
APP.conference.onProxyConnectionEvent(event);
},
@ -627,6 +649,16 @@ class API {
});
}
/**
* Notify external application of the current meeting requiring a password
* to join.
*
* @returns {void}
*/
notifyOnPasswordRequired() {
this._sendEvent({ name: 'password-required' });
}
/**
* Notify external application (if API is enabled) that the screen sharing
* has been turned on/off.

View File

@ -33,6 +33,7 @@ const commands = {
displayName: 'display-name',
email: 'email',
hangup: 'video-hangup',
password: 'password',
subject: 'subject',
submitFeedback: 'submit-feedback',
toggleAudio: 'toggle-audio',
@ -63,6 +64,7 @@ const events = {
'outgoing-message': 'outgoingMessage',
'participant-joined': 'participantJoined',
'participant-left': 'participantLeft',
'password-required': 'passwordRequired',
'proxy-connection-event': 'proxyConnectionEvent',
'video-ready-to-close': 'readyToClose',
'video-conference-joined': 'videoConferenceJoined',

View File

@ -1,6 +1,8 @@
// @flow
import { CONFERENCE_FAILED } from '../base/conference';
import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
import { MiddlewareRegistry } from '../base/redux';
declare var APP: Object;
@ -12,6 +14,14 @@ declare var APP: Object;
*/
MiddlewareRegistry.register((/* store */) => next => action => {
switch (action.type) {
case CONFERENCE_FAILED: {
if (action.conference
&& action.error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
APP.API.notifyOnPasswordRequired();
}
break;
}
case NOTIFY_CAMERA_ERROR:
if (action.error) {
APP.API.notifyOnCameraError(