Show ElementCalls in the system Recents list and allow deep linking back into a call from there

This commit is contained in:
Stefan Ceriu
2024-05-27 12:49:24 +03:00
committed by Stefan Ceriu
parent 16fc7caa62
commit f6c476eeca
10 changed files with 43 additions and 18 deletions
@@ -17,6 +17,7 @@
import AnalyticsEvents
import BackgroundTasks
import Combine
import Intents
import MatrixRustSDK
import SwiftUI
import Version
@@ -236,6 +237,20 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
return false
}
func handleUserActivity(_ userActivity: NSUserActivity) {
// `INStartVideoCallIntent` is to be replaced with `INStartCallIntent`
// but calls from Recents still send it ¯\_(ツ)_/¯
guard let intent = userActivity.interaction?.intent as? INStartVideoCallIntent,
let contact = intent.contacts?.first,
let roomIdentifier = contact.personHandle?.value else {
MXLog.error("Failed retrieving information from userActivity: \(userActivity)")
return
}
MXLog.info("Starting call in room: \(roomIdentifier)")
handleAppRoute(AppRoute.call(roomID: roomIdentifier))
}
// MARK: - AuthenticationFlowCoordinatorDelegate
func authenticationFlowCoordinator(didLoginWithSession userSession: UserSessionProtocol) {
@@ -18,5 +18,8 @@ import Foundation
protocol AppCoordinatorProtocol: CoordinatorProtocol {
var windowManager: SecureWindowManagerProtocol { get }
@discardableResult func handleDeepLink(_ url: URL, isExternalURL: Bool) -> Bool
func handleUserActivity(_ userActivity: NSUserActivity)
}
@@ -51,6 +51,11 @@ struct Application: App {
openURLInSystemBrowser($0)
}
}
.onContinueUserActivity("INStartVideoCallIntent", perform: { userActivity in
// `INStartVideoCallIntent` is to be replaced with `INStartCallIntent`
// but calls from Recents still send it ¯\_(ツ)_/¯
appCoordinator.handleUserActivity(userActivity)
})
.task {
appCoordinator.start()
}