From 2e5a042774689248c5436cc0a6b407ee8550e62d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 11 Sep 2025 08:58:36 +0200 Subject: [PATCH] SDK API change: handle change on VirtualElementCallWidgetOptions --- .../DefaultCallWidgetSettingsProvider.kt | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/widget/DefaultCallWidgetSettingsProvider.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/widget/DefaultCallWidgetSettingsProvider.kt index c45eeaa0ba..1ace9ad4c7 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/widget/DefaultCallWidgetSettingsProvider.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/widget/DefaultCallWidgetSettingsProvider.kt @@ -21,7 +21,8 @@ import org.matrix.rustcomponents.sdk.newVirtualElementCallWidget import uniffi.matrix_sdk.EncryptionSystem import uniffi.matrix_sdk.HeaderStyle import uniffi.matrix_sdk.NotificationType -import uniffi.matrix_sdk.VirtualElementCallWidgetOptions +import uniffi.matrix_sdk.VirtualElementCallWidgetConfig +import uniffi.matrix_sdk.VirtualElementCallWidgetProperties import uniffi.matrix_sdk.Intent as CallIntent @ContributesBinding(AppScope::class) @@ -33,17 +34,12 @@ class DefaultCallWidgetSettingsProvider( ) : CallWidgetSettingsProvider { override suspend fun provide(baseUrl: String, widgetId: String, encrypted: Boolean, direct: Boolean): MatrixWidgetSettings { val isAnalyticsEnabled = analyticsService.userConsentFlow.first() - val options = VirtualElementCallWidgetOptions( + val properties = VirtualElementCallWidgetProperties( elementCallUrl = baseUrl, widgetId = widgetId, - preload = null, fontScale = null, - appPrompt = false, - confineToRoom = true, font = null, encryption = if (encrypted) EncryptionSystem.PerParticipantKeys else EncryptionSystem.Unencrypted, - intent = CallIntent.START_CALL, - hideScreensharing = false, posthogUserId = callAnalyticsCredentialsProvider.posthogUserId.takeIf { isAnalyticsEnabled }, posthogApiHost = callAnalyticsCredentialsProvider.posthogApiHost.takeIf { isAnalyticsEnabled }, posthogApiKey = callAnalyticsCredentialsProvider.posthogApiKey.takeIf { isAnalyticsEnabled }, @@ -51,13 +47,24 @@ class DefaultCallWidgetSettingsProvider( sentryDsn = callAnalyticsCredentialsProvider.sentryDsn.takeIf { isAnalyticsEnabled }, sentryEnvironment = if (buildMeta.buildType == BuildType.RELEASE) "RELEASE" else "DEBUG", parentUrl = null, + ) + val config = VirtualElementCallWidgetConfig( + preload = null, + appPrompt = false, + confineToRoom = true, + intent = CallIntent.START_CALL, + hideScreensharing = false, // For backwards compatibility, it'll be ignored in recent versions of Element Call hideHeader = true, - controlledMediaDevices = true, + controlledAudioDevices = true, header = HeaderStyle.APP_BAR, sendNotificationType = if (direct) NotificationType.RING else NotificationType.NOTIFICATION, + skipLobby = null, + ) + val rustWidgetSettings = newVirtualElementCallWidget( + props = properties, + config = config, ) - val rustWidgetSettings = newVirtualElementCallWidget(options) return MatrixWidgetSettings.fromRustWidgetSettings(rustWidgetSettings) } }