feat(FN-3400): add native shell connection handoff, plugin management CLI/l
This merge adds a complete plugin management system (FN-3565) with CLI commands, a loader, runner, and dashboard routes, along with project-scoped auth storage (FN-3544), native shell connection support for mobile (FN-3400) spanning onboarding, connection manager, and remote desktop handoff, and ref Fusion-Task-Id: FN-3400
This commit is contained in:
@@ -5,6 +5,7 @@ export interface ShellContextValue {
|
||||
shellApi: FusionShellApi | null;
|
||||
state: ShellConnectionState;
|
||||
ready: boolean;
|
||||
openConnectionManagerSignal: number;
|
||||
}
|
||||
|
||||
const DEFAULT_STATE: ShellConnectionState = {
|
||||
@@ -17,12 +18,14 @@ const ShellContext = createContext<ShellContextValue>({
|
||||
shellApi: null,
|
||||
state: DEFAULT_STATE,
|
||||
ready: true,
|
||||
openConnectionManagerSignal: 0,
|
||||
});
|
||||
|
||||
export function ShellProvider({ children }: PropsWithChildren) {
|
||||
const shellApi = useMemo(() => (typeof window !== "undefined" ? window.fusionShell ?? null : null), []);
|
||||
const [state, setState] = useState<ShellConnectionState>(DEFAULT_STATE);
|
||||
const [ready, setReady] = useState(!shellApi);
|
||||
const [openConnectionManagerSignal, setOpenConnectionManagerSignal] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (!shellApi) {
|
||||
@@ -41,13 +44,19 @@ export function ShellProvider({ children }: PropsWithChildren) {
|
||||
setState(nextState);
|
||||
});
|
||||
|
||||
const handleOpenConnectionManager = () => {
|
||||
setOpenConnectionManagerSignal((value) => value + 1);
|
||||
};
|
||||
window.addEventListener("shell:open-connection-manager", handleOpenConnectionManager);
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
unsubscribe();
|
||||
window.removeEventListener("shell:open-connection-manager", handleOpenConnectionManager);
|
||||
};
|
||||
}, [shellApi]);
|
||||
|
||||
return <ShellContext.Provider value={{ shellApi, state, ready }}>{children}</ShellContext.Provider>;
|
||||
return <ShellContext.Provider value={{ shellApi, state, ready, openConnectionManagerSignal }}>{children}</ShellContext.Provider>;
|
||||
}
|
||||
|
||||
export function useShellContext(): ShellContextValue {
|
||||
|
||||
Reference in New Issue
Block a user