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

fix: Add visio conference link in agenda event - EXO-68458 #24

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
package org.exoplatform.webconferencing.externalvisio;

import org.exoplatform.social.core.identity.model.Identity;
import org.exoplatform.social.core.manager.IdentityManager;
import org.exoplatform.social.core.space.model.Space;
import org.exoplatform.webconferencing.ActiveCallProvider;
import org.exoplatform.webconferencing.CallProvider;
import org.exoplatform.webconferencing.CallProviderException;
Expand All @@ -24,6 +27,7 @@
import org.exoplatform.webconferencing.externalvisio.rest.model.ExternalVisioConnector;
import org.exoplatform.webconferencing.externalvisio.service.ExternalVisioConnectorService;

import javax.ws.rs.core.Response;
import java.util.List;

public class ExternalVisioProvider extends CallProvider {
Expand All @@ -39,16 +43,18 @@ public class ExternalVisioProvider extends CallProvider {
public static final String EXTERNAL_VISIO_TITLE = "ExternalVisio";

private ExternalVisioConnectorService externalVisioConnectorService;
private IdentityManager identityManager;

/**
* Instantiates a new web conferencing provider.
*
* @param params the params
* @throws ConfigurationException the configuration exception
*/
public ExternalVisioProvider(org.exoplatform.container.xml.InitParams params, ExternalVisioConnectorService externalVisioConnectorService) throws ConfigurationException {
public ExternalVisioProvider(org.exoplatform.container.xml.InitParams params, ExternalVisioConnectorService externalVisioConnectorService, IdentityManager identityManager) throws ConfigurationException {
super(params);
this.externalVisioConnectorService = externalVisioConnectorService;
this.identityManager = identityManager;
}

@Override
Expand Down Expand Up @@ -84,4 +90,17 @@ public List<ActiveCallProvider> getActiveProvidersForSpace(String spaceId) {
return new ActiveCallProvider(externalVisioConnector.getId().toString(), externalVisioConnector.getName(), null, false);
}).toList();
}

@Override
public boolean canInvite() {
return false;
}

public boolean isConfiguredForIdentity(String remoteId) {
Identity identity = identityManager.getOrCreateSpaceIdentity(remoteId);
if (identity == null) {
identity = identityManager.getOrCreateUserIdentity(remoteId);
}
return !externalVisioConnectorService.getConfiguredExternalVisioConnectors(identity).isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import javax.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import java.util.ArrayList;
import java.util.List;

@Path("/v1/externalVisio")
Expand Down Expand Up @@ -180,8 +181,11 @@ public Response getConfiguredExternalVisioConnectors(@Parameter(description = "i
identity = identityManager.getOrCreateUserIdentity(identityId);
}
try {
List<ExternalVisioConnector> externalVisioConnectors =
externalVisioConnectorService.getConfiguredExternalVisioConnectors(identity);
List<ExternalVisioConnector> externalVisioConnectors = new ArrayList<>();
if (identity!=null) {
externalVisioConnectors =
externalVisioConnectorService.getConfiguredExternalVisioConnectors(identity);
}
return Response.ok(externalVisioConnectors).build();
} catch (Exception e) {
LOG.warn("Error retrieving list of configured external visio connectors", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public List<ExternalVisioConnector> getConfiguredExternalVisioConnectors(Identit
return externalVisioConnectors.stream().map(EntityBuilder::fromEntity).map(p -> {
p.setUrl(getExternalVisioConnectorsUrl(identity, p));
return p;
}).filter(p -> p.getUrl() != null).toList();
}).filter(p -> p.getUrl() != null && !p.getUrl().isBlank()).toList();
}

public String getExternalVisioConnectorsUrl(Identity identity, ExternalVisioConnector externalVisioConnector) {
Expand Down
89 changes: 64 additions & 25 deletions webapp/src/main/webapp/js/webconferencing-externalvisio.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
settings = newSettings;
};

this.linkSupported = true;

/**
* Jitsi supports group calls.
*/
this.groupSupported = true;

/**
* MUST return a call type name. If several types supported, this one is
* assumed as major one and it will be used for referring this connector
Expand All @@ -61,6 +68,13 @@
// }
};

/**
* Must return if the current provider support invited users
*/
this.supportInvitedUsers = function() {
return false;
};

/**
* MUST return all call types supported by a connector.
*/
Expand All @@ -75,9 +89,7 @@
* MUST return human-readable title of a connector.
*/
this.getTitle = function() {
if (settings) {
return settings.title;
}
return 'ExternalVisio';
};

var getActiveProviders = function(identityId) {
Expand Down Expand Up @@ -105,31 +117,35 @@
context.details().then(target => {
if (!buttonType || buttonType === "vue") {
let activeButtons = [];
if (context.isSpace || context.isUser) {
const identityId = context.isSpace ? context.spaceId : context.userId;
getActiveProviders(identityId)
.then((activeProviders) => {
activeButtons = activeProviders;
const buttonComponents = []; // Créer une liste pour stocker les composants Vue
activeButtons.forEach(p => {
const callSettings = {};
callSettings.target = target;
callSettings.context = context;
callSettings.provider = self;
callSettings.nameConnector = p.name;
callSettings.urlConnector = p.url;
callSettings.onCallOpen = () => {
startCall(callSettings.urlConnector);
};
callButton.init(callSettings).then(comp => {
// Ajouter le composant Vue à la liste
buttonComponents.push(comp);

if (buttonComponents.length === activeButtons.length) {
button.resolve(buttonComponents);
}
getActiveProviders(identityId)
.then((activeProviders) => {
activeButtons = activeProviders;
const buttonComponents = []; // Créer une liste pour stocker les composants Vue
activeButtons.forEach(p => {
const callSettings = {};
callSettings.target = target;
callSettings.context = context;
callSettings.provider = self;
callSettings.nameConnector = p.name;
callSettings.urlConnector = p.url;
callSettings.onCallOpen = () => {
startCall(callSettings.urlConnector);
};
callButton.init(callSettings).then(comp => {
// Ajouter le composant Vue à la liste
buttonComponents.push(comp);

if (buttonComponents.length === activeButtons.length) {
button.resolve(buttonComponents);
}
});
});
});
});
} else {
button.resolve(activeButtons);
}
} else {
const message = "Button type not supported: " + buttonType;
log.error(message);
Expand All @@ -153,6 +169,29 @@
return button.promise();
};

this.getCallId = function(context) {
var process = $.Deferred();
if (context.isUser) {
process.resolve(context.currentUser.id);
} else {
Vue.prototype.$identityService.getIdentityById(context.spaceId)
.then((identity) => process.resolve(identity.remoteId));
}
return process.promise();
};

var getCallUrl = function(callId) {
var process = $.Deferred();
getActiveProviders(callId)
.then((activeProviders) => {
if(activeProviders.length>0) {
process.resolve(activeProviders[0].url);
}
});
return process.promise();
};
this.getCallUrl = getCallUrl;

};

var provider = new ExternalVisioProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ export default {
},
}
};
</script>
</script>
Loading