Skip to content

Commit

Permalink
feat(meeting): enable input of password and name while initializing w…
Browse files Browse the repository at this point in the history
…idget (#346)
  • Loading branch information
sreenara authored Dec 30, 2024
1 parent 69c08f0 commit 32d3446
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/MeetingsSDKAdapter/controls/AudioControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default class AudioControl extends MeetingControl {
* Calls the adapter handleLocalAudio() method
*
* @private
* @param {string} meetingID ID of the meeting to mute audio
* @param {meetingID} ID of the meeting to mute audio
*/
action(meetingID) {
action({meetingID}) {
logger.debug('MEETING', meetingID, 'AudioControl::action()', ['called with', {meetingID}]);

return this.adapter.handleLocalAudio(meetingID);
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/AudioControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Audio Control', () => {
describe('action()', () => {
it('calls handleLocalAudio() SDK adapter method', async () => {
meetingsSDKAdapter.handleLocalAudio = jest.fn();
await meetingsSDKAdapter.meetingControls['mute-audio'].action(meetingID);
await meetingsSDKAdapter.meetingControls['mute-audio'].action({meetingID});
expect(meetingsSDKAdapter.handleLocalAudio).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.handleLocalAudio).toHaveBeenCalledWith(meetingID);
});
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/ExitControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class ExitControl extends MeetingControl {
*
* @param {string} meetingID Id of the meeting to leave from
*/
async action(meetingID) {
async action({meetingID}) {
logger.debug('MEETING', meetingID, 'ExitControl::action()', ['called with', {meetingID}]);

await this.adapter.leaveMeeting(meetingID);
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/ExitControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Exit Control', () => {
describe('action()', () => {
it('calls leaveMeeting() SDK adapter method', async () => {
meetingsSDKAdapter.leaveMeeting = jest.fn();
await meetingsSDKAdapter.meetingControls['leave-meeting'].action(meetingID);
await meetingsSDKAdapter.meetingControls['leave-meeting'].action({meetingID});
expect(meetingsSDKAdapter.leaveMeeting).toHaveBeenCalledWith(meetingID);
});
});
Expand Down
9 changes: 6 additions & 3 deletions src/MeetingsSDKAdapter/controls/JoinControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ export default class JoinControl extends MeetingControl {
/**
* Calls the adapter joinMeeting method.
*
* @param {string} meetingID Id of the meeting to join
* @param {meetingID, meetingPasswordOrPin}
*/
async action(meetingID) {
async action({meetingID, meetingPasswordOrPin, participantName}) {
logger.debug('MEETING', meetingID, 'JoinControl::action()', ['called with', {meetingID}]);

await this.adapter.joinMeeting(meetingID);
await this.adapter.joinMeeting(meetingID, {
password: meetingPasswordOrPin,
name: participantName,
});
}

/**
Expand Down
16 changes: 14 additions & 2 deletions src/MeetingsSDKAdapter/controls/JoinControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,20 @@ describe('Join Control', () => {
describe('action()', () => {
it('calls joinMeeting() SDK adapter method', async () => {
meetingsSDKAdapter.joinMeeting = jest.fn();
await meetingsSDKAdapter.meetingControls['join-meeting'].action(meetingID);
expect(meetingsSDKAdapter.joinMeeting).toHaveBeenCalledWith(meetingID);
await meetingsSDKAdapter.meetingControls['join-meeting'].action({meetingID});
expect(meetingsSDKAdapter.joinMeeting).toHaveBeenCalledWith(meetingID, {
name: undefined,
password: undefined,
});
});

it('calls joinMeeting() SDK adapter method with pin/password and participant\'s name', async () => {
meetingsSDKAdapter.joinMeeting = jest.fn();
await meetingsSDKAdapter.meetingControls['join-meeting'].action({meetingID, meetingPasswordOrPin: '123456', participantName: 'name'});
expect(meetingsSDKAdapter.joinMeeting).toHaveBeenCalledWith(meetingID, {
name: 'name',
password: '123456',
});
});
});
});
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/RosterControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class RosterControl extends MeetingControl {
*
* @param {string} meetingID Id of the meeting to toggle roster
*/
async action(meetingID) {
async action({meetingID}) {
logger.debug('MEETING', meetingID, 'RosterControl::action()', ['called with', {meetingID}]);

await this.adapter.toggleRoster(meetingID);
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/RosterControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Roster Control', () => {
describe('action()', () => {
it('calls toggleRoster() SDK adapter method', async () => {
meetingsSDKAdapter.toggleRoster = jest.fn();
await meetingsSDKAdapter.meetingControls['member-roster'].action(meetingID);
await meetingsSDKAdapter.meetingControls['member-roster'].action({meetingID});
expect(meetingsSDKAdapter.toggleRoster).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.toggleRoster).toHaveBeenCalledWith(meetingID);
});
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/SettingsControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class SettingsControl extends MeetingControl {
*
* @param {string} meetingID Meeting ID
*/
action(meetingID) {
action({meetingID}) {
logger.debug('Meeting', meetingID, 'SettingsControl::action()', ['called with', {meetingID}]);

this.adapter.toggleSettings(meetingID);
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/SettingsControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Settings Control', () => {
describe('action()', () => {
it('calls toggleSettings() SDK adapter method', async () => {
meetingsSDKAdapter.toggleSettings = jest.fn();
await meetingsSDKAdapter.meetingControls.settings.action(meetingID);
await meetingsSDKAdapter.meetingControls.settings.action({meetingID});
expect(meetingsSDKAdapter.toggleSettings).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.toggleSettings).toHaveBeenCalledWith(meetingID);
});
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/ShareControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class ShareControl extends MeetingControl {
*
* @param {string} meetingID ID of the meeting to share screen
*/
async action(meetingID) {
async action({meetingID}) {
logger.debug('MEETING', meetingID, 'ShareControl::action()', ['called with', {meetingID}]);

await this.adapter.handleLocalShare(meetingID);
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/ShareControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Share Control', () => {
describe('action()', () => {
it('calls handleLocalShare() SDK adapter method', async () => {
meetingsSDKAdapter.handleLocalShare = jest.fn();
await meetingsSDKAdapter.meetingControls['share-screen'].action(meetingID);
await meetingsSDKAdapter.meetingControls['share-screen'].action({meetingID});
expect(meetingsSDKAdapter.handleLocalShare).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.handleLocalShare).toHaveBeenCalledWith(meetingID);
});
Expand Down
4 changes: 2 additions & 2 deletions src/MeetingsSDKAdapter/controls/SwitchCameraControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default class SwitchCameraControl extends MeetingControl {
* @param {string} meetingID Meeting ID
* @param {string} cameraID Id of the camera to switch to
*/
async action(meetingID, cameraID) {
async action({meetingID, cameraId}) {
logger.debug('MEETING', meetingID, 'SwitchCameraControl::action()', ['called with', {meetingID}]);

await this.adapter.switchCamera(meetingID, cameraID);
await this.adapter.switchCamera(meetingID, cameraId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Switch Camera Control', () => {
describe('action()', () => {
it('calls switchCamera() SDK adapter method', async () => {
meetingsSDKAdapter.switchCamera = jest.fn();
await meetingsSDKAdapter.meetingControls['switch-camera'].action(meetingID, 'cameraID');
await meetingsSDKAdapter.meetingControls['switch-camera'].action({meetingID, cameraId: 'cameraID'});
expect(meetingsSDKAdapter.switchCamera).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.switchCamera).toHaveBeenCalledWith(meetingID, 'cameraID');
});
Expand Down
4 changes: 2 additions & 2 deletions src/MeetingsSDKAdapter/controls/SwitchMicrophoneControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default class SwitchMicrophoneControl extends MeetingControl {
* @param {string} meetingID Meeting ID
* @param {string} microphoneID Id of the microphone to switch to
*/
async action(meetingID, microphoneID) {
async action({meetingID, microphoneId}) {
logger.debug('MEETING', meetingID, 'SwitchMicrophoneControl::action()', ['called with', {meetingID}]);

await this.adapter.switchMicrophone(meetingID, microphoneID);
await this.adapter.switchMicrophone(meetingID, microphoneId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Switch Microphone Control', () => {
describe('action()', () => {
it('calls switchMicrophone() SDK adapter method', async () => {
meetingsSDKAdapter.switchMicrophone = jest.fn();
await meetingsSDKAdapter.meetingControls['switch-microphone'].action(meetingID, 'microphoneID');
await meetingsSDKAdapter.meetingControls['switch-microphone'].action({meetingID, microphoneId: 'microphoneID'});
expect(meetingsSDKAdapter.switchMicrophone).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.switchMicrophone).toHaveBeenCalledWith(meetingID, 'microphoneID');
});
Expand Down
4 changes: 2 additions & 2 deletions src/MeetingsSDKAdapter/controls/SwitchSpeakerControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default class SwitchSpeakerControl extends MeetingControl {
* @param {string} meetingID Meeting ID
* @param {string} speakerID ID of the speaker device to switch to
*/
async action(meetingID, speakerID) {
async action({meetingID, speakerId}) {
logger.debug('MEETING', meetingID, 'SwitchSpeakerControl::action()', ['called with', {meetingID}]);

await this.adapter.switchSpeaker(meetingID, speakerID);
await this.adapter.switchSpeaker(meetingID, speakerId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Switch Speaker Control', () => {
describe('action()', () => {
it('calls switchSpeaker() SDK adapter method', async () => {
meetingsSDKAdapter.switchSpeaker = jest.fn();
await meetingsSDKAdapter.meetingControls['switch-speaker'].action(meetingID, 'speakerID');
await meetingsSDKAdapter.meetingControls['switch-speaker'].action({meetingID, speakerId: 'speakerID'});
expect(meetingsSDKAdapter.switchSpeaker).toHaveBeenCalledWith(meetingID, 'speakerID');
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/MeetingsSDKAdapter/controls/VideoControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default class VideoControl extends MeetingControl {
/**
* Calls the adapter handleLocalVideo() method
*
* @param {string} meetingID Meeting id
* @param {meetingID} Meeting ID to mute video
*/
action(meetingID) {
action({meetingID}) {
logger.debug('MEETING', meetingID, 'VideoControl::action()', ['called with', {meetingID}]);

return this.adapter.handleLocalVideo(meetingID);
Expand Down
2 changes: 1 addition & 1 deletion src/MeetingsSDKAdapter/controls/VideoControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Video Control', () => {
describe('action()', () => {
it('calls handleLocalVideo() SDK adapter method', async () => {
meetingsSDKAdapter.handleLocalVideo = jest.fn();
await meetingsSDKAdapter.meetingControls['mute-video'].action(meetingID);
await meetingsSDKAdapter.meetingControls['mute-video'].action({meetingID});
expect(meetingsSDKAdapter.handleLocalVideo).toHaveBeenCalledTimes(1);
expect(meetingsSDKAdapter.handleLocalVideo).toHaveBeenCalledWith(meetingID);
});
Expand Down

0 comments on commit 32d3446

Please sign in to comment.