diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index d55fa9da4..e3f184255 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -9052,7 +9052,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 25.07.29; + version = 25.08.01; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { @@ -9068,7 +9068,7 @@ repositoryURL = "https://github.com/element-hq/element-call-swift"; requirement = { kind = exactVersion; - version = 0.13.1; + version = 0.14.0; }; }; 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 e9e25de2d..0afeb6dbf 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" : "dc273bd1fbb08c41ab517574b39c23ef667718c9", - "version" : "0.13.1" + "revision" : "5cfbd1b1d7fb5c3333dd9a8a43130e875a8ec56b", + "version" : "0.14.0" } }, { @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "98e28f3ad2b54525f6abb17ab8e2ad49e6bf3614", - "version" : "25.7.29" + "revision" : "7e51369bc9407e15295bfa94b96703063c7b7156", + "version" : "25.8.1" } }, { diff --git a/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift index 0e35f06da..b6c995356 100644 --- a/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/ChatsFlowCoordinator.swift @@ -186,7 +186,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol { case .userProfile(let userID): stateMachine.processEvent(.showUserProfileScreen(userID: userID), userInfo: .init(animated: animated)) case .call(let roomID): - Task { await presentCallScreen(roomID: roomID, notifyOtherParticipants: false) } + Task { await presentCallScreen(roomID: roomID) } case .genericCallLink(let url): presentCallScreen(genericCallLink: url) case .settings, .chatBackupSettings: @@ -531,8 +531,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol { switch action { case .presentCallScreen(let roomProxy): - // Here we assume that the app is running and the call state is already up to date - presentCallScreen(roomProxy: roomProxy, notifyOtherParticipants: !roomProxy.infoPublisher.value.hasRoomCall) + presentCallScreen(roomProxy: roomProxy) case .verifyUser(let userID): actionsSubject.send(.sessionVerification(.userInitiator(userID: userID))) case .finished: @@ -614,23 +613,22 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol { presentCallScreen(configuration: .init(genericCallLink: url)) } - private func presentCallScreen(roomID: String, notifyOtherParticipants: Bool) async { + private func presentCallScreen(roomID: String) async { guard case let .joined(roomProxy) = await userSession.clientProxy.roomForIdentifier(roomID) else { return } - presentCallScreen(roomProxy: roomProxy, notifyOtherParticipants: notifyOtherParticipants) + presentCallScreen(roomProxy: roomProxy) } - private func presentCallScreen(roomProxy: JoinedRoomProxyProtocol, notifyOtherParticipants: Bool) { + private func presentCallScreen(roomProxy: JoinedRoomProxyProtocol) { let colorScheme: ColorScheme = appMediator.windowManager.mainWindow.traitCollection.userInterfaceStyle == .light ? .light : .dark presentCallScreen(configuration: .init(roomProxy: roomProxy, clientProxy: userSession.clientProxy, clientID: InfoPlistReader.main.bundleIdentifier, elementCallBaseURL: appSettings.elementCallBaseURL, elementCallBaseURLOverride: appSettings.elementCallBaseURLOverride, - colorScheme: colorScheme, - notifyOtherParticipants: notifyOtherParticipants)) + colorScheme: colorScheme)) } private var callScreenPictureInPictureController: AVPictureInPictureController? @@ -833,7 +831,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol { navigationSplitCoordinator.setSheetCoordinator(nil) stateMachine.processEvent(.selectRoom(roomID: roomID, via: [], entryPoint: .room)) case .startCall(let roomID): - Task { await self.presentCallScreen(roomID: roomID, notifyOtherParticipants: false) } + Task { await self.presentCallScreen(roomID: roomID) } case .dismiss: navigationSplitCoordinator.setSheetCoordinator(nil) } diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 9648b4877..19b41ccbf 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -9099,70 +9099,6 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { return elementCallWidgetDriverDeviceIDReturnValue } } - //MARK: - sendCallNotificationIfNeeded - - var sendCallNotificationIfNeededUnderlyingCallsCount = 0 - var sendCallNotificationIfNeededCallsCount: Int { - get { - if Thread.isMainThread { - return sendCallNotificationIfNeededUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = sendCallNotificationIfNeededUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - sendCallNotificationIfNeededUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - sendCallNotificationIfNeededUnderlyingCallsCount = newValue - } - } - } - } - var sendCallNotificationIfNeededCalled: Bool { - return sendCallNotificationIfNeededCallsCount > 0 - } - - var sendCallNotificationIfNeededUnderlyingReturnValue: Result! - var sendCallNotificationIfNeededReturnValue: Result! { - get { - if Thread.isMainThread { - return sendCallNotificationIfNeededUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = sendCallNotificationIfNeededUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - sendCallNotificationIfNeededUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - sendCallNotificationIfNeededUnderlyingReturnValue = newValue - } - } - } - } - var sendCallNotificationIfNeededClosure: (() async -> Result)? - - func sendCallNotificationIfNeeded() async -> Result { - sendCallNotificationIfNeededCallsCount += 1 - if let sendCallNotificationIfNeededClosure = sendCallNotificationIfNeededClosure { - return await sendCallNotificationIfNeededClosure() - } else { - return sendCallNotificationIfNeededReturnValue - } - } //MARK: - matrixToPermalink var matrixToPermalinkUnderlyingCallsCount = 0 diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index d8aecb1f4..b352f7dd0 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -991,6 +991,48 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { await enableAllSendQueuesEnableClosure?(enable) } + //MARK: - enableSendQueueUploadProgress + + var enableSendQueueUploadProgressEnableUnderlyingCallsCount = 0 + open var enableSendQueueUploadProgressEnableCallsCount: Int { + get { + if Thread.isMainThread { + return enableSendQueueUploadProgressEnableUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = enableSendQueueUploadProgressEnableUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + enableSendQueueUploadProgressEnableUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + enableSendQueueUploadProgressEnableUnderlyingCallsCount = newValue + } + } + } + } + open var enableSendQueueUploadProgressEnableCalled: Bool { + return enableSendQueueUploadProgressEnableCallsCount > 0 + } + open var enableSendQueueUploadProgressEnableReceivedEnable: Bool? + open var enableSendQueueUploadProgressEnableReceivedInvocations: [Bool] = [] + open var enableSendQueueUploadProgressEnableClosure: ((Bool) -> Void)? + + open override func enableSendQueueUploadProgress(enable: Bool) { + enableSendQueueUploadProgressEnableCallsCount += 1 + enableSendQueueUploadProgressEnableReceivedEnable = enable + DispatchQueue.main.async { + self.enableSendQueueUploadProgressEnableReceivedInvocations.append(enable) + } + enableSendQueueUploadProgressEnableClosure?(enable) + } + //MARK: - encryption var encryptionUnderlyingCallsCount = 0 @@ -12507,6 +12549,81 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable { } } + //MARK: - fetchThreadSubscription + + open var fetchThreadSubscriptionThreadRootEventIdThrowableError: Error? + var fetchThreadSubscriptionThreadRootEventIdUnderlyingCallsCount = 0 + open var fetchThreadSubscriptionThreadRootEventIdCallsCount: Int { + get { + if Thread.isMainThread { + return fetchThreadSubscriptionThreadRootEventIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = fetchThreadSubscriptionThreadRootEventIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + fetchThreadSubscriptionThreadRootEventIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + fetchThreadSubscriptionThreadRootEventIdUnderlyingCallsCount = newValue + } + } + } + } + open var fetchThreadSubscriptionThreadRootEventIdCalled: Bool { + return fetchThreadSubscriptionThreadRootEventIdCallsCount > 0 + } + open var fetchThreadSubscriptionThreadRootEventIdReceivedThreadRootEventId: String? + open var fetchThreadSubscriptionThreadRootEventIdReceivedInvocations: [String] = [] + + var fetchThreadSubscriptionThreadRootEventIdUnderlyingReturnValue: ThreadStatus? + open var fetchThreadSubscriptionThreadRootEventIdReturnValue: ThreadStatus? { + get { + if Thread.isMainThread { + return fetchThreadSubscriptionThreadRootEventIdUnderlyingReturnValue + } else { + var returnValue: ThreadStatus?? = nil + DispatchQueue.main.sync { + returnValue = fetchThreadSubscriptionThreadRootEventIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + fetchThreadSubscriptionThreadRootEventIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + fetchThreadSubscriptionThreadRootEventIdUnderlyingReturnValue = newValue + } + } + } + } + open var fetchThreadSubscriptionThreadRootEventIdClosure: ((String) async throws -> ThreadStatus?)? + + open override func fetchThreadSubscription(threadRootEventId: String) async throws -> ThreadStatus? { + if let error = fetchThreadSubscriptionThreadRootEventIdThrowableError { + throw error + } + fetchThreadSubscriptionThreadRootEventIdCallsCount += 1 + fetchThreadSubscriptionThreadRootEventIdReceivedThreadRootEventId = threadRootEventId + DispatchQueue.main.async { + self.fetchThreadSubscriptionThreadRootEventIdReceivedInvocations.append(threadRootEventId) + } + if let fetchThreadSubscriptionThreadRootEventIdClosure = fetchThreadSubscriptionThreadRootEventIdClosure { + return try await fetchThreadSubscriptionThreadRootEventIdClosure(threadRootEventId) + } else { + return fetchThreadSubscriptionThreadRootEventIdReturnValue + } + } + //MARK: - forget open var forgetThrowableError: Error? @@ -15421,121 +15538,6 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable { try await saveComposerDraftDraftThreadRootClosure?(draft, threadRoot) } - //MARK: - sendCallNotification - - open var sendCallNotificationCallIdApplicationNotifyTypeMentionsThrowableError: Error? - var sendCallNotificationCallIdApplicationNotifyTypeMentionsUnderlyingCallsCount = 0 - open var sendCallNotificationCallIdApplicationNotifyTypeMentionsCallsCount: Int { - get { - if Thread.isMainThread { - return sendCallNotificationCallIdApplicationNotifyTypeMentionsUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = sendCallNotificationCallIdApplicationNotifyTypeMentionsUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - sendCallNotificationCallIdApplicationNotifyTypeMentionsUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - sendCallNotificationCallIdApplicationNotifyTypeMentionsUnderlyingCallsCount = newValue - } - } - } - } - open var sendCallNotificationCallIdApplicationNotifyTypeMentionsCalled: Bool { - return sendCallNotificationCallIdApplicationNotifyTypeMentionsCallsCount > 0 - } - open var sendCallNotificationCallIdApplicationNotifyTypeMentionsReceivedArguments: (callId: String, application: RtcApplicationType, notifyType: NotifyType, mentions: Mentions)? - open var sendCallNotificationCallIdApplicationNotifyTypeMentionsReceivedInvocations: [(callId: String, application: RtcApplicationType, notifyType: NotifyType, mentions: Mentions)] = [] - open var sendCallNotificationCallIdApplicationNotifyTypeMentionsClosure: ((String, RtcApplicationType, NotifyType, Mentions) async throws -> Void)? - - open override func sendCallNotification(callId: String, application: RtcApplicationType, notifyType: NotifyType, mentions: Mentions) async throws { - if let error = sendCallNotificationCallIdApplicationNotifyTypeMentionsThrowableError { - throw error - } - sendCallNotificationCallIdApplicationNotifyTypeMentionsCallsCount += 1 - sendCallNotificationCallIdApplicationNotifyTypeMentionsReceivedArguments = (callId: callId, application: application, notifyType: notifyType, mentions: mentions) - DispatchQueue.main.async { - self.sendCallNotificationCallIdApplicationNotifyTypeMentionsReceivedInvocations.append((callId: callId, application: application, notifyType: notifyType, mentions: mentions)) - } - try await sendCallNotificationCallIdApplicationNotifyTypeMentionsClosure?(callId, application, notifyType, mentions) - } - - //MARK: - sendCallNotificationIfNeeded - - open var sendCallNotificationIfNeededThrowableError: Error? - var sendCallNotificationIfNeededUnderlyingCallsCount = 0 - open var sendCallNotificationIfNeededCallsCount: Int { - get { - if Thread.isMainThread { - return sendCallNotificationIfNeededUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = sendCallNotificationIfNeededUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - sendCallNotificationIfNeededUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - sendCallNotificationIfNeededUnderlyingCallsCount = newValue - } - } - } - } - open var sendCallNotificationIfNeededCalled: Bool { - return sendCallNotificationIfNeededCallsCount > 0 - } - - var sendCallNotificationIfNeededUnderlyingReturnValue: Bool! - open var sendCallNotificationIfNeededReturnValue: Bool! { - get { - if Thread.isMainThread { - return sendCallNotificationIfNeededUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = sendCallNotificationIfNeededUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - sendCallNotificationIfNeededUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - sendCallNotificationIfNeededUnderlyingReturnValue = newValue - } - } - } - } - open var sendCallNotificationIfNeededClosure: (() async throws -> Bool)? - - open override func sendCallNotificationIfNeeded() async throws -> Bool { - if let error = sendCallNotificationIfNeededThrowableError { - throw error - } - sendCallNotificationIfNeededCallsCount += 1 - if let sendCallNotificationIfNeededClosure = sendCallNotificationIfNeededClosure { - return try await sendCallNotificationIfNeededClosure() - } else { - return sendCallNotificationIfNeededReturnValue - } - } - //MARK: - sendLiveLocation open var sendLiveLocationGeoUriThrowableError: Error? @@ -15766,6 +15768,52 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable { try await setNameNameClosure?(name) } + //MARK: - setThreadSubscription + + open var setThreadSubscriptionThreadRootEventIdSubscribedThrowableError: Error? + var setThreadSubscriptionThreadRootEventIdSubscribedUnderlyingCallsCount = 0 + open var setThreadSubscriptionThreadRootEventIdSubscribedCallsCount: Int { + get { + if Thread.isMainThread { + return setThreadSubscriptionThreadRootEventIdSubscribedUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = setThreadSubscriptionThreadRootEventIdSubscribedUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + setThreadSubscriptionThreadRootEventIdSubscribedUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + setThreadSubscriptionThreadRootEventIdSubscribedUnderlyingCallsCount = newValue + } + } + } + } + open var setThreadSubscriptionThreadRootEventIdSubscribedCalled: Bool { + return setThreadSubscriptionThreadRootEventIdSubscribedCallsCount > 0 + } + open var setThreadSubscriptionThreadRootEventIdSubscribedReceivedArguments: (threadRootEventId: String, subscribed: Bool)? + open var setThreadSubscriptionThreadRootEventIdSubscribedReceivedInvocations: [(threadRootEventId: String, subscribed: Bool)] = [] + open var setThreadSubscriptionThreadRootEventIdSubscribedClosure: ((String, Bool) async throws -> Void)? + + open override func setThreadSubscription(threadRootEventId: String, subscribed: Bool) async throws { + if let error = setThreadSubscriptionThreadRootEventIdSubscribedThrowableError { + throw error + } + setThreadSubscriptionThreadRootEventIdSubscribedCallsCount += 1 + setThreadSubscriptionThreadRootEventIdSubscribedReceivedArguments = (threadRootEventId: threadRootEventId, subscribed: subscribed) + DispatchQueue.main.async { + self.setThreadSubscriptionThreadRootEventIdSubscribedReceivedInvocations.append((threadRootEventId: threadRootEventId, subscribed: subscribed)) + } + try await setThreadSubscriptionThreadRootEventIdSubscribedClosure?(threadRootEventId, subscribed) + } + //MARK: - setTopic open var setTopicTopicThrowableError: Error? diff --git a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift index 9eceb8106..d99e01c9a 100644 --- a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift @@ -137,7 +137,6 @@ extension JoinedRoomProxyMock { widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(url) elementCallWidgetDriverDeviceIDReturnValue = widgetDriver - sendCallNotificationIfNeededReturnValue = .success(()) matrixToPermalinkReturnValue = .success(.homeDirectory) matrixToEventPermalinkReturnValue = .success(.homeDirectory) diff --git a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift index 184c6a964..4ee469513 100644 --- a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift +++ b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift @@ -50,7 +50,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol switch configuration.kind { case .genericCallLink(let url): widgetDriver = GenericCallLinkWidgetDriver(url: url) - case .roomCall(let roomProxy, let clientProxy, _, _, _, _, _): + case .roomCall(let roomProxy, let clientProxy, _, _, _, _): guard let deviceID = clientProxy.deviceID else { fatalError("Missing device ID for the call.") } widgetDriver = roomProxy.elementCallWidgetDriver(deviceID: deviceID) } @@ -174,7 +174,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 clientID, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme, let notifyOtherParticipants): + case .roomCall(let roomProxy, _, let clientID, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme): Task { [weak self] in guard let self else { return } @@ -217,10 +217,6 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol await elementCallService.setupCallSession(roomID: roomProxy.id, roomDisplayName: roomProxy.infoPublisher.value.displayName ?? roomProxy.id) - - if notifyOtherParticipants { - _ = await roomProxy.sendCallNotificationIfNeeded() - } } } } diff --git a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift index 10071fe89..9f1fc6bcd 100644 --- a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift +++ b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift @@ -321,7 +321,6 @@ struct CallScreen_Previews: PreviewProvider { clientProxy.deviceID = "call-device-id" let roomProxy = JoinedRoomProxyMock() - roomProxy.sendCallNotificationIfNeededReturnValue = .success(()) let widgetDriver = ElementCallWidgetDriverMock() widgetDriver.underlyingMessagePublisher = .init() @@ -336,8 +335,7 @@ struct CallScreen_Previews: PreviewProvider { clientID: "io.element.elementx", elementCallBaseURL: "https://call.element.io", elementCallBaseURLOverride: nil, - colorScheme: .light, - notifyOtherParticipants: false), + colorScheme: .light), allowPictureInPicture: false, appHooks: AppHooks(), appSettings: ServiceLocator.shared.settings, diff --git a/ElementX/Sources/Services/ElementCall/ElementCallConfiguration.swift b/ElementX/Sources/Services/ElementCall/ElementCallConfiguration.swift index b23f77ea6..685e73d23 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallConfiguration.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallConfiguration.swift @@ -21,8 +21,7 @@ struct ElementCallConfiguration { clientID: String, elementCallBaseURL: URL, elementCallBaseURLOverride: URL?, - colorScheme: ColorScheme, - notifyOtherParticipants: Bool) + colorScheme: ColorScheme) } /// The type of call being configured i.e. whether it's an external URL or an internal room call. @@ -59,15 +58,13 @@ struct ElementCallConfiguration { clientID: String, elementCallBaseURL: URL, elementCallBaseURLOverride: URL?, - colorScheme: ColorScheme, - notifyOtherParticipants: Bool) { + colorScheme: ColorScheme) { kind = .roomCall(roomProxy: roomProxy, clientProxy: clientProxy, clientID: clientID, elementCallBaseURL: elementCallBaseURL, elementCallBaseURLOverride: elementCallBaseURLOverride, - colorScheme: colorScheme, - notifyOtherParticipants: notifyOtherParticipants) + colorScheme: colorScheme) } /// A string representing the call being configured. @@ -75,7 +72,7 @@ struct ElementCallConfiguration { switch kind { case .genericCallLink(let url): url.absoluteString - case .roomCall(let roomProxy, _, _, _, _, _, _): + case .roomCall(let roomProxy, _, _, _, _, _): roomProxy.id } } diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift index 0824a7703..fb7ccbf8f 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift @@ -75,30 +75,32 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv return .failure(.roomInvalid) } - let useEncryption = await (try? room.latestEncryptionState() == .encrypted) ?? false + async let useEncryption = (try? room.latestEncryptionState() == .encrypted) ?? false + async let isDirect = room.isDirect() let widgetSettings: WidgetSettings do { - widgetSettings = try newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString, - widgetId: widgetID, - parentUrl: nil, - header: .appBar, - hideHeader: true, - preload: nil, - fontScale: nil, - appPrompt: false, - confineToRoom: true, - font: nil, - encryption: useEncryption ? .perParticipantKeys : .unencrypted, - intent: .startCall, - hideScreensharing: false, - posthogUserId: nil, - posthogApiHost: analyticsConfiguration?.posthogAPIHost, - posthogApiKey: analyticsConfiguration?.posthogAPIKey, - rageshakeSubmitUrl: rageshakeURL, - sentryDsn: analyticsConfiguration?.sentryDSN, - sentryEnvironment: nil, - controlledMediaDevices: !ProcessInfo.processInfo.isiOSAppOnMac)) + widgetSettings = try await newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString, + widgetId: widgetID, + parentUrl: nil, + header: .appBar, + hideHeader: true, + preload: nil, + fontScale: nil, + appPrompt: false, + confineToRoom: true, + font: nil, + encryption: useEncryption ? .perParticipantKeys : .unencrypted, + intent: .startCall, + hideScreensharing: false, + posthogUserId: nil, + posthogApiHost: analyticsConfiguration?.posthogAPIHost, + posthogApiKey: analyticsConfiguration?.posthogAPIKey, + rageshakeSubmitUrl: rageshakeURL, + sentryDsn: analyticsConfiguration?.sentryDSN, + sentryEnvironment: nil, + controlledMediaDevices: !ProcessInfo.processInfo.isiOSAppOnMac, + sendNotificationType: isDirect ? .ring : .notification)) } catch { MXLog.error("Failed to build widget settings: \(error)") return .failure(.failedBuildingWidgetSettings) diff --git a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift index cc9f63f5a..d82ad6aa8 100644 --- a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift +++ b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift @@ -639,16 +639,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { ElementCallWidgetDriver(room: room, deviceID: deviceID) } - func sendCallNotificationIfNeeded() async -> Result { - do { - _ = try await room.sendCallNotificationIfNeeded() - return .success(()) - } catch { - MXLog.error("Failed room call notification with error: \(error)") - return .failure(.sdkError(error)) - } - } - // MARK: - Permalinks func matrixToPermalink() async -> Result { diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index 9a9ad459f..5203ff1ac 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -168,7 +168,6 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { // MARK: - Element Call func elementCallWidgetDriver(deviceID: String) -> ElementCallWidgetDriverProtocol - func sendCallNotificationIfNeeded() async -> Result // MARK: - Permalinks diff --git a/project.yml b/project.yml index 471e5f58d..307960e8e 100644 --- a/project.yml +++ b/project.yml @@ -68,7 +68,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 25.07.29 + exactVersion: 25.08.01 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios @@ -80,7 +80,7 @@ packages: # path: ../matrix-analytics-events EmbeddedElementCall: url: https://github.com/element-hq/element-call-swift - exactVersion: 0.13.1 + exactVersion: 0.14.0 Emojibase: url: https://github.com/matrix-org/emojibase-bindings minorVersion: 1.4.2