mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Delegate the sending of call notifications to Element Call (#4370)
* Stop sending call notifications manually The Element Call widget can now assume responsibility for sending them when you start a call. * Bump Element Call embedded package to v0.14.0 * Delegate the sending of call notifications to Element Call * Update the SDK. * Use 'is' prefix for boolean --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -9052,7 +9052,7 @@
|
|||||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 25.07.29;
|
version = 25.08.01;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||||
@@ -9068,7 +9068,7 @@
|
|||||||
repositoryURL = "https://github.com/element-hq/element-call-swift";
|
repositoryURL = "https://github.com/element-hq/element-call-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 0.13.1;
|
version = 0.14.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
||||||
|
|||||||
@@ -59,8 +59,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/element-hq/element-call-swift",
|
"location" : "https://github.com/element-hq/element-call-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "dc273bd1fbb08c41ab517574b39c23ef667718c9",
|
"revision" : "5cfbd1b1d7fb5c3333dd9a8a43130e875a8ec56b",
|
||||||
"version" : "0.13.1"
|
"version" : "0.14.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -158,8 +158,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "98e28f3ad2b54525f6abb17ab8e2ad49e6bf3614",
|
"revision" : "7e51369bc9407e15295bfa94b96703063c7b7156",
|
||||||
"version" : "25.7.29"
|
"version" : "25.8.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
case .userProfile(let userID):
|
case .userProfile(let userID):
|
||||||
stateMachine.processEvent(.showUserProfileScreen(userID: userID), userInfo: .init(animated: animated))
|
stateMachine.processEvent(.showUserProfileScreen(userID: userID), userInfo: .init(animated: animated))
|
||||||
case .call(let roomID):
|
case .call(let roomID):
|
||||||
Task { await presentCallScreen(roomID: roomID, notifyOtherParticipants: false) }
|
Task { await presentCallScreen(roomID: roomID) }
|
||||||
case .genericCallLink(let url):
|
case .genericCallLink(let url):
|
||||||
presentCallScreen(genericCallLink: url)
|
presentCallScreen(genericCallLink: url)
|
||||||
case .settings, .chatBackupSettings:
|
case .settings, .chatBackupSettings:
|
||||||
@@ -531,8 +531,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .presentCallScreen(let roomProxy):
|
case .presentCallScreen(let roomProxy):
|
||||||
// Here we assume that the app is running and the call state is already up to date
|
presentCallScreen(roomProxy: roomProxy)
|
||||||
presentCallScreen(roomProxy: roomProxy, notifyOtherParticipants: !roomProxy.infoPublisher.value.hasRoomCall)
|
|
||||||
case .verifyUser(let userID):
|
case .verifyUser(let userID):
|
||||||
actionsSubject.send(.sessionVerification(.userInitiator(userID: userID)))
|
actionsSubject.send(.sessionVerification(.userInitiator(userID: userID)))
|
||||||
case .finished:
|
case .finished:
|
||||||
@@ -614,23 +613,22 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
presentCallScreen(configuration: .init(genericCallLink: url))
|
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 {
|
guard case let .joined(roomProxy) = await userSession.clientProxy.roomForIdentifier(roomID) else {
|
||||||
return
|
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
|
let colorScheme: ColorScheme = appMediator.windowManager.mainWindow.traitCollection.userInterfaceStyle == .light ? .light : .dark
|
||||||
presentCallScreen(configuration: .init(roomProxy: roomProxy,
|
presentCallScreen(configuration: .init(roomProxy: roomProxy,
|
||||||
clientProxy: userSession.clientProxy,
|
clientProxy: userSession.clientProxy,
|
||||||
clientID: InfoPlistReader.main.bundleIdentifier,
|
clientID: InfoPlistReader.main.bundleIdentifier,
|
||||||
elementCallBaseURL: appSettings.elementCallBaseURL,
|
elementCallBaseURL: appSettings.elementCallBaseURL,
|
||||||
elementCallBaseURLOverride: appSettings.elementCallBaseURLOverride,
|
elementCallBaseURLOverride: appSettings.elementCallBaseURLOverride,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme))
|
||||||
notifyOtherParticipants: notifyOtherParticipants))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var callScreenPictureInPictureController: AVPictureInPictureController?
|
private var callScreenPictureInPictureController: AVPictureInPictureController?
|
||||||
@@ -833,7 +831,7 @@ class ChatsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
navigationSplitCoordinator.setSheetCoordinator(nil)
|
navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||||
stateMachine.processEvent(.selectRoom(roomID: roomID, via: [], entryPoint: .room))
|
stateMachine.processEvent(.selectRoom(roomID: roomID, via: [], entryPoint: .room))
|
||||||
case .startCall(let roomID):
|
case .startCall(let roomID):
|
||||||
Task { await self.presentCallScreen(roomID: roomID, notifyOtherParticipants: false) }
|
Task { await self.presentCallScreen(roomID: roomID) }
|
||||||
case .dismiss:
|
case .dismiss:
|
||||||
navigationSplitCoordinator.setSheetCoordinator(nil)
|
navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9099,70 +9099,6 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable {
|
|||||||
return elementCallWidgetDriverDeviceIDReturnValue
|
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<Void, RoomProxyError>!
|
|
||||||
var sendCallNotificationIfNeededReturnValue: Result<Void, RoomProxyError>! {
|
|
||||||
get {
|
|
||||||
if Thread.isMainThread {
|
|
||||||
return sendCallNotificationIfNeededUnderlyingReturnValue
|
|
||||||
} else {
|
|
||||||
var returnValue: Result<Void, RoomProxyError>? = nil
|
|
||||||
DispatchQueue.main.sync {
|
|
||||||
returnValue = sendCallNotificationIfNeededUnderlyingReturnValue
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnValue!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
if Thread.isMainThread {
|
|
||||||
sendCallNotificationIfNeededUnderlyingReturnValue = newValue
|
|
||||||
} else {
|
|
||||||
DispatchQueue.main.sync {
|
|
||||||
sendCallNotificationIfNeededUnderlyingReturnValue = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var sendCallNotificationIfNeededClosure: (() async -> Result<Void, RoomProxyError>)?
|
|
||||||
|
|
||||||
func sendCallNotificationIfNeeded() async -> Result<Void, RoomProxyError> {
|
|
||||||
sendCallNotificationIfNeededCallsCount += 1
|
|
||||||
if let sendCallNotificationIfNeededClosure = sendCallNotificationIfNeededClosure {
|
|
||||||
return await sendCallNotificationIfNeededClosure()
|
|
||||||
} else {
|
|
||||||
return sendCallNotificationIfNeededReturnValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//MARK: - matrixToPermalink
|
//MARK: - matrixToPermalink
|
||||||
|
|
||||||
var matrixToPermalinkUnderlyingCallsCount = 0
|
var matrixToPermalinkUnderlyingCallsCount = 0
|
||||||
|
|||||||
@@ -991,6 +991,48 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
|||||||
await enableAllSendQueuesEnableClosure?(enable)
|
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
|
//MARK: - encryption
|
||||||
|
|
||||||
var encryptionUnderlyingCallsCount = 0
|
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
|
//MARK: - forget
|
||||||
|
|
||||||
open var forgetThrowableError: Error?
|
open var forgetThrowableError: Error?
|
||||||
@@ -15421,121 +15538,6 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
|||||||
try await saveComposerDraftDraftThreadRootClosure?(draft, threadRoot)
|
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
|
//MARK: - sendLiveLocation
|
||||||
|
|
||||||
open var sendLiveLocationGeoUriThrowableError: Error?
|
open var sendLiveLocationGeoUriThrowableError: Error?
|
||||||
@@ -15766,6 +15768,52 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
|||||||
try await setNameNameClosure?(name)
|
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
|
//MARK: - setTopic
|
||||||
|
|
||||||
open var setTopicTopicThrowableError: Error?
|
open var setTopicTopicThrowableError: Error?
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ extension JoinedRoomProxyMock {
|
|||||||
widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(url)
|
widgetDriver.startBaseURLClientIDColorSchemeRageshakeURLAnalyticsConfigurationReturnValue = .success(url)
|
||||||
|
|
||||||
elementCallWidgetDriverDeviceIDReturnValue = widgetDriver
|
elementCallWidgetDriverDeviceIDReturnValue = widgetDriver
|
||||||
sendCallNotificationIfNeededReturnValue = .success(())
|
|
||||||
|
|
||||||
matrixToPermalinkReturnValue = .success(.homeDirectory)
|
matrixToPermalinkReturnValue = .success(.homeDirectory)
|
||||||
matrixToEventPermalinkReturnValue = .success(.homeDirectory)
|
matrixToEventPermalinkReturnValue = .success(.homeDirectory)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
|||||||
switch configuration.kind {
|
switch configuration.kind {
|
||||||
case .genericCallLink(let url):
|
case .genericCallLink(let url):
|
||||||
widgetDriver = GenericCallLinkWidgetDriver(url: 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.") }
|
guard let deviceID = clientProxy.deviceID else { fatalError("Missing device ID for the call.") }
|
||||||
widgetDriver = roomProxy.elementCallWidgetDriver(deviceID: deviceID)
|
widgetDriver = roomProxy.elementCallWidgetDriver(deviceID: deviceID)
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
|||||||
state.url = url
|
state.url = url
|
||||||
// We need widget messaging to work before enabling CallKit, otherwise mute, hangup etc do nothing.
|
// 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
|
Task { [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
@@ -217,10 +217,6 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
|||||||
|
|
||||||
await elementCallService.setupCallSession(roomID: roomProxy.id,
|
await elementCallService.setupCallSession(roomID: roomProxy.id,
|
||||||
roomDisplayName: roomProxy.infoPublisher.value.displayName ?? roomProxy.id)
|
roomDisplayName: roomProxy.infoPublisher.value.displayName ?? roomProxy.id)
|
||||||
|
|
||||||
if notifyOtherParticipants {
|
|
||||||
_ = await roomProxy.sendCallNotificationIfNeeded()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,7 +321,6 @@ struct CallScreen_Previews: PreviewProvider {
|
|||||||
clientProxy.deviceID = "call-device-id"
|
clientProxy.deviceID = "call-device-id"
|
||||||
|
|
||||||
let roomProxy = JoinedRoomProxyMock()
|
let roomProxy = JoinedRoomProxyMock()
|
||||||
roomProxy.sendCallNotificationIfNeededReturnValue = .success(())
|
|
||||||
|
|
||||||
let widgetDriver = ElementCallWidgetDriverMock()
|
let widgetDriver = ElementCallWidgetDriverMock()
|
||||||
widgetDriver.underlyingMessagePublisher = .init()
|
widgetDriver.underlyingMessagePublisher = .init()
|
||||||
@@ -336,8 +335,7 @@ struct CallScreen_Previews: PreviewProvider {
|
|||||||
clientID: "io.element.elementx",
|
clientID: "io.element.elementx",
|
||||||
elementCallBaseURL: "https://call.element.io",
|
elementCallBaseURL: "https://call.element.io",
|
||||||
elementCallBaseURLOverride: nil,
|
elementCallBaseURLOverride: nil,
|
||||||
colorScheme: .light,
|
colorScheme: .light),
|
||||||
notifyOtherParticipants: false),
|
|
||||||
allowPictureInPicture: false,
|
allowPictureInPicture: false,
|
||||||
appHooks: AppHooks(),
|
appHooks: AppHooks(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ struct ElementCallConfiguration {
|
|||||||
clientID: String,
|
clientID: String,
|
||||||
elementCallBaseURL: URL,
|
elementCallBaseURL: URL,
|
||||||
elementCallBaseURLOverride: URL?,
|
elementCallBaseURLOverride: URL?,
|
||||||
colorScheme: ColorScheme,
|
colorScheme: ColorScheme)
|
||||||
notifyOtherParticipants: Bool)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of call being configured i.e. whether it's an external URL or an internal room call.
|
/// 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,
|
clientID: String,
|
||||||
elementCallBaseURL: URL,
|
elementCallBaseURL: URL,
|
||||||
elementCallBaseURLOverride: URL?,
|
elementCallBaseURLOverride: URL?,
|
||||||
colorScheme: ColorScheme,
|
colorScheme: ColorScheme) {
|
||||||
notifyOtherParticipants: Bool) {
|
|
||||||
kind = .roomCall(roomProxy: roomProxy,
|
kind = .roomCall(roomProxy: roomProxy,
|
||||||
clientProxy: clientProxy,
|
clientProxy: clientProxy,
|
||||||
clientID: clientID,
|
clientID: clientID,
|
||||||
elementCallBaseURL: elementCallBaseURL,
|
elementCallBaseURL: elementCallBaseURL,
|
||||||
elementCallBaseURLOverride: elementCallBaseURLOverride,
|
elementCallBaseURLOverride: elementCallBaseURLOverride,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme)
|
||||||
notifyOtherParticipants: notifyOtherParticipants)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A string representing the call being configured.
|
/// A string representing the call being configured.
|
||||||
@@ -75,7 +72,7 @@ struct ElementCallConfiguration {
|
|||||||
switch kind {
|
switch kind {
|
||||||
case .genericCallLink(let url):
|
case .genericCallLink(let url):
|
||||||
url.absoluteString
|
url.absoluteString
|
||||||
case .roomCall(let roomProxy, _, _, _, _, _, _):
|
case .roomCall(let roomProxy, _, _, _, _, _):
|
||||||
roomProxy.id
|
roomProxy.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,30 +75,32 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
|
|||||||
return .failure(.roomInvalid)
|
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
|
let widgetSettings: WidgetSettings
|
||||||
|
|
||||||
do {
|
do {
|
||||||
widgetSettings = try newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString,
|
widgetSettings = try await newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString,
|
||||||
widgetId: widgetID,
|
widgetId: widgetID,
|
||||||
parentUrl: nil,
|
parentUrl: nil,
|
||||||
header: .appBar,
|
header: .appBar,
|
||||||
hideHeader: true,
|
hideHeader: true,
|
||||||
preload: nil,
|
preload: nil,
|
||||||
fontScale: nil,
|
fontScale: nil,
|
||||||
appPrompt: false,
|
appPrompt: false,
|
||||||
confineToRoom: true,
|
confineToRoom: true,
|
||||||
font: nil,
|
font: nil,
|
||||||
encryption: useEncryption ? .perParticipantKeys : .unencrypted,
|
encryption: useEncryption ? .perParticipantKeys : .unencrypted,
|
||||||
intent: .startCall,
|
intent: .startCall,
|
||||||
hideScreensharing: false,
|
hideScreensharing: false,
|
||||||
posthogUserId: nil,
|
posthogUserId: nil,
|
||||||
posthogApiHost: analyticsConfiguration?.posthogAPIHost,
|
posthogApiHost: analyticsConfiguration?.posthogAPIHost,
|
||||||
posthogApiKey: analyticsConfiguration?.posthogAPIKey,
|
posthogApiKey: analyticsConfiguration?.posthogAPIKey,
|
||||||
rageshakeSubmitUrl: rageshakeURL,
|
rageshakeSubmitUrl: rageshakeURL,
|
||||||
sentryDsn: analyticsConfiguration?.sentryDSN,
|
sentryDsn: analyticsConfiguration?.sentryDSN,
|
||||||
sentryEnvironment: nil,
|
sentryEnvironment: nil,
|
||||||
controlledMediaDevices: !ProcessInfo.processInfo.isiOSAppOnMac))
|
controlledMediaDevices: !ProcessInfo.processInfo.isiOSAppOnMac,
|
||||||
|
sendNotificationType: isDirect ? .ring : .notification))
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed to build widget settings: \(error)")
|
MXLog.error("Failed to build widget settings: \(error)")
|
||||||
return .failure(.failedBuildingWidgetSettings)
|
return .failure(.failedBuildingWidgetSettings)
|
||||||
|
|||||||
@@ -639,16 +639,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
ElementCallWidgetDriver(room: room, deviceID: deviceID)
|
ElementCallWidgetDriver(room: room, deviceID: deviceID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendCallNotificationIfNeeded() async -> Result<Void, RoomProxyError> {
|
|
||||||
do {
|
|
||||||
_ = try await room.sendCallNotificationIfNeeded()
|
|
||||||
return .success(())
|
|
||||||
} catch {
|
|
||||||
MXLog.error("Failed room call notification with error: \(error)")
|
|
||||||
return .failure(.sdkError(error))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Permalinks
|
// MARK: - Permalinks
|
||||||
|
|
||||||
func matrixToPermalink() async -> Result<URL, RoomProxyError> {
|
func matrixToPermalink() async -> Result<URL, RoomProxyError> {
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol {
|
|||||||
// MARK: - Element Call
|
// MARK: - Element Call
|
||||||
|
|
||||||
func elementCallWidgetDriver(deviceID: String) -> ElementCallWidgetDriverProtocol
|
func elementCallWidgetDriver(deviceID: String) -> ElementCallWidgetDriverProtocol
|
||||||
func sendCallNotificationIfNeeded() async -> Result<Void, RoomProxyError>
|
|
||||||
|
|
||||||
// MARK: - Permalinks
|
// MARK: - Permalinks
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -68,7 +68,7 @@ packages:
|
|||||||
# Element/Matrix dependencies
|
# Element/Matrix dependencies
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||||
exactVersion: 25.07.29
|
exactVersion: 25.08.01
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
url: https://github.com/element-hq/compound-ios
|
url: https://github.com/element-hq/compound-ios
|
||||||
@@ -80,7 +80,7 @@ packages:
|
|||||||
# path: ../matrix-analytics-events
|
# path: ../matrix-analytics-events
|
||||||
EmbeddedElementCall:
|
EmbeddedElementCall:
|
||||||
url: https://github.com/element-hq/element-call-swift
|
url: https://github.com/element-hq/element-call-swift
|
||||||
exactVersion: 0.13.1
|
exactVersion: 0.14.0
|
||||||
Emojibase:
|
Emojibase:
|
||||||
url: https://github.com/matrix-org/emojibase-bindings
|
url: https://github.com/matrix-org/emojibase-bindings
|
||||||
minorVersion: 1.4.2
|
minorVersion: 1.4.2
|
||||||
|
|||||||
Reference in New Issue
Block a user