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
@@ -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() {
@@ -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):
@@ -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 {