Add `packages/app/src/constants/platform.ts` with canonical gates (isWeb, isNative, getIsElectron) and refactor all ~100 ad-hoc Platform.OS checks across 69 files to use shared imports. Fix sidebar hover crash on native (onPointerEnter → onHoverIn), fix tooltip to use breakpoint instead of platform detection, make sidebar action buttons always visible on native where hover doesn't work, and document the platform gating decision matrix in CLAUDE.md.
19 lines
464 B
TypeScript
19 lines
464 B
TypeScript
import * as Linking from "expo-linking";
|
|
import { getDesktopHost } from "@/desktop/host";
|
|
import { isWeb } from "@/constants/platform";
|
|
|
|
export async function openExternalUrl(url: string): Promise<void> {
|
|
if (isWeb) {
|
|
const opener = getDesktopHost()?.opener?.openUrl;
|
|
if (typeof opener === "function") {
|
|
await opener(url);
|
|
return;
|
|
}
|
|
|
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
return;
|
|
}
|
|
|
|
await Linking.openURL(url);
|
|
}
|