-
public final class NavigationInterceptorSPEC-070-A A.10 — Per-screen interception hook list. Mirrors iOS
Screens/NavigationInterceptor.swift:5-58.Architecture:
Activity-driven path:
Application.registerActivityLifecycleCallbackswired inAppDNA.configure()invokesevaluateInterceptions(activity.javaClass.simpleName)ononActivityResumed. Equivalent of iOS'viewDidAppearswizzle.Compose-only path: hosts call
AppDNA.notifyScreenAppeared("Home")fromNavHostroute changes (composables don't have an Activity per screen). SameevaluateInterceptionsruns.
Hooks are stored per-screen-name. Registering the same screen name twice replaces the prior hook (iOS parity).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classNavigationInterceptor.Companion
-
Method Summary
Modifier and Type Method Description final UnitregisterHook(String screenName, SuspendFunction1<String, InterceptionResult> evaluate)Register a hook that fires when screenNameappears.final UnitunregisterHook(String screenName)Remove the hook for screenNameif any.final InterceptionResultevaluateInterceptions(String screenName)Evaluate all matching hooks in registration order. final UnitnotifyScreenAppeared(String screenName)Compose-only manual notification path. -
-
Method Detail
-
registerHook
final Unit registerHook(String screenName, SuspendFunction1<String, InterceptionResult> evaluate)
Register a hook that fires when
screenNameappears. Replaces any prior hook for the same name.
-
unregisterHook
final Unit unregisterHook(String screenName)
Remove the hook for
screenNameif any.
-
evaluateInterceptions
final InterceptionResult evaluateInterceptions(String screenName)
Evaluate all matching hooks in registration order. Returns the first non-
Allowresult, orAllowif every hook permits the navigation. Returnsnullonly when consent has been revoked.Suspend function — hook bodies may call into network / Firestore. Must be invoked from a coroutine (e.g.
lifecycleScope.launch { NavigationInterceptor.shared.evaluateInterceptions(...) }).
-
notifyScreenAppeared
final Unit notifyScreenAppeared(String screenName)
Compose-only manual notification path. Equivalent of iOS swizzle triggering
viewDidAppear.
-
-
-
-