Skip to content

Commit

Permalink
feat(MeetingSdkAdapter): add joinMeeting control meeting
Browse files Browse the repository at this point in the history
  • Loading branch information
akoushke committed Dec 10, 2019
1 parent 16673ee commit ae19cc1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/MeetingsSDKAdapter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {MeetingsAdapter} from '@webex/component-adapter-interfaces';
import {MeetingsAdapter, MeetingControlState} from '@webex/component-adapter-interfaces';
import {concat, from, fromEvent, Observable} from 'rxjs';
import {filter, finalize, map, publishReplay, refCount} from 'rxjs/operators';

const EVENT_MEDIA_READY = 'media:ready';
const JOIN_CONTROL = 'join-meeting';
const MEDIA_TYPE_LOCAL = 'local';
const MEDIA_TYPE_REMOTE_AUDIO = 'remoteAudio';
const MEDIA_TYPE_REMOTE_VIDEO = 'remoteVideo';
Expand All @@ -20,6 +21,12 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
super(datasource);
this.getMeetingObservables = {};
this.meetings = {};

this.meetingControls[JOIN_CONTROL] = {
ID: JOIN_CONTROL,
action: this.joinMeeting.bind(this),
display: this.joinControl.bind(this),
};
}

/**
Expand Down Expand Up @@ -167,6 +174,26 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
});
}

/**
* Returns an observable that emits the display data of a meeting control.
*
* @returns {Observable.<MeetingControlDisplay>}
* @memberof MeetingJSONAdapter
* @private
*/
joinControl() {
return Observable.create((observer) => {
observer.next({
ID: JOIN_CONTROL,
text: 'Join meeting',
tooltip: 'Join meeting',
state: MeetingControlState.ACTIVE,
});

observer.complete();
});
}

/**
* Returns an observable that emits meeting data of the given ID.
*
Expand Down
14 changes: 14 additions & 0 deletions src/MeetingsSDKAdapter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ describe('Meetings SDK Adapter', () => {
});
});

describe('joinControl()', () => {
test('returns the display data of a meeting control in a proper shape', (done) => {
meetingSDKAdapter.joinControl().subscribe((dataDisplay) => {
expect(dataDisplay).toMatchObject({
ID: 'join-meeting',
text: 'Join meeting',
tooltip: 'Join meeting',
state: 'active',
});
done();
});
});
});

describe('getMeeting()', () => {
test('returns a meeting in a proper shape', (done) => {
meetingSDKAdapter
Expand Down

0 comments on commit ae19cc1

Please sign in to comment.