From cfd439283707e420e35ddb0de6e1b7c67228eb68 Mon Sep 17 00:00:00 2001 From: Mauro Romito <mauro.romito@element.io> Date: Wed, 19 Mar 2025 12:38:21 +0100 Subject: [PATCH] updated the SDK to 25.03.24 --- ElementX.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Sources/Application/AppSettings.swift | 7 ++- .../Mocks/Generated/GeneratedMocks.swift | 48 +++++++++---------- .../Mocks/Generated/SDKGeneratedMocks.swift | 36 +++++++------- .../Sources/Mocks/JoinedRoomProxyMock.swift | 2 +- .../OIDCAuthenticationPresenter.swift | 2 +- .../CallScreen/CallScreenCoordinator.swift | 4 +- .../CallScreen/CallScreenViewModel.swift | 18 ++++++- .../Screens/CallScreen/View/CallScreen.swift | 6 ++- .../AuthenticationService.swift | 4 +- .../AuthenticationServiceProtocol.swift | 2 +- .../ElementCall/ElementCallWidgetDriver.swift | 17 +++---- .../ElementCallWidgetDriverProtocol.swift | 9 +++- .../GenericCallLinkWidgetDriver.swift | 2 +- Tools/Sources/BuildSDK.swift | 2 +- project.yml | 2 +- 17 files changed, 99 insertions(+), 68 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index b54dbddf0..025bc4683 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -8565,7 +8565,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 25.03.21; + version = 25.03.24; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index fbace1562..43cd4330d 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "93b8303fa004060c8ba6a856e0b66a1d47514490", - "version" : "25.3.21" + "revision" : "0da89f2a2ddaf2306144f42aed642af3f3228a1c", + "version" : "25.3.24" } }, { diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index dfe809298..c4d2178d4 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -267,7 +267,12 @@ final class AppSettings { // MARK: - Element Call - let elementCallBaseURL: URL = "https://call.element.io" + let elementCallBaseURL: URL = "https://call.element.io/room" + + // These are publicly availble on https://call.element.io so we don't neeed to treat them as secrets + let elementCallPosthogAPIHost = "https://posthog-element-call.element.io" + let elementCallPosthogAPIKey = "phc_rXGHx9vDmyEvyRxPziYtdVIv0ahEv8A9uLWFcCi1WcU" + let elementCallPosthogSentryDSN = "https://3bd2f95ba5554d4497da7153b552ffb5@sentry.tools.element.io/41" @UserPreference(key: UserDefaultsKeys.elementCallBaseURLOverride, defaultValue: nil, storageType: .userDefaults(store)) var elementCallBaseURLOverride: URL? diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 763247f87..d261e1932 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -5989,15 +5989,15 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol, @unchecked S //MARK: - start - var startBaseURLClientIDColorSchemeUnderlyingCallsCount = 0 - var startBaseURLClientIDColorSchemeCallsCount: Int { + var startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = 0 + var startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount: Int { get { if Thread.isMainThread { - return startBaseURLClientIDColorSchemeUnderlyingCallsCount + return startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = startBaseURLClientIDColorSchemeUnderlyingCallsCount + returnValue = startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount } return returnValue! @@ -6005,29 +6005,29 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol, @unchecked S } set { if Thread.isMainThread { - startBaseURLClientIDColorSchemeUnderlyingCallsCount = newValue + startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - startBaseURLClientIDColorSchemeUnderlyingCallsCount = newValue + startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = newValue } } } } - var startBaseURLClientIDColorSchemeCalled: Bool { - return startBaseURLClientIDColorSchemeCallsCount > 0 + var startBaseURLClientIDColorSchemeAnalyticsConfigurationCalled: Bool { + return startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount > 0 } - var startBaseURLClientIDColorSchemeReceivedArguments: (baseURL: URL, clientID: String, colorScheme: ColorScheme)? - var startBaseURLClientIDColorSchemeReceivedInvocations: [(baseURL: URL, clientID: String, colorScheme: ColorScheme)] = [] + var startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedArguments: (baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?)? + var startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedInvocations: [(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?)] = [] - var startBaseURLClientIDColorSchemeUnderlyingReturnValue: Result<URL, ElementCallWidgetDriverError>! - var startBaseURLClientIDColorSchemeReturnValue: Result<URL, ElementCallWidgetDriverError>! { + var startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue: Result<URL, ElementCallWidgetDriverError>! + var startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue: Result<URL, ElementCallWidgetDriverError>! { get { if Thread.isMainThread { - return startBaseURLClientIDColorSchemeUnderlyingReturnValue + return startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue } else { var returnValue: Result<URL, ElementCallWidgetDriverError>? = nil DispatchQueue.main.sync { - returnValue = startBaseURLClientIDColorSchemeUnderlyingReturnValue + returnValue = startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue } return returnValue! @@ -6035,26 +6035,26 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol, @unchecked S } set { if Thread.isMainThread { - startBaseURLClientIDColorSchemeUnderlyingReturnValue = newValue + startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - startBaseURLClientIDColorSchemeUnderlyingReturnValue = newValue + startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue = newValue } } } } - var startBaseURLClientIDColorSchemeClosure: ((URL, String, ColorScheme) async -> Result<URL, ElementCallWidgetDriverError>)? + var startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure: ((URL, String, ColorScheme, ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>)? - func start(baseURL: URL, clientID: String, colorScheme: ColorScheme) async -> Result<URL, ElementCallWidgetDriverError> { - startBaseURLClientIDColorSchemeCallsCount += 1 - startBaseURLClientIDColorSchemeReceivedArguments = (baseURL: baseURL, clientID: clientID, colorScheme: colorScheme) + func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> { + startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount += 1 + startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedArguments = (baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, analyticsConfiguration: analyticsConfiguration) DispatchQueue.main.async { - self.startBaseURLClientIDColorSchemeReceivedInvocations.append((baseURL: baseURL, clientID: clientID, colorScheme: colorScheme)) + self.startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedInvocations.append((baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, analyticsConfiguration: analyticsConfiguration)) } - if let startBaseURLClientIDColorSchemeClosure = startBaseURLClientIDColorSchemeClosure { - return await startBaseURLClientIDColorSchemeClosure(baseURL, clientID, colorScheme) + if let startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure = startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure { + return await startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure(baseURL, clientID, colorScheme, analyticsConfiguration) } else { - return startBaseURLClientIDColorSchemeReturnValue + return startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue } } //MARK: - handleMessage diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index 82c9c9624..7e0e01faf 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -2567,16 +2567,16 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { //MARK: - loginWithOidcCallback - open var loginWithOidcCallbackAuthorizationDataCallbackUrlThrowableError: Error? - var loginWithOidcCallbackAuthorizationDataCallbackUrlUnderlyingCallsCount = 0 - open var loginWithOidcCallbackAuthorizationDataCallbackUrlCallsCount: Int { + open var loginWithOidcCallbackCallbackUrlThrowableError: Error? + var loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = 0 + open var loginWithOidcCallbackCallbackUrlCallsCount: Int { get { if Thread.isMainThread { - return loginWithOidcCallbackAuthorizationDataCallbackUrlUnderlyingCallsCount + return loginWithOidcCallbackCallbackUrlUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = loginWithOidcCallbackAuthorizationDataCallbackUrlUnderlyingCallsCount + returnValue = loginWithOidcCallbackCallbackUrlUnderlyingCallsCount } return returnValue! @@ -2584,31 +2584,31 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { } set { if Thread.isMainThread { - loginWithOidcCallbackAuthorizationDataCallbackUrlUnderlyingCallsCount = newValue + loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - loginWithOidcCallbackAuthorizationDataCallbackUrlUnderlyingCallsCount = newValue + loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = newValue } } } } - open var loginWithOidcCallbackAuthorizationDataCallbackUrlCalled: Bool { - return loginWithOidcCallbackAuthorizationDataCallbackUrlCallsCount > 0 + open var loginWithOidcCallbackCallbackUrlCalled: Bool { + return loginWithOidcCallbackCallbackUrlCallsCount > 0 } - open var loginWithOidcCallbackAuthorizationDataCallbackUrlReceivedArguments: (authorizationData: OAuthAuthorizationData, callbackUrl: String)? - open var loginWithOidcCallbackAuthorizationDataCallbackUrlReceivedInvocations: [(authorizationData: OAuthAuthorizationData, callbackUrl: String)] = [] - open var loginWithOidcCallbackAuthorizationDataCallbackUrlClosure: ((OAuthAuthorizationData, String) async throws -> Void)? + open var loginWithOidcCallbackCallbackUrlReceivedCallbackUrl: String? + open var loginWithOidcCallbackCallbackUrlReceivedInvocations: [String] = [] + open var loginWithOidcCallbackCallbackUrlClosure: ((String) async throws -> Void)? - open override func loginWithOidcCallback(authorizationData: OAuthAuthorizationData, callbackUrl: String) async throws { - if let error = loginWithOidcCallbackAuthorizationDataCallbackUrlThrowableError { + open override func loginWithOidcCallback(callbackUrl: String) async throws { + if let error = loginWithOidcCallbackCallbackUrlThrowableError { throw error } - loginWithOidcCallbackAuthorizationDataCallbackUrlCallsCount += 1 - loginWithOidcCallbackAuthorizationDataCallbackUrlReceivedArguments = (authorizationData: authorizationData, callbackUrl: callbackUrl) + loginWithOidcCallbackCallbackUrlCallsCount += 1 + loginWithOidcCallbackCallbackUrlReceivedCallbackUrl = callbackUrl DispatchQueue.main.async { - self.loginWithOidcCallbackAuthorizationDataCallbackUrlReceivedInvocations.append((authorizationData: authorizationData, callbackUrl: callbackUrl)) + self.loginWithOidcCallbackCallbackUrlReceivedInvocations.append(callbackUrl) } - try await loginWithOidcCallbackAuthorizationDataCallbackUrlClosure?(authorizationData, callbackUrl) + try await loginWithOidcCallbackCallbackUrlClosure?(callbackUrl) } //MARK: - logout diff --git a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift index 6573a1b0a..f22a43728 100644 --- a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift @@ -119,7 +119,7 @@ extension JoinedRoomProxyMock { fatalError() } - widgetDriver.startBaseURLClientIDColorSchemeReturnValue = .success(url) + widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(url) elementCallWidgetDriverDeviceIDReturnValue = widgetDriver sendCallNotificationIfNeededReturnValue = .success(()) diff --git a/ElementX/Sources/Screens/Authentication/OIDCAuthenticationPresenter.swift b/ElementX/Sources/Screens/Authentication/OIDCAuthenticationPresenter.swift index 3653d87fa..9d0d97d77 100644 --- a/ElementX/Sources/Screens/Authentication/OIDCAuthenticationPresenter.swift +++ b/ElementX/Sources/Screens/Authentication/OIDCAuthenticationPresenter.swift @@ -47,7 +47,7 @@ class OIDCAuthenticationPresenter: NSObject { return .failure(.oidcError(.unknown)) } - switch await authenticationService.loginWithOIDCCallback(url, data: oidcData) { + switch await authenticationService.loginWithOIDCCallback(url) { case .success(let userSession): return .success(userSession) case .failure(let error): diff --git a/ElementX/Sources/Screens/CallScreen/CallScreenCoordinator.swift b/ElementX/Sources/Screens/CallScreen/CallScreenCoordinator.swift index 0ff915873..7c42d2470 100644 --- a/ElementX/Sources/Screens/CallScreen/CallScreenCoordinator.swift +++ b/ElementX/Sources/Screens/CallScreen/CallScreenCoordinator.swift @@ -43,7 +43,9 @@ final class CallScreenCoordinator: CoordinatorProtocol { viewModel = CallScreenViewModel(elementCallService: parameters.elementCallService, configuration: parameters.configuration, allowPictureInPicture: parameters.allowPictureInPicture, - appHooks: parameters.appHooks) + appHooks: parameters.appHooks, + appSettings: ServiceLocator.shared.settings, + analyticsService: ServiceLocator.shared.analytics) } func start() { diff --git a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift index 69f663c7e..572414bb4 100644 --- a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift +++ b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift @@ -16,6 +16,8 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol private let elementCallService: ElementCallServiceProtocol private let configuration: ElementCallConfiguration private let isPictureInPictureAllowed: Bool + private let appSettings: AppSettings + private let analyticsService: AnalyticsService private let widgetDriver: ElementCallWidgetDriverProtocol @@ -33,9 +35,13 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol init(elementCallService: ElementCallServiceProtocol, configuration: ElementCallConfiguration, allowPictureInPicture: Bool, - appHooks: AppHooks) { + appHooks: AppHooks, + appSettings: AppSettings, + analyticsService: AnalyticsService) { self.elementCallService = elementCallService self.configuration = configuration + self.appSettings = appSettings + self.analyticsService = analyticsService isPictureInPictureAllowed = allowPictureInPicture switch configuration.kind { @@ -148,7 +154,15 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol elementCallBaseURL } - switch await widgetDriver.start(baseURL: baseURL, clientID: clientID, colorScheme: colorScheme) { + // We only set the analytics configuration if analytics are enabled + let analyticsConfiguration = analyticsService.isEnabled ? ElementCallAnalyticsConfiguration(posthogAPIHost: appSettings.elementCallPosthogAPIHost, + posthogAPIKey: appSettings.elementCallPosthogAPIKey, + rageshakeSubmitURL: Secrets.rageshakeServerURL, + sentryDSN: appSettings.elementCallPosthogSentryDSN) : nil + switch await widgetDriver.start(baseURL: baseURL, + clientID: clientID, + colorScheme: colorScheme, + analyticsConfiguration: analyticsConfiguration) { case .success(let url): state.url = url case .failure(let error): diff --git a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift index f965e84f5..eaf79e298 100644 --- a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift +++ b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift @@ -286,7 +286,7 @@ struct CallScreen_Previews: PreviewProvider { let widgetDriver = ElementCallWidgetDriverMock() widgetDriver.underlyingMessagePublisher = .init() widgetDriver.underlyingActions = PassthroughSubject<ElementCallWidgetDriverAction, Never>().eraseToAnyPublisher() - widgetDriver.startBaseURLClientIDColorSchemeReturnValue = .success(URL.userDirectory) + widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(URL.userDirectory) roomProxy.elementCallWidgetDriverDeviceIDReturnValue = widgetDriver @@ -299,7 +299,9 @@ struct CallScreen_Previews: PreviewProvider { colorScheme: .light, notifyOtherParticipants: false), allowPictureInPicture: false, - appHooks: AppHooks()) + appHooks: AppHooks(), + appSettings: ServiceLocator.shared.settings, + analyticsService: ServiceLocator.shared.analytics) }() static var previews: some View { diff --git a/ElementX/Sources/Services/Authentication/AuthenticationService.swift b/ElementX/Sources/Services/Authentication/AuthenticationService.swift index 021c855d7..f8489b809 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationService.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationService.swift @@ -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)) diff --git a/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift b/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift index ca5c0e76f..278a86a92 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift @@ -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. diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift index 5920cd0d8..b74048097 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift @@ -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)") diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift index 225c91bdb..685e20528 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift @@ -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 +} diff --git a/ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift b/ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift index ae503a980..e1129c430 100644 --- a/ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift @@ -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) } diff --git a/Tools/Sources/BuildSDK.swift b/Tools/Sources/BuildSDK.swift index 156cbfb22..052687e0b 100644 --- a/Tools/Sources/BuildSDK.swift +++ b/Tools/Sources/BuildSDK.swift @@ -68,7 +68,7 @@ struct BuildSDK: ParsableCommand { /// but only when the ``target`` option hasn't been supplied. func checkRustupTargets() throws { guard target.isEmpty, device == 0, simulator == 0 else { return } - guard let output = try Zsh.run(command: "rustup show") else { throw Error.rustupOutputFailure } + guard let output = try Zsh.run(command: "rustup target list --toolchain stable --installed") else { throw Error.rustupOutputFailure } var requiredTargets = Target.allCases.reduce(into: [String: Bool]()) { partialResult, target in partialResult[target.rawValue] = false diff --git a/project.yml b/project.yml index 81085afbd..878e996d7 100644 --- a/project.yml +++ b/project.yml @@ -59,7 +59,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 25.03.21 + exactVersion: 25.03.24 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios -- GitLab