Add intent system to widget URL creation. (#4427)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pixlwave <6060466+pixlwave@users.noreply.github.com>
Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
Copilot
2025-09-11 10:03:15 +01:00
committed by GitHub
parent 13eb54fa37
commit 99423bc437
8 changed files with 84 additions and 18 deletions
@@ -76,31 +76,32 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
}
async let useEncryption = (try? room.latestEncryptionState() == .encrypted) ?? false
async let isDirect = room.isDirect()
let widgetSettings: WidgetSettings
async let intent = room.joinCallIntent
let widgetSettings: WidgetSettings
do {
widgetSettings = try await newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString,
widgetId: widgetID,
parentUrl: nil,
header: .appBar,
hideHeader: true,
preload: nil,
fontScale: nil,
appPrompt: false,
confineToRoom: true,
font: nil,
encryption: useEncryption ? .perParticipantKeys : .unencrypted,
intent: .startCall,
hideScreensharing: false,
posthogUserId: nil,
posthogApiHost: analyticsConfiguration?.posthogAPIHost,
posthogApiKey: analyticsConfiguration?.posthogAPIKey,
rageshakeSubmitUrl: rageshakeURL,
sentryDsn: analyticsConfiguration?.sentryDSN,
sentryEnvironment: nil,
controlledMediaDevices: !ProcessInfo.processInfo.isiOSAppOnMac,
sendNotificationType: isDirect ? .ring : .notification))
sentryEnvironment: nil),
config: .init(intent: intent,
skipLobby: nil,
header: nil,
hideHeader: nil,
preload: nil,
appPrompt: nil,
confineToRoom: nil,
hideScreensharing: nil,
controlledAudioDevices: nil,
sendNotificationType: nil))
} catch {
MXLog.error("Failed to build widget settings: \(error)")
return .failure(.failedBuildingWidgetSettings)