#5504 - Add logs around route handling and the global search window presentation

This commit is contained in:
Stefan Ceriu
2026-04-30 09:12:32 +03:00
parent 0502df0a85
commit 0ec114d2f3
9 changed files with 32 additions and 2 deletions
@@ -241,6 +241,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
} }
func handleAppRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType?) { func handleAppRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType?) {
MXLog.info("Handling app route: \(appRoute)")
if let windowType { if let windowType {
windowManager.handleRoute(appRoute, windowType: windowType) windowManager.handleRoute(appRoute, windowType: windowType)
return return
@@ -83,9 +83,14 @@ class WindowManager: SecureWindowManagerProtocol {
} }
func handleRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType) { func handleRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType) {
if let flowCoordinator = coordinators[windowType]?.flowCoordinator { MXLog.info("Handling app route: \(appRoute) for window type: \(windowType)")
flowCoordinator.handleAppRoute(appRoute, animated: true)
guard let flowCoordinator = coordinators[windowType]?.flowCoordinator else {
MXLog.error("Invalid flow coordinator")
return
} }
flowCoordinator.handleAppRoute(appRoute, animated: true)
} }
func switchToMain() { func switchToMain() {
@@ -126,7 +131,10 @@ class WindowManager: SecureWindowManagerProtocol {
} }
func showGlobalSearch() { func showGlobalSearch() {
MXLog.info("Received global search presentation request.")
guard alternateWindow.isHidden else { guard alternateWindow.isHidden else {
MXLog.info("The alternate window is visible, ignoring.")
return return
} }
@@ -142,7 +150,10 @@ class WindowManager: SecureWindowManagerProtocol {
} }
func hideGlobalSearch() { func hideGlobalSearch() {
MXLog.info("Received global search dismissal request.")
guard alternateWindow.isHidden else { guard alternateWindow.isHidden else {
MXLog.info("The alternate window is visible, ignoring.")
return return
} }
@@ -163,7 +174,10 @@ class WindowManager: SecureWindowManagerProtocol {
// MARK: - Secondary window support // MARK: - Secondary window support
func windowForType(_ type: SecondaryWindowType) -> AnyView { func windowForType(_ type: SecondaryWindowType) -> AnyView {
MXLog.info("Requesting window for type: \(type)")
guard let coordinator = coordinators[type]?.coordinator else { guard let coordinator = coordinators[type]?.coordinator else {
MXLog.error("Invalid coordinator for window type: \(type)")
return AnyView(InstantlyDismissingWindow()) return AnyView(InstantlyDismissingWindow())
} }
@@ -137,6 +137,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
} }
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute { switch appRoute {
case .accountProvisioningLink(let provisioningParameters): case .accountProvisioningLink(let provisioningParameters):
guard appSettings.allowOtherAccountProviders else { guard appSettings.allowOtherAccountProviders else {
@@ -84,6 +84,8 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
// MARK: - FlowCoordinatorProtocol // MARK: - FlowCoordinatorProtocol
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
Task { Task {
await asyncHandleAppRoute(appRoute, animated: animated) await asyncHandleAppRoute(appRoute, animated: animated)
} }
@@ -77,6 +77,8 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
} }
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute { switch appRoute {
case .accountProvisioningLink: case .accountProvisioningLink:
break // We always ignore this flow when logged in. break // We always ignore this flow when logged in.
@@ -121,6 +121,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
// swiftlint:disable:next cyclomatic_complexity // swiftlint:disable:next cyclomatic_complexity
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
guard stateMachine.state != .complete else { guard stateMachine.state != .complete else {
fatalError("This flow coordinator is `finished` ☠️") fatalError("This flow coordinator is `finished` ☠️")
} }
@@ -97,6 +97,8 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
} }
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute { switch appRoute {
case .roomMemberDetails(let userID): case .roomMemberDetails(let userID):
if case .roomFlow = stateMachine.state, let childFlowCoordinator { if case .roomFlow = stateMachine.state, let childFlowCoordinator {
@@ -51,6 +51,8 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
} }
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute { switch appRoute {
case .settings: case .settings:
presentSettingsScreen(animated: animated) presentSettingsScreen(animated: animated)
@@ -118,6 +118,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
} }
func handleAppRoute(_ appRoute: AppRoute, animated: Bool) { func handleAppRoute(_ appRoute: AppRoute, animated: Bool) {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute { switch appRoute {
case .accountProvisioningLink: case .accountProvisioningLink:
break // We always ignore this flow when logged in. break // We always ignore this flow when logged in.