Delegate the sending of call notifications to Element Call (#4370)

* Stop sending call notifications manually

The Element Call widget can now assume responsibility for sending them when you start a call.

* Bump Element Call embedded package to v0.14.0

* Delegate the sending of call notifications to Element Call

* Update the SDK.

* Use 'is' prefix for boolean

---------

Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
Robin
2025-08-01 18:47:48 +02:00
committed by GitHub
parent 731d60b6e9
commit 514c7808e2
13 changed files with 208 additions and 245 deletions
@@ -21,8 +21,7 @@ struct ElementCallConfiguration {
clientID: String,
elementCallBaseURL: URL,
elementCallBaseURLOverride: URL?,
colorScheme: ColorScheme,
notifyOtherParticipants: Bool)
colorScheme: ColorScheme)
}
/// The type of call being configured i.e. whether it's an external URL or an internal room call.
@@ -59,15 +58,13 @@ struct ElementCallConfiguration {
clientID: String,
elementCallBaseURL: URL,
elementCallBaseURLOverride: URL?,
colorScheme: ColorScheme,
notifyOtherParticipants: Bool) {
colorScheme: ColorScheme) {
kind = .roomCall(roomProxy: roomProxy,
clientProxy: clientProxy,
clientID: clientID,
elementCallBaseURL: elementCallBaseURL,
elementCallBaseURLOverride: elementCallBaseURLOverride,
colorScheme: colorScheme,
notifyOtherParticipants: notifyOtherParticipants)
colorScheme: colorScheme)
}
/// A string representing the call being configured.
@@ -75,7 +72,7 @@ struct ElementCallConfiguration {
switch kind {
case .genericCallLink(let url):
url.absoluteString
case .roomCall(let roomProxy, _, _, _, _, _, _):
case .roomCall(let roomProxy, _, _, _, _, _):
roomProxy.id
}
}
@@ -75,30 +75,32 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
return .failure(.roomInvalid)
}
let useEncryption = await (try? room.latestEncryptionState() == .encrypted) ?? false
async let useEncryption = (try? room.latestEncryptionState() == .encrypted) ?? false
async let isDirect = room.isDirect()
let widgetSettings: WidgetSettings
do {
widgetSettings = try 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))
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))
} catch {
MXLog.error("Failed to build widget settings: \(error)")
return .failure(.failedBuildingWidgetSettings)