updated the SDK to 25.03.24

This commit is contained in:
Mauro Romito
2025-03-19 12:38:21 +01:00
committed by Mauro
parent 24777184ef
commit cfd4392837
17 changed files with 99 additions and 68 deletions
@@ -106,10 +106,10 @@ class AuthenticationService: AuthenticationServiceProtocol {
await client.abortOidcAuth(authorizationData: data.underlyingData)
}
func loginWithOIDCCallback(_ callbackURL: URL, data: OIDCAuthorizationDataProxy) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
func loginWithOIDCCallback(_ callbackURL: URL) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
guard let client else { return .failure(.failedLoggingIn) }
do {
try await client.loginWithOidcCallback(authorizationData: data.underlyingData, callbackUrl: callbackURL.absoluteString)
try await client.loginWithOidcCallback(callbackUrl: callbackURL.absoluteString)
return await userSession(for: client)
} catch OidcError.Cancelled {
return .failure(.oidcError(.userCancellation))
@@ -45,7 +45,7 @@ protocol AuthenticationServiceProtocol {
/// Asks the SDK to abort an ongoing OIDC login if we didn't get a callback to complete the request with.
func abortOIDCLogin(data: OIDCAuthorizationDataProxy) async
/// Completes an OIDC login that was started using ``urlForOIDCLogin``.
func loginWithOIDCCallback(_ callbackURL: URL, data: OIDCAuthorizationDataProxy) async -> Result<UserSessionProtocol, AuthenticationServiceError>
func loginWithOIDCCallback(_ callbackURL: URL) async -> Result<UserSessionProtocol, AuthenticationServiceError>
/// Performs a password login using the current homeserver.
func login(username: String, password: String, initialDeviceName: String?, deviceID: String?) async -> Result<UserSessionProtocol, AuthenticationServiceError>
/// Completes registration using the credentials obtained via the helper URL.
@@ -50,6 +50,7 @@ struct ElementCallWidgetMessage: Codable {
class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriverProtocol {
private let room: RoomProtocol
private let deviceID: String
private var widgetDriver: WidgetDriverAndHandle?
let widgetID = UUID().uuidString
@@ -65,14 +66,14 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
self.deviceID = deviceID
}
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme) async -> Result<URL, ElementCallWidgetDriverError> {
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
guard let room = room as? Room else {
return .failure(.roomInvalid)
}
let useEncryption = await (try? room.latestEncryptionState() == .encrypted) ?? false
let widgetSettings: WidgetSettings
do {
widgetSettings = try newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString,
widgetId: widgetID,
@@ -84,13 +85,13 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
confineToRoom: true,
font: nil,
encryption: useEncryption ? .perParticipantKeys : .unencrypted,
intent: .startCall,
hideScreensharing: false, // The web view will hide it automatically
intent: nil,
hideScreensharing: false,
posthogUserId: nil,
posthogApiHost: nil,
posthogApiKey: nil,
rageshakeSubmitUrl: nil,
sentryDsn: nil,
posthogApiHost: analyticsConfiguration?.posthogAPIHost,
posthogApiKey: analyticsConfiguration?.posthogAPIKey,
rageshakeSubmitUrl: analyticsConfiguration?.rageshakeSubmitURL,
sentryDsn: analyticsConfiguration?.sentryDSN,
sentryEnvironment: nil))
} catch {
MXLog.error("Failed to build widget settings: \(error)")
@@ -29,8 +29,15 @@ protocol ElementCallWidgetDriverProtocol {
var messagePublisher: PassthroughSubject<String, Never> { get }
var actions: AnyPublisher<ElementCallWidgetDriverAction, Never> { get }
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme) async -> Result<URL, ElementCallWidgetDriverError>
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>
/// Passes a message from the Widget to the SDK to handle, returning a Bool that represents whether or not the widget driver is still running.
func handleMessage(_ message: String) async -> Result<Bool, ElementCallWidgetDriverError>
}
struct ElementCallAnalyticsConfiguration {
let posthogAPIHost: String
let posthogAPIKey: String
let rageshakeSubmitURL: String
let sentryDSN: String
}
@@ -23,7 +23,7 @@ class GenericCallLinkWidgetDriver: ElementCallWidgetDriverProtocol {
self.url = url
}
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme) async -> Result<URL, ElementCallWidgetDriverError> {
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
MXLog.error("Nothing to start, use the configuration's URL directly instead.")
return .success(url)
}