InterceptDefinition
Defines an intercept guard that applies to all navigation into a group of graphs, including deep links.
When NavigationGraphBuilder.intercept blocks are nested, the guards are chained so that the outermost guard always runs first. Navigation proceeds only when every guard in the chain returns GuardResult.Allow. The first non-Allow result stops evaluation immediately — inner guards are never called.
The chain is accumulated during graph construction via prependOuter and stored in outerGuards (outermost first). At runtime NavigationLogic iterates outerGuards before evaluating guard (the innermost guard).
Example — three-level chain (startup → auth → premium):
intercept(guard = { store ->
if (store.selectState<AppState>().value.startupReady) GuardResult.Allow
else GuardResult.Reject
}) {
intercept(guard = { store ->
if (store.selectState<AuthState>().value.isAuthenticated) GuardResult.Allow
else GuardResult.RedirectTo(loginScreen)
}) {
intercept(guard = { store ->
if (store.selectState<AuthState>().value.hasPremium) GuardResult.Allow
else GuardResult.RedirectTo(upgradeScreen)
}) {
graph("premium") {
entry(premiumHome)
screens(premiumHome)
}
}
}
}Created by the NavigationGraphBuilder.intercept DSL method.
Parameters
The innermost guard evaluated last in the chain; returns a GuardResult decision
How long to wait before showing the global loading modal (default 200ms)
Outer guards accumulated during graph construction, evaluated outermost-first