mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Generic element call link support (#1643)
* Remove swift-url-routing and replace it with a custom implementation. It fails parsing the fragments in app.element.io links and it doesn't bring any value * Add handling for opening generic element call links * Add applinks support for call.element.io * Enable VoIP and Audio playback background modes
This commit is contained in:
@@ -83,6 +83,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
stateMachine.tryEvent(.dismissRoom, userInfo: EventUserInfo(animated: animated))
|
||||
case .invites:
|
||||
break
|
||||
case .genericCallLink:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,27 +105,22 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
|
||||
// MARK: - FlowCoordinatorProtocol
|
||||
|
||||
|
||||
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
|
||||
// Tidy up any state before applying the new route.
|
||||
switch stateMachine.state {
|
||||
case .initial, .migration:
|
||||
return // Not ready to handle a route.
|
||||
case .roomList:
|
||||
break // Nothing to tidy up on the home screen.
|
||||
case .feedbackScreen, .sessionVerificationScreen, .settingsScreen, .startChatScreen, .invitesScreen, .welcomeScreen:
|
||||
navigationSplitCoordinator.setSheetCoordinator(nil, animated: animated)
|
||||
}
|
||||
|
||||
// Apply the route.
|
||||
switch appRoute {
|
||||
case .room, .roomDetails, .roomList:
|
||||
roomFlowCoordinator.handleAppRoute(appRoute, animated: animated)
|
||||
case .invites:
|
||||
if UIDevice.current.isPhone {
|
||||
roomFlowCoordinator.clearRoute(animated: animated)
|
||||
clearPresentedSheets(animated: animated) { [weak self] in
|
||||
guard let self else { return }
|
||||
|
||||
switch appRoute {
|
||||
case .room, .roomDetails, .roomList:
|
||||
self.roomFlowCoordinator.handleAppRoute(appRoute, animated: animated)
|
||||
case .invites:
|
||||
if UIDevice.current.isPhone {
|
||||
self.roomFlowCoordinator.clearRoute(animated: animated)
|
||||
}
|
||||
self.stateMachine.processEvent(.showInvitesScreen, userInfo: .init(animated: animated))
|
||||
case .genericCallLink(let url):
|
||||
self.navigationSplitCoordinator.setSheetCoordinator(GenericCallLinkCoordinator(parameters: .init(url: url)), animated: animated)
|
||||
}
|
||||
stateMachine.processEvent(.showInvitesScreen, userInfo: .init(animated: animated))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +130,20 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func clearPresentedSheets(animated: Bool, completion: @escaping () -> Void) {
|
||||
if navigationSplitCoordinator.sheetCoordinator == nil {
|
||||
completion()
|
||||
return
|
||||
}
|
||||
|
||||
navigationSplitCoordinator.setSheetCoordinator(nil, animated: animated)
|
||||
|
||||
// Prevents system crashes when presenting a sheet if another one was already shown
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
|
||||
completion()
|
||||
}
|
||||
}
|
||||
|
||||
private func setupStateMachine() {
|
||||
stateMachine.addTransitionHandler { [weak self] context in
|
||||
guard let self else { return }
|
||||
|
||||
Reference in New Issue
Block a user