WIP: Support using Element Call for voice calls in DMs

This commit is contained in:
Valere 2026-01-12 10:48:20 +01:00 committed by Benoit Marty
parent 66c3bf267a
commit ec420332c3
26 changed files with 122 additions and 42 deletions

View file

@ -30,7 +30,14 @@ class DefaultCallWidgetSettingsProvider(
private val callAnalyticsCredentialsProvider: CallAnalyticCredentialsProvider,
private val analyticsService: AnalyticsService,
) : CallWidgetSettingsProvider {
override suspend fun provide(baseUrl: String, widgetId: String, encrypted: Boolean, direct: Boolean, hasActiveCall: Boolean): MatrixWidgetSettings {
override suspend fun provide(
baseUrl: String,
widgetId: String,
encrypted: Boolean,
direct: Boolean,
voiceOnly: Boolean,
hasActiveCall: Boolean
): MatrixWidgetSettings {
val isAnalyticsEnabled = analyticsService.userConsentFlow.first()
val properties = VirtualElementCallWidgetProperties(
elementCallUrl = baseUrl,
@ -47,14 +54,18 @@ class DefaultCallWidgetSettingsProvider(
parentUrl = null,
)
val config = VirtualElementCallWidgetConfig(
// TODO remove this once we have the next EC version
preload = false,
// TODO remove this once we have the next EC version
skipLobby = null,
// // TODO remove this once we have the next EC version
// preload = false,
// // TODO remove this once we have the next EC version
// skipLobby = null,
intent = when {
direct && hasActiveCall -> CallIntent.JOIN_EXISTING_DM
direct && hasActiveCall -> {
if (voiceOnly) CallIntent.JOIN_EXISTING_DM_VOICE else CallIntent.JOIN_EXISTING_DM
}
hasActiveCall -> CallIntent.JOIN_EXISTING
direct -> CallIntent.START_CALL_DM
direct -> {
if (voiceOnly) CallIntent.START_CALL_DM_VOICE else CallIntent.START_CALL_DM
}
else -> CallIntent.START_CALL
}.also {
Timber.d("Starting/joining call with intent: $it")