Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/post/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as Sentry from "@sentry/react-native";
import { File, Paths } from "expo-file-system";
import { Stack, useLocalSearchParams } from "expo-router";
import * as Sharing from "expo-sharing";
import * as WebBrowser from "expo-web-browser";
import { useCallback, useRef, useState } from "react";
import { Alert, Linking, Pressable, ScrollView, useWindowDimensions, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
Expand Down Expand Up @@ -80,11 +81,17 @@ export default function PostScreen() {
};

const handleCreatorPress = () => {
if (post?.creator_profile_url) Linking.openURL(post.creator_profile_url);
if (post?.creator_profile_url)
Linking.openURL(post.creator_profile_url).catch(() => {
WebBrowser.openBrowserAsync(post.creator_profile_url!);
});
};

const handleCtaPress = () => {
if (post?.call_to_action_url) Linking.openURL(post.call_to_action_url);
if (post?.call_to_action_url)
Linking.openURL(post.call_to_action_url).catch(() => {
WebBrowser.openBrowserAsync(post.call_to_action_url!);
});
};

if (!post) {
Expand Down
5 changes: 4 additions & 1 deletion app/purchase/[token].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { buildApiUrl } from "@/lib/request";
import { File, Paths } from "expo-file-system";
import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import * as Sharing from "expo-sharing";
import * as WebBrowser from "expo-web-browser";
import { useCallback, useEffect, useRef, useState } from "react";
import * as Sentry from "@sentry/react-native";
import { Alert, Linking, View } from "react-native";
Expand Down Expand Up @@ -86,7 +87,9 @@ export default function DownloadScreen() {
!/^https?:\/\//.test(request.url)
)
return true;
Linking.openURL(request.url);
Linking.openURL(request.url).catch(() => {
WebBrowser.openBrowserAsync(request.url);
});
return false;
},
[url],
Expand Down
Loading