EC update and improvements

Use .startCall intent, and always pass rageshakeURL to the widget

Updated EC to 0.9.0-rc.4

rageshakeURL is now a parameter
This commit is contained in:
Mauro Romito
2025-03-26 12:25:17 +01:00
committed by Mauro
parent 0f353447b5
commit 98a95342d0
10 changed files with 49 additions and 38 deletions
+1 -1
View File
@@ -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" */ = {
@@ -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"
}
},
{
@@ -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
@@ -119,7 +119,7 @@ extension JoinedRoomProxyMock {
fatalError()
}
widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(url)
widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(url)
elementCallWidgetDriverDeviceIDReturnValue = widgetDriver
sendCallNotificationIfNeededReturnValue = .success(())
@@ -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
@@ -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
@@ -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 {
@@ -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
}
@@ -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)
}
+1 -1
View File
@@ -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: