// // ApplicationRouterDelegate.swift // MullvadVPN // // Created by pronebird on 17/08/2023. // Copyright © 2023 Mullvad VPN AB. All rights reserved. // import Foundation /** Application router delegate */ public protocol ApplicationRouterDelegate: AnyObject, Sendable { associatedtype RouteType: AppRouteProtocol /** Delegate should present the route and pass corresponding `Coordinator` upon completion. */ func applicationRouter( _ router: ApplicationRouter, presentWithContext context: RoutePresentationContext, animated: Bool, completion: @escaping @Sendable (Coordinator) -> Void ) /** Delegate should dismiss the route. */ func applicationRouter( _ router: ApplicationRouter, dismissWithContext context: RouteDismissalContext, completion: @escaping @Sendable () -> Void ) /** Delegate may reconsider if route presentation is still needed. Return `true` to proceed with presenation, otherwise `false` to prevent it. */ func applicationRouter(_ router: ApplicationRouter, shouldPresent route: RouteType) -> Bool /** Delegate may reconsider if route dismissal should be done. Return `true` to proceed with dismissal, otherwise `false` to prevent it. */ func applicationRouter( _ router: ApplicationRouter, shouldDismissWithContext context: RouteDismissalContext ) -> Bool /** Delegate should handle sub-navigation for routes supporting it then call completion to tell router when it's done. */ func applicationRouter( _ router: ApplicationRouter, handleSubNavigationWithContext context: RouteSubnavigationContext, completion: @escaping @Sendable @MainActor () -> Void ) }