Skip to content

armgit / pibot

Public Imported from GitHub
0

Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.

778 B
Raw Blame
import { useRootNavigationState, useRouter } from "expo-router";
import { useShareIntentContext } from "expo-share-intent";
import { useEffect } from "react";
import { useMobileSelector } from "../../runtime/context.tsx";

/** Opens the share screen when another app shares into Pi Bot, once paired. */
export function ShareIntentGate() {
  const share = useShareIntentContext(),
    mobile = useMobileSelector((s) => ({ ready: s.ready, devices: s.devices })),
    router = useRouter(),
    navigation = useRootNavigationState();
  useEffect(() => {
    if (navigation?.key && share.hasShareIntent && mobile.ready && mobile.devices.length)
      router.push("/share");
  }, [navigation?.key, share.hasShareIntent, mobile.ready, mobile.devices.length, router]);
  return null;
}