Skip to content

Commit

Permalink
Add FXIOS-10386 #22756 Add debug logs for handling route (backport #2…
Browse files Browse the repository at this point in the history
…4218) (#24466)

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

Adding logs

(cherry picked from commit 1390006)

Co-authored-by: lmarceau <[email protected]>
  • Loading branch information
mergify[bot] and lmarceau authored Feb 7, 2025
1 parent 0924542 commit 36615e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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
}
}

0 comments on commit 36615e2

Please sign in to comment.