Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Remove Participant #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified circuit-va.zip
Binary file not shown.
48 changes: 25 additions & 23 deletions circuitClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Circuit = require('circuit-sdk');
* Wrapper class for Circuit.Client
*/
class CircuitClient {
constructor (credentials) {
constructor(credentials) {
// Create client instance
this.client = new Circuit.Client(credentials);

Expand All @@ -18,29 +18,32 @@ class CircuitClient {
})[0];
}
return c;
}
};

// Function bindings
this.sendClickToCallRequest = this.client.sendClickToCallRequest;
this.getStartedCalls = this.client.getStartedCalls;
this.addParticipant = this.client.addParticipant;
this.addTextItem = this.client.addTextItem;
this.getConversationsByIds = this.client.getConversationsByIds;
this.getDevices = this.client.getDevices;
this.joinConference = this.client.joinConference;
this.getDirectConversationWithUser = this.client.getDirectConversationWithUser;
this.addTextItem = this.client.addTextItem;
this.getStartedCalls = this.client.getStartedCalls;
this.joinConference = this.client.joinConference;
this.removeParticipant = this.client.removeParticipant;
this.sendClickToCallRequest = this.client.sendClickToCallRequest;

// Properties
Object.defineProperty(this, 'user', {
get: _ => { return this.client.loggedOnUser; }
get: _ => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe I should ask Roger but couldn't we just do get: _ => this.client.loggedOnUser

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have been modified on my end. I reverted the change; you can still ask Roger about it though.

return this.client.loggedOnUser;
}
});
}


/////////////////////////////////////
/// Public functions
/////////////////////////////////////

async searchUsers (query) {
async searchUsers(query) {
const self = this;
return new Promise(async resolve => {
let searchId;
Expand Down Expand Up @@ -98,7 +101,7 @@ class CircuitClient {

async function searchStatusHandler(evt) {
// Indicates is search is finished
console.log('searchStatus', evt)
console.log('searchStatus', evt);
if (evt.data.searchId !== searchId) {
return;
}
Expand All @@ -116,19 +119,20 @@ class CircuitClient {
self.client.addEventListener('basicSearchResults', searchResultHandler);
self.client.addEventListener('searchStatus', searchStatusHandler);

searchId = await self.client.startBasicSearch([{
scope: Circuit.Enums.SearchScope.CONVERSATIONS,
searchTerm: query
}]);
searchId = await self.client.startBasicSearch([
{
scope: Circuit.Enums.SearchScope.CONVERSATIONS,
searchTerm: query
}
]);
});
}

/**
* logon
*/
logon (accessToken) {
return this.client.logon(accessToken ? {accessToken: accessToken} : undefined)
.then(user => console.log(`Logged on to Circuit: ${user.displayName}`))
logon(accessToken) {
return this.client.logon(accessToken ? { accessToken: accessToken } : undefined).then(user => console.log(`Logged on to Circuit: ${user.displayName}`));
ChrisLubin marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -139,16 +143,14 @@ class CircuitClient {
return Promise.resolve();
}
const displayName = this.client.loggedOnUser.displayName;
return this.client.logout()
.then(_ => {
console.log(`Logged out of Circuit: ${displayName}`)
});
return this.client.logout().then(_ => {
ChrisLubin marked this conversation as resolved.
Show resolved Hide resolved
console.log(`Logged out of Circuit: ${displayName}`);
});
}

/////////////////////////////////////
/// Private functions
/////////////////////////////////////

}

module.exports = CircuitClient;
module.exports = CircuitClient;
ChrisLubin marked this conversation as resolved.
Show resolved Hide resolved
Loading