diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 2d8d1dcd24eb63846354469543dc044e3567597a..a9dce2c251ceffd5bfb644776e1b99d7fa7d1a78 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -8585,7 +8585,7 @@ repositoryURL = "https://github.com/element-hq/element-call-swift"; requirement = { kind = exactVersion; - version = "0.9.0-rc.3"; + version = "0.9.0-rc.4"; }; }; 821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b079ee8325679ae9c8434fe778240ada68632656..bd99c2fa3381a9f46ec23ca7955b8b96b4f1259d 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/element-call-swift", "state" : { - "revision" : "101bdac7a5f9c53f702065bac7772e9dedb26c62", - "version" : "0.9.0-rc.3" + "revision" : "88836b6add336f7d5a1c83266dfc725ae444b69b", + "version" : "0.9.0-rc.4" } }, { diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index d261e193269270af52c3267eaf69c26a7fb36604..960ab5a1536d77aaa56fef1286f5e958f0dbb920 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 startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = 0 - var startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount: Int { + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount = 0 + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCallsCount: Int { get { if Thread.isMainThread { - return startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount + return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount + returnValue = startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount } return returnValue! @@ -6005,29 +6005,29 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol, @unchecked S } set { if Thread.isMainThread { - startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = newValue + startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = newValue + startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount = newValue } } } } - var startBaseURLClientIDColorSchemeAnalyticsConfigurationCalled: Bool { - return startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount > 0 + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCalled: Bool { + return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCallsCount > 0 } - var startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedArguments: (baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?)? - var startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedInvocations: [(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?)] = [] + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedArguments: (baseURL: URL, clientID: String, colorScheme: ColorScheme, rageshakeURL: String?, analyticsConfiguration: ElementCallAnalyticsConfiguration?)? + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedInvocations: [(baseURL: URL, clientID: String, colorScheme: ColorScheme, rageshakeURL: String?, analyticsConfiguration: ElementCallAnalyticsConfiguration?)] = [] - var startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue: Result<URL, ElementCallWidgetDriverError>! - var startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue: Result<URL, ElementCallWidgetDriverError>! { + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue: Result<URL, ElementCallWidgetDriverError>! + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue: Result<URL, ElementCallWidgetDriverError>! { get { if Thread.isMainThread { - return startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue + return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue } else { var returnValue: Result<URL, ElementCallWidgetDriverError>? = nil DispatchQueue.main.sync { - returnValue = startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue + returnValue = startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue } return returnValue! @@ -6035,26 +6035,26 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol, @unchecked S } set { if Thread.isMainThread { - startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue = newValue + startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue = newValue + startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue = newValue } } } } - var startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure: ((URL, String, ColorScheme, ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>)? + var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure: ((URL, String, ColorScheme, String?, ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>)? - 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) + func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, rageshakeURL: String?, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> { + startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCallsCount += 1 + startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedArguments = (baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, rageshakeURL: rageshakeURL, analyticsConfiguration: analyticsConfiguration) DispatchQueue.main.async { - self.startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedInvocations.append((baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, analyticsConfiguration: analyticsConfiguration)) + self.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedInvocations.append((baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, rageshakeURL: rageshakeURL, analyticsConfiguration: analyticsConfiguration)) } - if let startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure = startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure { - return await startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure(baseURL, clientID, colorScheme, analyticsConfiguration) + if let startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure = startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure { + return await startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure(baseURL, clientID, colorScheme, rageshakeURL, analyticsConfiguration) } else { - return startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue + return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue } } //MARK: - handleMessage diff --git a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift index f22a43728fde32afcbe8909a48e4851d6f58a2d9..b21a2ca4977f366e4fbbf9ef389966cb82b774be 100644 --- a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift @@ -119,7 +119,7 @@ extension JoinedRoomProxyMock { fatalError() } - widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(url) + widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(url) elementCallWidgetDriverDeviceIDReturnValue = widgetDriver sendCallNotificationIfNeededReturnValue = .success(()) diff --git a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift index 9ef0c55beb2b1d3938af2933337c1bfdc2c4212f..2b1f82f4aa74284dc8c21ea31aca568ea20b5f6d 100644 --- a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift +++ b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift @@ -142,7 +142,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol state.url = url // We need widget messaging to work before enabling CallKit, otherwise mute, hangup etc do nothing. - case .roomCall(let roomProxy, let clientProxy, let clientID, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme, let notifyOtherParticipants): + case .roomCall(let roomProxy, _, let clientID, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme, let notifyOtherParticipants): Task { [weak self] in guard let self else { return } @@ -155,11 +155,11 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol // 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, + rageshakeURL: Secrets.rageshakeServerURL, analyticsConfiguration: analyticsConfiguration) { case .success(let url): state.url = url diff --git a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift index f76c77a798f7b5e896dd8fd7856bf0a94e678f71..d9767e64b00b92fef25d23eb31d1ea1a48f092a3 100644 --- a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift +++ b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift @@ -301,7 +301,7 @@ struct CallScreen_Previews: PreviewProvider { let widgetDriver = ElementCallWidgetDriverMock() widgetDriver.underlyingMessagePublisher = .init() widgetDriver.underlyingActions = PassthroughSubject<ElementCallWidgetDriverAction, Never>().eraseToAnyPublisher() - widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(URL.userDirectory) + widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(URL.userDirectory) roomProxy.elementCallWidgetDriverDeviceIDReturnValue = widgetDriver diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift index b74048097a2f4af794c44206f0f8e0b8fd49b87c..7a6c4ad1ad516ee2cb31389afce619d31061c505 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift @@ -66,7 +66,11 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv self.deviceID = deviceID } - func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> { + func start(baseURL: URL, + clientID: String, + colorScheme: ColorScheme, + rageshakeURL: String?, + analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> { guard let room = room as? Room else { return .failure(.roomInvalid) } @@ -85,12 +89,12 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv confineToRoom: true, font: nil, encryption: useEncryption ? .perParticipantKeys : .unencrypted, - intent: nil, + intent: .startCall, hideScreensharing: false, posthogUserId: nil, posthogApiHost: analyticsConfiguration?.posthogAPIHost, posthogApiKey: analyticsConfiguration?.posthogAPIKey, - rageshakeSubmitUrl: analyticsConfiguration?.rageshakeSubmitURL, + rageshakeSubmitUrl: rageshakeURL, sentryDsn: analyticsConfiguration?.sentryDSN, sentryEnvironment: nil)) } catch { diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift index 685e2052814e381e9e314e90ace6c8aa89b0829e..f082ddef477f0b9e44d7e271e53d95160f887064 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift @@ -29,7 +29,11 @@ protocol ElementCallWidgetDriverProtocol { var messagePublisher: PassthroughSubject<String, Never> { get } var actions: AnyPublisher<ElementCallWidgetDriverAction, Never> { get } - func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> + func start(baseURL: URL, + clientID: String, + colorScheme: ColorScheme, + rageshakeURL: String?, + 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> @@ -38,6 +42,5 @@ protocol ElementCallWidgetDriverProtocol { 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 e1129c430cfa4a0148a48d930ddbecf8e96c68db..e3264d6c034dcd5029be7917e9b61d5d61e8f543 100644 --- a/ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift @@ -23,7 +23,11 @@ class GenericCallLinkWidgetDriver: ElementCallWidgetDriverProtocol { self.url = url } - func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> { + func start(baseURL: URL, + clientID: String, + colorScheme: ColorScheme, + rageshakeURL: String?, + analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> { MXLog.error("Nothing to start, use the configuration's URL directly instead.") return .success(url) } diff --git a/project.yml b/project.yml index 641ae092e241fe2a677ab34eeb7517d40c84d9e8..ce5f2cd2301412953ecb1bfc544792337289ec3c 100644 --- a/project.yml +++ b/project.yml @@ -83,7 +83,7 @@ packages: # path: ../matrix-rich-text-editor/platforms/ios/lib/WysiwygComposer EmbeddedElementCall: url: https://github.com/element-hq/element-call-swift - exactVersion: 0.9.0-rc.3 + exactVersion: 0.9.0-rc.4 # External dependencies Algorithms: