Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FXIOS-10386 #22756 Add debug logs for handling route (backport #24218) #24466

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion firefox-ios/Client/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
logger.log("Scene coordinator will handle a route", level: .info, category: .coordinator)
sessionManager.launchSessionProvider.openedFromExternalSource = true

AppEventQueue.wait(for: [.startupFlowComplete, .tabRestoration(sceneCoordinator.windowUUID)]) {
AppEventQueue.wait(for: [.startupFlowComplete, .tabRestoration(sceneCoordinator.windowUUID)]) { [weak self] in
self?.logger.log("Start up flow and restoration done, will handle route",
level: .info,
category: .coordinator)
sceneCoordinator.findAndHandle(route: route)
}
}
Expand Down
7 changes: 6 additions & 1 deletion firefox-ios/Client/Coordinators/BaseCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ open class BaseCoordinator: NSObject, Coordinator {
for child in matchingCoordinator.childCoordinators {
guard child.isDismissable else { continue }

logger.log("Dismissing child of the matching coordinator", level: .debug, category: .coordinator)
matchingCoordinator.router.dismiss()
matchingCoordinator.remove(child: child)
}
Expand All @@ -64,6 +65,7 @@ open class BaseCoordinator: NSObject, Coordinator {
func find(route: Route) -> Coordinator? {
// Check if the current coordinator can handle the route.
if canHandle(route: route) {
logger.log("Can handle the route with \(self)", level: .debug, category: .coordinator)
savedRoute = nil
return self
}
Expand All @@ -73,13 +75,16 @@ open class BaseCoordinator: NSObject, Coordinator {
if let matchingCoordinator = childCoordinator.find(route: route) {
savedRoute = nil

logger.log("Can handle route with child coordinator \(matchingCoordinator)",
level: .debug,
category: .coordinator)
return matchingCoordinator
}
}

// If no matching coordinator is found, return nil and save the Route to be passed along when it next navigates
savedRoute = route
logger.log("Saved a route", level: .info, category: .coordinator)
logger.log("No coordinator found, saved a route", level: .info, category: .coordinator)
return nil
}
}