Files
jrshikoku/lib/appContainerPolicy.ts

25 lines
748 B
TypeScript

import type { RootTabParamList } from "../types/navigation";
export type RootRouteName = keyof RootTabParamList | null;
type StartupInitialRouteInput = {
hasExplicitTarget: boolean;
startPageSetting: unknown;
};
/**
* Resolve the tab mounted before imperative startup navigation runs.
*
* An explicit deep link/notification target keeps the neutral top menu as the
* initial route so the imperative handler can choose the final nested route.
*/
export const resolveStartupInitialRoute = ({
hasExplicitTarget,
startPageSetting,
}: StartupInitialRouteInput): keyof RootTabParamList => {
if (hasExplicitTarget) return "topMenu";
return startPageSetting === true || startPageSetting === "true"
? "positions"
: "topMenu";
};