-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MeetingSdkAdapter): implement share control in its own file and …
…create the tests accordingly
- Loading branch information
1 parent
2649234
commit fd81198
Showing
5 changed files
with
154 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {Observable} from 'rxjs'; | ||
import {map, distinctUntilChanged} from 'rxjs/operators'; | ||
import {MeetingControlState} from '@webex/component-adapter-interfaces'; | ||
import MeetingControl from './MeetingControl'; | ||
|
||
/** | ||
* Display options of a meeting control. | ||
* | ||
* @external MeetingControlDisplay | ||
* @see {@link https://github.com/webex/component-adapter-interfaces/blob/master/src/MeetingsAdapter.js#L58} | ||
*/ | ||
|
||
export default class ShareControl extends MeetingControl { | ||
/** | ||
* Calls the adapter handleLocalShare() method | ||
* | ||
* @param {string} meetingID ID of the meeting to share screen | ||
*/ | ||
async action(meetingID) { | ||
await this.adapter.handleLocalShare(meetingID); | ||
} | ||
|
||
/** | ||
* Returns an observable that emits the display data of a share control. | ||
* | ||
* @param {string} meetingID ID of the meeting to start/stop screen share | ||
* @returns {Observable.<MeetingControlDisplay>} Observable stream that emits display data of the screen share control | ||
*/ | ||
display(meetingID) { | ||
const inactive = { | ||
ID: this.ID, | ||
type: 'TOGGLE', | ||
state: MeetingControlState.INACTIVE, | ||
icon: 'share-screen-presence-stroke_26', | ||
text: 'Start sharing', | ||
tooltip: 'Start Sharing', | ||
}; | ||
const active = { | ||
ID: this.ID, | ||
type: 'TOGGLE', | ||
state: MeetingControlState.ACTIVE, | ||
icon: 'share-screen-presence-stroke_26', | ||
text: 'Stop sharing', | ||
tooltip: 'Stop Sharing', | ||
}; | ||
|
||
return this.adapter.getMeeting(meetingID).pipe( | ||
map(({localShare: {stream}}) => (stream ? active : inactive)), | ||
distinctUntilChanged(), | ||
); | ||
} | ||
} |
Oops, something went wrong.