From 51d9c4e13ae6bcc89d80aeda43f6ce92810d9f07 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 30 Apr 2026 09:12:32 +0300 Subject: [PATCH] #5504 - Add logs around route handling and the global search window presentation --- .../Sources/Application/AppCoordinator.swift | 2 ++ .../Application/Windowing/WindowManager.swift | 18 ++++++++++++++++-- .../AuthenticationFlowCoordinator.swift | 2 ++ .../ChatsTabFlowCoordinator.swift | 2 ++ .../EncryptionSettingsFlowCoordinator.swift | 2 ++ .../FlowCoordinators/RoomFlowCoordinator.swift | 2 ++ .../RoomMembersFlowCoordinator.swift | 2 ++ .../SettingsFlowCoordinator.swift | 2 ++ .../UserSessionFlowCoordinator.swift | 2 ++ 9 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 04f1629a1..622295c47 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -241,6 +241,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg } func handleAppRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType?) { + MXLog.info("Handling app route: \(appRoute)") + if let windowType { windowManager.handleRoute(appRoute, windowType: windowType) return diff --git a/ElementX/Sources/Application/Windowing/WindowManager.swift b/ElementX/Sources/Application/Windowing/WindowManager.swift index 4b866cb9e..692711e21 100644 --- a/ElementX/Sources/Application/Windowing/WindowManager.swift +++ b/ElementX/Sources/Application/Windowing/WindowManager.swift @@ -83,9 +83,14 @@ class WindowManager: SecureWindowManagerProtocol { } func handleRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType) { - if let flowCoordinator = coordinators[windowType]?.flowCoordinator { - flowCoordinator.handleAppRoute(appRoute, animated: true) + MXLog.info("Handling app route: \(appRoute) for window type: \(windowType)") + + guard let flowCoordinator = coordinators[windowType]?.flowCoordinator else { + MXLog.error("Invalid flow coordinator") + return } + + flowCoordinator.handleAppRoute(appRoute, animated: true) } func switchToMain() { @@ -126,7 +131,10 @@ class WindowManager: SecureWindowManagerProtocol { } func showGlobalSearch() { + MXLog.info("Received global search presentation request.") + guard alternateWindow.isHidden else { + MXLog.info("The alternate window is visible, ignoring.") return } @@ -142,7 +150,10 @@ class WindowManager: SecureWindowManagerProtocol { } func hideGlobalSearch() { + MXLog.info("Received global search dismissal request.") + guard alternateWindow.isHidden else { + MXLog.info("The alternate window is visible, ignoring.") return } @@ -163,7 +174,10 @@ class WindowManager: SecureWindowManagerProtocol { // MARK: - Secondary window support func windowForType(_ type: SecondaryWindowType) -> AnyView { + MXLog.info("Requesting window for type: \(type)") + guard let coordinator = coordinators[type]?.coordinator else { + MXLog.error("Invalid coordinator for window type: \(type)") return AnyView(InstantlyDismissingWindow()) } diff --git a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift index 527cd10e5..1942d469b 100644 --- a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift @@ -137,6 +137,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { } func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + switch appRoute { case .accountProvisioningLink(let provisioningParameters): guard appSettings.allowOtherAccountProviders else { diff --git a/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift index b09d8c6da..1480e6d18 100644 --- a/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift @@ -84,6 +84,8 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol { // MARK: - FlowCoordinatorProtocol func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + Task { await asyncHandleAppRoute(appRoute, animated: animated) } diff --git a/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift index bb93b4a25..e24771e93 100644 --- a/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/EncryptionSettingsFlowCoordinator.swift @@ -77,6 +77,8 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol { } func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + switch appRoute { case .accountProvisioningLink: break // We always ignore this flow when logged in. diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index c7226cd88..8c5abaf98 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -121,6 +121,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { // swiftlint:disable:next cyclomatic_complexity func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + guard stateMachine.state != .complete else { fatalError("This flow coordinator is `finished` ☠️") } diff --git a/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift index 0e8400685..8156c7e0d 100644 --- a/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift @@ -97,6 +97,8 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { } func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + switch appRoute { case .roomMemberDetails(let userID): if case .roomFlow = stateMachine.state, let childFlowCoordinator { diff --git a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift index ffa0f2a6c..6d6bfcc3f 100644 --- a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift @@ -51,6 +51,8 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { } func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + switch appRoute { case .settings: presentSettingsScreen(animated: animated) diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index 25cc3479a..6c34a1854 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -118,6 +118,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { } func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { + MXLog.info("Handling app route: \(appRoute)") + switch appRoute { case .accountProvisioningLink: break // We always ignore this flow when logged in.