diff --git a/mobile/src/components/MobileHtmlPreview.tsx b/mobile/src/components/MobileHtmlPreview.tsx index 335d2600ff9..dfee78b49c6 100644 --- a/mobile/src/components/MobileHtmlPreview.tsx +++ b/mobile/src/components/MobileHtmlPreview.tsx @@ -1,7 +1,8 @@ import { useState } from 'react' -import { Linking, Pressable, StyleSheet, Text, View } from 'react-native' +import { Pressable, StyleSheet, Text, View } from 'react-native' import { WebView } from 'react-native-webview' import { Code, Eye } from 'lucide-react-native' +import { openExternalLink } from '../platform/external-link' import { colors, spacing, typography } from '../theme/mobile-theme' type Props = { @@ -50,7 +51,7 @@ export function MobileHtmlPreview({ html, renderSource }: Props) { if (request.url === 'about:blank' || request.url.startsWith('data:')) { return true } - void Linking.openURL(request.url).catch(() => {}) + openExternalLink(request.url) return false }} /> diff --git a/mobile/src/components/MobileRichMarkdownEditor.tsx b/mobile/src/components/MobileRichMarkdownEditor.tsx index 2ad299170ea..b19a1bd0b56 100644 --- a/mobile/src/components/MobileRichMarkdownEditor.tsx +++ b/mobile/src/components/MobileRichMarkdownEditor.tsx @@ -8,7 +8,8 @@ import { type ComponentType, type ForwardedRef } from 'react' -import { Keyboard, Linking, Pressable, ScrollView, StyleSheet, View } from 'react-native' +import { Keyboard, Pressable, ScrollView, StyleSheet, View } from 'react-native' +import { openExternalLink } from '../platform/external-link' import { Bold, Code2, @@ -109,7 +110,7 @@ function MobileRichMarkdownEditorInner( onOpenLink(url) return } - void Linking.openURL(url).catch(() => {}) + openExternalLink(url) }, [onOpenLink] ) diff --git a/mobile/src/session/use-mobile-session-file-actions.ts b/mobile/src/session/use-mobile-session-file-actions.ts index 56aa2b049d8..f34d8721e57 100644 --- a/mobile/src/session/use-mobile-session-file-actions.ts +++ b/mobile/src/session/use-mobile-session-file-actions.ts @@ -1,5 +1,5 @@ import { useRef, useCallback } from 'react' -import { Linking } from 'react-native' +import { openExternalLink } from '../platform/external-link' import { useMobileFileTapHandlers } from './use-mobile-file-tap-handlers' import { resolveMobileNativeChatFileSessionId } from './mobile-native-chat-eligibility' import { activateOpenedSourceControlDiffTab } from './opened-mobile-session-tab' @@ -92,7 +92,7 @@ export function useMobileSessionFileActions(scope: MobileSessionTerminalSendActi // Why: browser.tabCreate resolves a real worktree, which the floating // sentinel doesn't have — open taps in the phone browser instead. if (terminalLinkOpenMode === 'phone-browser' || isFloatingWorkspaceRoute) { - void Linking.openURL(url).catch(() => {}) + openExternalLink(url) return } void handleCreateBrowserRef.current?.(url)