diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java index 76ba13f..90ad965 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java @@ -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; @@ -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 { @@ -39,6 +43,7 @@ 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. @@ -46,9 +51,10 @@ public class ExternalVisioProvider extends CallProvider { * @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 @@ -84,4 +90,17 @@ public List 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(); + } } diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/rest/ExternalVisioConnectorRest.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/rest/ExternalVisioConnectorRest.java index 33a95b6..8681e11 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/rest/ExternalVisioConnectorRest.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/rest/ExternalVisioConnectorRest.java @@ -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") @@ -180,8 +181,11 @@ public Response getConfiguredExternalVisioConnectors(@Parameter(description = "i identity = identityManager.getOrCreateUserIdentity(identityId); } try { - List externalVisioConnectors = - externalVisioConnectorService.getConfiguredExternalVisioConnectors(identity); + List 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); diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java index be75d99..f364856 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java @@ -149,7 +149,7 @@ public List 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) { diff --git a/webapp/src/main/webapp/js/webconferencing-externalvisio.js b/webapp/src/main/webapp/js/webconferencing-externalvisio.js index 09b8b1b..8dfb70a 100644 --- a/webapp/src/main/webapp/js/webconferencing-externalvisio.js +++ b/webapp/src/main/webapp/js/webconferencing-externalvisio.js @@ -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 @@ -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. */ @@ -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) { @@ -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); @@ -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(); diff --git a/webapp/src/main/webapp/vue-app/CallButton/components/VisioConnectorMeetButton.vue b/webapp/src/main/webapp/vue-app/CallButton/components/VisioConnectorMeetButton.vue index f9ca7ee..6ee99fe 100644 --- a/webapp/src/main/webapp/vue-app/CallButton/components/VisioConnectorMeetButton.vue +++ b/webapp/src/main/webapp/vue-app/CallButton/components/VisioConnectorMeetButton.vue @@ -65,4 +65,4 @@ export default { }, } }; - \ No newline at end of file +