The best way to control Claude Code, Codex and more from any computer or phone

main
ts 22 lines 862 Bytes
Raw
1 import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
2 import { Platform, Share } from "react-native";
3 import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
4
5 interface PullRequestLink {
6 readonly url: string;
7 readonly title: string;
8 readonly provider: string;
9 }
10
11 export function copyPullRequestLink(pr: PullRequestLink) {
12 copyTextWithHaptic(pr.url, {
13 target: `${sourceControlClients.get(pr.provider).changeRequest.singular} link`,
14 });
15 }
16
17 export function sharePullRequestLink(pr: PullRequestLink) {
18 // Android ignores `url`; iOS turns a `message` URL into plain text instead of a link preview.
19 Share.share(
20 Platform.OS === "ios" ? { url: pr.url, title: pr.title } : { message: pr.url, title: pr.title },
21 ).catch((cause: unknown) => console.error("Failed to share pull request link.", cause));
22 }