Skip to content

Commit 98a9534

Browse files
committed
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
1 parent 0f35344 commit 98a9534

File tree

10 files changed

+49
-38
lines changed

10 files changed

+49
-38
lines changed

ElementX.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8585,7 +8585,7 @@
85858585
repositoryURL = "https://github.com/element-hq/element-call-swift";
85868586
requirement = {
85878587
kind = exactVersion;
8588-
version = "0.9.0-rc.3";
8588+
version = "0.9.0-rc.4";
85898589
};
85908590
};
85918591
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {

ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElementX/Sources/Mocks/Generated/GeneratedMocks.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5989,72 +5989,72 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol, @unchecked S
59895989

59905990
//MARK: - start
59915991

5992-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = 0
5993-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount: Int {
5992+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount = 0
5993+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCallsCount: Int {
59945994
get {
59955995
if Thread.isMainThread {
5996-
return startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount
5996+
return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount
59975997
} else {
59985998
var returnValue: Int? = nil
59995999
DispatchQueue.main.sync {
6000-
returnValue = startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount
6000+
returnValue = startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount
60016001
}
60026002

60036003
return returnValue!
60046004
}
60056005
}
60066006
set {
60076007
if Thread.isMainThread {
6008-
startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = newValue
6008+
startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount = newValue
60096009
} else {
60106010
DispatchQueue.main.sync {
6011-
startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingCallsCount = newValue
6011+
startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingCallsCount = newValue
60126012
}
60136013
}
60146014
}
60156015
}
6016-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationCalled: Bool {
6017-
return startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount > 0
6016+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCalled: Bool {
6017+
return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCallsCount > 0
60186018
}
6019-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedArguments: (baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?)?
6020-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedInvocations: [(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?)] = []
6019+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedArguments: (baseURL: URL, clientID: String, colorScheme: ColorScheme, rageshakeURL: String?, analyticsConfiguration: ElementCallAnalyticsConfiguration?)?
6020+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedInvocations: [(baseURL: URL, clientID: String, colorScheme: ColorScheme, rageshakeURL: String?, analyticsConfiguration: ElementCallAnalyticsConfiguration?)] = []
60216021

6022-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue: Result<URL, ElementCallWidgetDriverError>!
6023-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue: Result<URL, ElementCallWidgetDriverError>! {
6022+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue: Result<URL, ElementCallWidgetDriverError>!
6023+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue: Result<URL, ElementCallWidgetDriverError>! {
60246024
get {
60256025
if Thread.isMainThread {
6026-
return startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue
6026+
return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue
60276027
} else {
60286028
var returnValue: Result<URL, ElementCallWidgetDriverError>? = nil
60296029
DispatchQueue.main.sync {
6030-
returnValue = startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue
6030+
returnValue = startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue
60316031
}
60326032

60336033
return returnValue!
60346034
}
60356035
}
60366036
set {
60376037
if Thread.isMainThread {
6038-
startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue = newValue
6038+
startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue = newValue
60396039
} else {
60406040
DispatchQueue.main.sync {
6041-
startBaseURLClientIDColorSchemeAnalyticsConfigurationUnderlyingReturnValue = newValue
6041+
startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationUnderlyingReturnValue = newValue
60426042
}
60436043
}
60446044
}
60456045
}
6046-
var startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure: ((URL, String, ColorScheme, ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>)?
6046+
var startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure: ((URL, String, ColorScheme, String?, ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>)?
60476047

6048-
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
6049-
startBaseURLClientIDColorSchemeAnalyticsConfigurationCallsCount += 1
6050-
startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedArguments = (baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, analyticsConfiguration: analyticsConfiguration)
6048+
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, rageshakeURL: String?, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
6049+
startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationCallsCount += 1
6050+
startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedArguments = (baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, rageshakeURL: rageshakeURL, analyticsConfiguration: analyticsConfiguration)
60516051
DispatchQueue.main.async {
6052-
self.startBaseURLClientIDColorSchemeAnalyticsConfigurationReceivedInvocations.append((baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, analyticsConfiguration: analyticsConfiguration))
6052+
self.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReceivedInvocations.append((baseURL: baseURL, clientID: clientID, colorScheme: colorScheme, rageshakeURL: rageshakeURL, analyticsConfiguration: analyticsConfiguration))
60536053
}
6054-
if let startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure = startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure {
6055-
return await startBaseURLClientIDColorSchemeAnalyticsConfigurationClosure(baseURL, clientID, colorScheme, analyticsConfiguration)
6054+
if let startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure = startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure {
6055+
return await startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationClosure(baseURL, clientID, colorScheme, rageshakeURL, analyticsConfiguration)
60566056
} else {
6057-
return startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue
6057+
return startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue
60586058
}
60596059
}
60606060
//MARK: - handleMessage

ElementX/Sources/Mocks/JoinedRoomProxyMock.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extension JoinedRoomProxyMock {
119119
fatalError()
120120
}
121121

122-
widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(url)
122+
widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(url)
123123

124124
elementCallWidgetDriverDeviceIDReturnValue = widgetDriver
125125
sendCallNotificationIfNeededReturnValue = .success(())

ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
142142
state.url = url
143143
// We need widget messaging to work before enabling CallKit, otherwise mute, hangup etc do nothing.
144144

145-
case .roomCall(let roomProxy, let clientProxy, let clientID, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme, let notifyOtherParticipants):
145+
case .roomCall(let roomProxy, _, let clientID, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme, let notifyOtherParticipants):
146146
Task { [weak self] in
147147
guard let self else { return }
148148

@@ -155,11 +155,11 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
155155
// We only set the analytics configuration if analytics are enabled
156156
let analyticsConfiguration = analyticsService.isEnabled ? ElementCallAnalyticsConfiguration(posthogAPIHost: appSettings.elementCallPosthogAPIHost,
157157
posthogAPIKey: appSettings.elementCallPosthogAPIKey,
158-
rageshakeSubmitURL: Secrets.rageshakeServerURL,
159158
sentryDSN: appSettings.elementCallPosthogSentryDSN) : nil
160159
switch await widgetDriver.start(baseURL: baseURL,
161160
clientID: clientID,
162161
colorScheme: colorScheme,
162+
rageshakeURL: Secrets.rageshakeServerURL,
163163
analyticsConfiguration: analyticsConfiguration) {
164164
case .success(let url):
165165
state.url = url

ElementX/Sources/Screens/CallScreen/View/CallScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ struct CallScreen_Previews: PreviewProvider {
301301
let widgetDriver = ElementCallWidgetDriverMock()
302302
widgetDriver.underlyingMessagePublisher = .init()
303303
widgetDriver.underlyingActions = PassthroughSubject<ElementCallWidgetDriverAction, Never>().eraseToAnyPublisher()
304-
widgetDriver.startBaseURLClientIDColorSchemeAnalyticsConfigurationReturnValue = .success(URL.userDirectory)
304+
widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(URL.userDirectory)
305305

306306
roomProxy.elementCallWidgetDriverDeviceIDReturnValue = widgetDriver
307307

ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
6666
self.deviceID = deviceID
6767
}
6868

69-
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
69+
func start(baseURL: URL,
70+
clientID: String,
71+
colorScheme: ColorScheme,
72+
rageshakeURL: String?,
73+
analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
7074
guard let room = room as? Room else {
7175
return .failure(.roomInvalid)
7276
}
@@ -85,12 +89,12 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
8589
confineToRoom: true,
8690
font: nil,
8791
encryption: useEncryption ? .perParticipantKeys : .unencrypted,
88-
intent: nil,
92+
intent: .startCall,
8993
hideScreensharing: false,
9094
posthogUserId: nil,
9195
posthogApiHost: analyticsConfiguration?.posthogAPIHost,
9296
posthogApiKey: analyticsConfiguration?.posthogAPIKey,
93-
rageshakeSubmitUrl: analyticsConfiguration?.rageshakeSubmitURL,
97+
rageshakeSubmitUrl: rageshakeURL,
9498
sentryDsn: analyticsConfiguration?.sentryDSN,
9599
sentryEnvironment: nil))
96100
} catch {

ElementX/Sources/Services/ElementCall/ElementCallWidgetDriverProtocol.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ protocol ElementCallWidgetDriverProtocol {
2929
var messagePublisher: PassthroughSubject<String, Never> { get }
3030
var actions: AnyPublisher<ElementCallWidgetDriverAction, Never> { get }
3131

32-
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>
32+
func start(baseURL: URL,
33+
clientID: String,
34+
colorScheme: ColorScheme,
35+
rageshakeURL: String?,
36+
analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError>
3337

3438
/// 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.
3539
func handleMessage(_ message: String) async -> Result<Bool, ElementCallWidgetDriverError>
@@ -38,6 +42,5 @@ protocol ElementCallWidgetDriverProtocol {
3842
struct ElementCallAnalyticsConfiguration {
3943
let posthogAPIHost: String
4044
let posthogAPIKey: String
41-
let rageshakeSubmitURL: String
4245
let sentryDSN: String
4346
}

ElementX/Sources/Services/ElementCall/GenericCallLinkWidgetDriver.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class GenericCallLinkWidgetDriver: ElementCallWidgetDriverProtocol {
2323
self.url = url
2424
}
2525

26-
func start(baseURL: URL, clientID: String, colorScheme: ColorScheme, analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
26+
func start(baseURL: URL,
27+
clientID: String,
28+
colorScheme: ColorScheme,
29+
rageshakeURL: String?,
30+
analyticsConfiguration: ElementCallAnalyticsConfiguration?) async -> Result<URL, ElementCallWidgetDriverError> {
2731
MXLog.error("Nothing to start, use the configuration's URL directly instead.")
2832
return .success(url)
2933
}

project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ packages:
8383
# path: ../matrix-rich-text-editor/platforms/ios/lib/WysiwygComposer
8484
EmbeddedElementCall:
8585
url: https://github.com/element-hq/element-call-swift
86-
exactVersion: 0.9.0-rc.3
86+
exactVersion: 0.9.0-rc.4
8787

8888
# External dependencies
8989
Algorithms:

0 commit comments

Comments
 (0)