@devries-cameron20 / t3code-1 / commits / 6c4758e31c
Fork 0

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

fix(mobile): route all external URL opens through the error-handling helper (#39665)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Neil Daquioag committed Nov 20, 2026 at 03:46 UTC 6c4758e31c379d29d639fd8c34c754782d125a8e
22 files changed +79 -54
apps/mobile/src/features/connection/ConnectionDiagnosisDetails.tsx
+3 -2
@@ -12,7 +12,8 @@ import {
12 import type { EnvironmentId } from "@t3tools/contracts";
13 import Constants from "expo-constants";
14 import { AsyncResult } from "effect/reactivity";
15 -import { Linking, View } from "react-native";
15 +import { View } from "react-native";
16 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
17
18 import { AppText as Text } from "../../components/ui/AppText";
19 import { Button } from "../../components/ui/Button";
@@ -103,7 +104,7 @@ export function ConnectionDiagnosisDetails(props: {
104 label={gt("More info")}
105 icon="safari"
106 tone="secondary"
106 - onPress={() => void Linking.openURL(moreInfoUrl).catch(() => undefined)}
107 + onPress={() => void tryOpenExternalUrl(moreInfoUrl)}
108 />
109 ) : null}
110 </View>
apps/mobile/src/features/issues/IssueRouteScreen.tsx
+4 -3
@@ -15,7 +15,8 @@ import type {
15 import { AsyncResult } from "effect/reactivity";
16 import { T, useGT, useMessages, Var } from "gt-react-native";
17 import { useContext, useState } from "react";
18 -import { Linking, Platform, Pressable, Share, View } from "react-native";
18 +import { Platform, Pressable, Share, View } from "react-native";
19 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
20 import { KeyboardStickyView } from "react-native-keyboard-controller";
21
22 import { RelativeTime } from "../../components/RelativeTime";
@@ -278,7 +279,7 @@ function LinkedPullRequests(props: {
279 ...(props.params.host ? { host: props.params.host } : {}),
280 }),
281 )
281 - : void Linking.openURL(link.url)
282 + : void tryOpenExternalUrl(link.url)
283 }
284 className="flex-row items-center gap-2 rounded-2xl bg-grouped-card p-3 active:opacity-70"
285 >
@@ -592,7 +593,7 @@ function IssueRoute({ params }: { readonly params: IssueParams }) {
593 id: "open-on-host",
594 title: gt("Open on the tracker"),
595 icon: "arrow.up.right",
595 - onPress: () => void Linking.openURL(url),
596 + onPress: () => void tryOpenExternalUrl(url),
597 },
598 {
599 id: "copy-link",
apps/mobile/src/features/projects/suggestAppAccess.ts
+2 -2
@@ -6,7 +6,7 @@ import type {
6 import { appSignInTargetForRemote } from "@t3tools/client-runtime/source-control-clients";
7 import type { AtomCommandResult } from "@t3tools/client-runtime/state/runtime";
8 import { msg } from "gt-react-native";
9 -import { Linking } from "react-native";
9 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
10
11 import * as Dialog from "../../components/ui/Dialog";
12 import { m } from "../../i18n/messages";
@@ -40,7 +40,7 @@ export async function suggestAppAccessForRemote(
40 { text: m(msg("Not now")), style: "cancel" },
41 {
42 text: m(msg("Install", { $context: "verb, installs the GitHub app" })),
43 - onPress: () => void Linking.openURL(target.appSignIn.installUrl).catch(() => undefined),
43 + onPress: () => void tryOpenExternalUrl(target.appSignIn.installUrl, "provider-auth"),
44 },
45 ],
46 );
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+3 -2
@@ -71,7 +71,8 @@ import { PullRequestOverviewLoading } from "./PullRequestOverviewLoading";
71 import { copyPullRequestLink, sharePullRequestLink } from "./pullRequestLink";
72 import { pullRequestStatus } from "./pullRequestStatus";
73 import { use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
74 -import { Linking, Platform, Pressable, StyleSheet, View } from "react-native";
74 +import { Platform, Pressable, StyleSheet, View } from "react-native";
75 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
76 import { RefreshControl } from "../../components/ui/RefreshControl";
77 import { NativeScrollView } from "../../native/NativeScrollViewMarker";
78 import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -666,7 +667,7 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
667 id: "open-on-provider",
668 title: openOnProviderLabel(identity.provider, messages),
669 icon: "arrow.up.right",
669 - onPress: () => void Linking.openURL(identity.url),
670 + onPress: () => void tryOpenExternalUrl(identity.url, "pull-request"),
671 },
672 {
673 id: "copy-link",
apps/mobile/src/features/pull-requests/PullRequestStatusRows.tsx
+6 -4
@@ -9,7 +9,8 @@ import Animated from "react-native-reanimated";
9 import { PR_ROW_LAYOUT, PR_DISCLOSURE_ENTER, PR_ROW_EXIT } from "./pullRequestAnimations";
10 import { T, useGT, useMessages } from "gt-react-native";
11 import { useState } from "react";
12 -import { Linking, Pressable, View } from "react-native";
12 +import { Pressable, View } from "react-native";
13 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
14 import { AppText as Text } from "../../components/ui/AppText";
15 import { SymbolView } from "../../components/ui/AppSymbol";
16 import { Menu } from "../../components/ui/Menu";
@@ -183,7 +184,7 @@ export function PullRequestChecksRow(props: RowProps) {
184 tint={status.tint}
185 value={status.label}
186 detail={check.description ?? undefined}
186 - onPress={url ? () => void Linking.openURL(url) : undefined}
187 + onPress={url ? () => void tryOpenExternalUrl(url, "pull-request") : undefined}
188 />
189 );
190 })}
@@ -196,8 +197,9 @@ export function PullRequestChecksRow(props: RowProps) {
197 title={gt("Open checks on provider")}
198 icon="arrow.up.right"
199 onPress={() =>
199 - void Linking.openURL(
200 + void tryOpenExternalUrl(
201 definition.changeRequestChecksUrl?.(props.pr.url) ?? props.pr.url,
202 + "pull-request",
203 )
204 }
205 />
@@ -377,7 +379,7 @@ export function PullRequestReviewersRow(props: RowProps) {
379 <PullRequestCardRow
380 title={gt("View reviewers on provider")}
381 icon="arrow.up.right"
380 - onPress={() => void Linking.openURL(props.pr.url)}
382 + onPress={() => void tryOpenExternalUrl(props.pr.url, "pull-request")}
383 />
384 )}
385 </Animated.View>
apps/mobile/src/features/pull-requests/SourceControlAppAccessNotice.tsx
+3 -2
@@ -4,7 +4,8 @@ import {
4 sourceControlClients,
5 } from "@t3tools/client-runtime/source-control-clients";
6 import { T, Var } from "gt-react-native";
7 -import { Linking, Pressable, View } from "react-native";
7 +import { Pressable, View } from "react-native";
8 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
9
10 import { AppText as Text } from "../../components/ui/AppText";
11 import { useEnvironmentPresentation } from "../../state/presentation";
@@ -53,7 +54,7 @@ export function SourceControlAppAccessNotice(props: {
54 </Text>
55 <Pressable
56 accessibilityRole="link"
56 - onPress={() => void Linking.openURL(appSignIn.installUrl).catch(() => undefined)}
57 + onPress={() => void tryOpenExternalUrl(appSignIn.installUrl, "provider-auth")}
58 >
59 <Text className="text-sm font-t3-bold text-foreground">
60 <T>
apps/mobile/src/features/pull-requests/usePullRequestListActions.ts
+2 -2
@@ -10,7 +10,7 @@ import type { EnvironmentId, PullRequestAction } from "@t3tools/contracts";
10 import { Atom, AsyncResult } from "effect/reactivity";
11 import { useGT, useMessages } from "gt-react-native";
12 import { use, useRef, useState } from "react";
13 -import { Linking } from "react-native";
13 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
14 import type { MenuProps } from "../../components/ui/Menu.types";
15 import { composerPullRequests } from "../../state/pull-requests";
16 import { useAtomCommand } from "../../state/use-atom-command";
@@ -151,7 +151,7 @@ export function usePullRequestListActions(
151 return;
152 }
153 if (action === "provider") {
154 - void Linking.openURL(entry.url);
154 + void tryOpenExternalUrl(entry.url, "pull-request");
155 return;
156 }
157 if (action === "share") {
apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx
+3 -2
@@ -17,7 +17,8 @@ import * as Cause from "effect/Cause";
17 import * as Exit from "effect/Exit";
18 import { AsyncResult } from "effect/reactivity";
19 import { useRef, useState } from "react";
20 -import { Linking, View } from "react-native";
20 +import { View } from "react-native";
21 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
22 import { useSafeAreaInsets } from "react-native-safe-area-context";
23 import { m } from "../../i18n/messages";
24
@@ -308,7 +309,7 @@ function EnvironmentDetail({ environmentId }: { readonly environmentId: Environm
309 label={gt("Get help from {organization}", {
310 organization: managedPolicy.organization,
311 })}
311 - onPress={() => void Linking.openURL(supportUrl).catch(() => undefined)}
312 + onPress={() => void tryOpenExternalUrl(supportUrl)}
313 />
314 ) : null}
315 {updatesDenial ? null : (
apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
+3 -2
@@ -12,7 +12,8 @@ import {
12 type ThirdPartyLicenseEntry,
13 } from "@t3tools/shared/thirdPartyLicenses";
14 import { useMemo, useState } from "react";
15 -import { Linking, Platform, Pressable, View } from "react-native";
15 +import { Platform, Pressable, View } from "react-native";
16 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
17 import { useSafeAreaInsets } from "react-native-safe-area-context";
18
19 import { SymbolView } from "../../components/ui/AppSymbol";
@@ -159,7 +160,7 @@ export function SettingsOpenSourceLicenseRouteScreen({ route }: LicenseDetailPro
160 <Pressable
161 accessibilityHint={gt("Opens the project website")}
162 accessibilityRole="link"
162 - onPress={() => void Linking.openURL(sourceUrl)}
163 + onPress={() => void tryOpenExternalUrl(sourceUrl)}
164 className="min-h-12 flex-row items-center gap-2 self-start py-2 active:opacity-60"
165 >
166 <Text className="font-t3-medium text-primary-text">
apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx
+7 -5
@@ -14,7 +14,8 @@ import {
14 } from "@t3tools/contracts";
15 import { useAtomValue } from "@effect/atom-react";
16 import { useRef, useState } from "react";
17 -import { Linking, Pressable, ScrollView, TextInput, useWindowDimensions, View } from "react-native";
17 +import { Pressable, ScrollView, TextInput, useWindowDimensions, View } from "react-native";
18 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
19 import { useSafeAreaInsets } from "react-native-safe-area-context";
20 import { m } from "../../i18n/messages";
21
@@ -369,9 +370,9 @@ function ProviderAccount({
370 variant="pill"
371 label={gt("Docs")}
372 onPress={() => {
372 - void Linking.openURL(provider.setup!.documentationUrl!).catch(() =>
373 - setError(gt("Could not open the provider docs.")),
374 - );
373 + void tryOpenExternalUrl(provider.setup!.documentationUrl!).then((opened) => {
374 + if (!opened) setError(gt("Could not open the provider docs."));
375 + });
376 }}
377 />
378 ) : active && state?.flowId ? (
@@ -530,7 +531,8 @@ function ProviderAccount({
531 !(await send({ type: "browser", action: "accept" }))
532 )
533 return;
533 - await Linking.openURL(url);
534 + if (!(await tryOpenExternalUrl(url, "provider-auth")))
535 + setError(gt("Could not open the sign-in page."));
536 })().catch(() => setError(gt("Could not open the sign-in page.")));
537 }}
538 />
apps/mobile/src/features/settings/components/IssueTrackerSection.tsx
+3 -2
@@ -10,7 +10,8 @@ import { AsyncResult } from "effect/reactivity";
10 import { useNavigation } from "@react-navigation/native";
11 import { useGT, useMessages } from "gt-react-native";
12 import { useState } from "react";
13 -import { Linking, Platform, View } from "react-native";
13 +import { Platform, View } from "react-native";
14 +import { tryOpenExternalUrl } from "../../../lib/openExternalUrl";
15 import Svg, { Path } from "react-native-svg";
16 import { withUniwind } from "uniwind";
17
@@ -175,7 +176,7 @@ export function IssueTrackerCredentialForm(props: {
176 label={gt("Create one")}
177 tone="text"
178 size="compact"
178 - onPress={() => void Linking.openURL(helpUrl).catch(() => undefined)}
179 + onPress={() => void tryOpenExternalUrl(helpUrl)}
180 />
181 ) : null}
182 {tracker.connected ? (
apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
+4 -3
@@ -2,7 +2,8 @@ import { T, useGT } from "gt-react-native";
2 import { SheetHeader } from "../../../components/ui/SheetHeader";
3 import { useNavigation } from "@react-navigation/native";
4 import { useState } from "react";
5 -import { Linking, Pressable, View } from "react-native";
5 +import { Pressable, View } from "react-native";
6 +import { tryOpenExternalUrl } from "../../../lib/openExternalUrl";
7 import { WebView } from "react-native-webview";
8
9 import { Button } from "../../../components/ui/Button";
@@ -38,14 +39,14 @@ export function SettingsLegalDocumentRouteScreen({
39 {
40 accessibilityLabel: gt("Open legal documents in external browser"),
41 icon: "safari",
41 - onPress: () => void Linking.openURL(safeExternalUrl).catch(() => undefined),
42 + onPress: () => void tryOpenExternalUrl(safeExternalUrl),
43 },
44 ]}
45 />
46 );
47
48 const openExternalUrl = (url: string) => {
48 - void Linking.openURL(url).catch(() => undefined);
49 + void tryOpenExternalUrl(url);
50 };
51 if (loadError) {
52 return (
apps/mobile/src/features/settings/components/SourceControlProvidersSection.tsx
+5 -3
@@ -18,7 +18,8 @@ import * as Schema from "effect/Schema";
18 import { useNavigation } from "@react-navigation/native";
19 import { msg, useGT, useMessages } from "gt-react-native";
20 import { useState } from "react";
21 -import { Linking, Platform, View } from "react-native";
21 +import { Platform, View } from "react-native";
22 +import { tryOpenExternalUrl } from "../../../lib/openExternalUrl";
23
24 import { AppText as Text } from "../../../components/ui/AppText";
25 import { Button } from "../../../components/ui/Button";
@@ -300,8 +301,9 @@ export function SourceControlTokenForm(props: {
301 tone="text"
302 size="compact"
303 onPress={() =>
303 - void Linking.openURL(credentials.newTokenUrl(target || defaultHost)).catch(
304 - () => undefined,
304 + void tryOpenExternalUrl(
305 + credentials.newTokenUrl(target || defaultHost),
306 + "provider-auth",
307 )
308 }
309 />
apps/mobile/src/features/settings/components/SourceControlSignInSection.tsx
+2 -2
@@ -9,7 +9,7 @@ import {
9 import * as Cause from "effect/Cause";
10 import * as Clipboard from "expo-clipboard";
11 import { useRef, useState } from "react";
12 -import { Linking } from "react-native";
12 +import { tryOpenExternalUrl } from "../../../lib/openExternalUrl";
13 import { m } from "../../../i18n/messages";
14
15 import * as Dialog from "../../../components/ui/Dialog";
@@ -24,7 +24,7 @@ const failureMessage = (cause: Cause.Cause<unknown>) => {
24 return error instanceof Error ? (errorDisplayMessage(error, m) ?? error.message) : String(error);
25 };
26
27 -const openUrl = (url: string) => void Linking.openURL(url).catch(() => undefined);
27 +const openUrl = (url: string) => void tryOpenExternalUrl(url, "provider-auth");
28
29 /** Signs an environment in through a forge's own app, such as T3 Code for GitHub. */
30 export function AppSignInRow(props: {
apps/mobile/src/features/threads/ChatGptSharingStatus.tsx
+3 -2
@@ -2,7 +2,8 @@ import * as Dialog from "../../components/ui/Dialog";
2 import type { ServerProvider } from "@t3tools/contracts";
3 import { CHATGPT_USAGE_URL, usesChatGptSharing } from "@t3tools/shared/usageLimits";
4 import { T, useGT } from "gt-react-native";
5 -import { Linking, Pressable, View } from "react-native";
5 +import { Pressable, View } from "react-native";
6 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
7 import { AppText as Text } from "../../components/ui/AppText";
8 import { ProviderIcon } from "../../components/ProviderIcon";
9
@@ -40,7 +41,7 @@ export function ChatGptSharingStatus({ provider }: { provider: ServerProvider |
41 <Pressable
42 accessibilityRole="link"
43 className="min-h-11 justify-center"
43 - onPress={() => void Linking.openURL(CHATGPT_USAGE_URL).catch(() => undefined)}
44 + onPress={() => void tryOpenExternalUrl(CHATGPT_USAGE_URL)}
45 >
46 <Text className="text-xs font-t3-medium text-primary">
47 <T>Manage usage</T>
apps/mobile/src/features/threads/QuestionAnswerHistory.tsx
+3 -2
@@ -4,7 +4,8 @@ import type {
4 UserInputAttachments,
5 } from "@t3tools/contracts";
6 import { Image } from "expo-image";
7 -import { Linking, Pressable, View } from "react-native";
7 +import { Pressable, View } from "react-native";
8 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
9 import { getQuestionAnswerText } from "@t3tools/client-runtime/work-log/user-input";
10 import { AppText as Text } from "../../components/ui/AppText";
11 import { assetImageSource } from "../../lib/assetImageSource";
@@ -22,7 +23,7 @@ function AnswerFile(props: {
23 accessibilityLabel={props.attachment.name}
24 disabled={!url}
25 onPress={() => {
25 - if (url) void Linking.openURL(url);
26 + if (url) void tryOpenExternalUrl(url);
27 }}
28 className="gap-1"
29 >
apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx
+7 -5
@@ -14,7 +14,8 @@ import * as Clipboard from "expo-clipboard";
14 import { T, useGT } from "gt-react-native";
15 import { m } from "../../i18n/messages";
16 import { useState } from "react";
17 -import { Linking, Pressable, View } from "react-native";
17 +import { Pressable, View } from "react-native";
18 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
19 import { ProviderIcon } from "../../components/ProviderIcon";
20 import { AppText as Text } from "../../components/ui/AppText";
21 import { useDeadlinePassed } from "../../lib/clock";
@@ -132,10 +133,11 @@ export function UsageLimitRecoveryCard({
133 run: () => {
134 setError(null);
135 setActionPending(true);
135 - void Linking.openURL(CHATGPT_USAGE_URL)
136 - .catch(() =>
137 - setError(gt("Could not open ChatGPT. Go to chatgpt.com → Settings → Usage.")),
138 - )
136 + void tryOpenExternalUrl(CHATGPT_USAGE_URL)
137 + .then((opened) => {
138 + if (!opened)
139 + setError(gt("Could not open ChatGPT. Go to chatgpt.com → Settings → Usage."));
140 + })
141 .finally(() => setActionPending(false));
142 },
143 };
apps/mobile/src/features/usage/ChatGptUsageSummary.tsx
+3 -2
@@ -3,7 +3,8 @@ import type { EnvironmentId } from "@t3tools/contracts";
3 import { CHATGPT_USAGE_URL } from "@t3tools/shared/usageLimits";
4 import { collectExternalUsageLinks } from "@t3tools/shared/usageLimitsCopy";
5 import { T, useMessages, Var } from "gt-react-native";
6 -import { Linking, Pressable, View } from "react-native";
6 +import { Pressable, View } from "react-native";
7 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
8 import { AppText as Text } from "../../components/ui/AppText";
9 import { ProviderIcon } from "../../components/ProviderIcon";
10 import { environmentPresentations } from "../../state/presentation";
@@ -35,7 +36,7 @@ export function ChatGptUsageSummary({
36 <Pressable
37 accessibilityRole="link"
38 className="min-h-11 justify-center"
38 - onPress={() => void Linking.openURL(usage.url).catch(() => undefined)}
39 + onPress={() => void tryOpenExternalUrl(usage.url)}
40 >
41 <Text className="text-sm font-t3-medium text-primary">
42 <T>Manage usage</T>
apps/mobile/src/features/usage/UsageLimitsPooled.tsx
+3 -2
@@ -19,7 +19,8 @@ import {
19 } from "@t3tools/shared/usageLimitsCopy";
20 import { msg, T, useGT, useMessages, Var } from "gt-react-native";
21 import { Fragment, type ReactNode, useId, useState } from "react";
22 -import { Linking, Pressable, View } from "react-native";
22 +import { Pressable, View } from "react-native";
23 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
24 import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
25 import { Defs, Path, Pattern, Rect, Svg } from "react-native-svg";
26 import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -543,7 +544,7 @@ export function UsageLimitsSection({
544 <Pressable
545 accessibilityRole="link"
546 className="min-h-11 justify-center"
546 - onPress={() => void Linking.openURL(link.url).catch(() => undefined)}
547 + onPress={() => void tryOpenExternalUrl(link.url)}
548 >
549 <Text className="text-sm font-t3-medium text-primary">
550 <T>Manage usage</T>
apps/mobile/src/features/usage/UsageLimitsSection.tsx
+3 -2
@@ -22,7 +22,8 @@ import { formatDuration, limitsNotice, resetCreditChoices } from "@t3tools/share
22 import { msg, T, useGT, useMessages, Var } from "gt-react-native";
23 import { type ReactNode, useContext, useRef, useState } from "react";
24 import { Atom } from "effect/reactivity";
25 -import { Linking, Pressable, View } from "react-native";
25 +import { Pressable, View } from "react-native";
26 +import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
27
28 import { AppText as Text } from "../../components/ui/AppText";
29 import { ProviderIcon } from "../../components/ProviderIcon";
@@ -224,7 +225,7 @@ export function AccountLimits(props: {
225 <Pressable
226 accessibilityRole="link"
227 className="min-h-11 justify-center"
227 - onPress={() => void Linking.openURL(externalUsage.url).catch(() => undefined)}
228 + onPress={() => void tryOpenExternalUrl(externalUsage.url)}
229 >
230 <Text className="text-sm font-t3-medium text-primary">
231 <T>Manage usage</T>
apps/mobile/src/lib/openExternalUrl.ts
+5 -1
@@ -9,6 +9,7 @@ const ExternalUrlTarget = Schema.Literals([
9 "html-render",
10 "mcp-app",
11 "secret-request",
12 + "external-link",
13 ]);
14
15 export type ExternalUrlTarget = typeof ExternalUrlTarget.Type;
@@ -41,7 +42,10 @@ function externalUrlMetadata(url: string): { readonly scheme: string; readonly h
42 }
43 }
44
44 -export async function tryOpenExternalUrl(url: string, target: ExternalUrlTarget): Promise<boolean> {
45 +export async function tryOpenExternalUrl(
46 + url: string,
47 + target: ExternalUrlTarget = "external-link",
48 +): Promise<boolean> {
49 try {
50 await Linking.openURL(url);
51 return true;
apps/mobile/src/widgets/publishSubscriptionUsage.android.ts
+2 -2
@@ -1,5 +1,5 @@
1 import { requireOptionalNativeModule } from "expo";
2 -import * as Linking from "expo-linking";
2 +import { tryOpenExternalUrl } from "../lib/openExternalUrl";
3 import type { SubscriptionUsageSnapshot } from "./subscriptionUsageSnapshot";
4
5 let tapUrl: string | undefined;
@@ -16,7 +16,7 @@ export async function publishSubscriptionUsage(snapshot: SubscriptionUsageSnapsh
16 // expo-widgets lacks Android widgetURL. Button events need a live JS runtime to open the app.
17 listening = true;
18 addUserInteractionListener((event) => {
19 - if (event.source === "SubscriptionUsage" && tapUrl) void Linking.openURL(tapUrl);
19 + if (event.source === "SubscriptionUsage" && tapUrl) void tryOpenExternalUrl(tapUrl);
20 });
21 }
22 widget.updateSnapshot(snapshot);