Skip to content

Commit 74de0df

Browse files
Improve the popup blocked message in iOS
1 parent 6818e56 commit 74de0df

File tree

1 file changed

+35
-12
lines changed
  • packages/app/features/deposit/DepositCoinbase

1 file changed

+35
-12
lines changed

packages/app/features/deposit/DepositCoinbase/screen.tsx

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ export function DepositCoinbaseScreen({ defaultPaymentMethod }: DepositCoinbaseS
3333
const { resolvedTheme } = useThemeSetting()
3434
const isDarkTheme = resolvedTheme?.startsWith('dark')
3535

36+
// Web-only: detect iOS Safari to guide users when popups are blocked
37+
const niceError = error ? toNiceError(error) : null
38+
const isIOSWeb =
39+
(Platform.OS === 'web' &&
40+
typeof navigator !== 'undefined' &&
41+
/iPhone|iPad|iPod/i.test(navigator.userAgent)) ||
42+
Platform.OS === 'ios'
43+
const shouldShowIOSPopupHelp = Boolean(
44+
isIOSWeb && niceError && /popup was blocked/i.test(niceError)
45+
)
46+
3647
const handleConfirmTransaction = (amount: number) => {
3748
openOnramp(amount)
3849
}
@@ -47,25 +58,37 @@ export function DepositCoinbaseScreen({ defaultPaymentMethod }: DepositCoinbaseS
4758
switch (true) {
4859
case !!error:
4960
return (
50-
<FadeCard ai={'center'} testID="error">
51-
<IconError size={'$4'} color={'$error'} />
52-
<YStack ai={'center'} gap={'$2'}>
53-
<Paragraph size={'$8'} fontWeight={500} ta={'center'}>
54-
Coinbase window was closed
55-
</Paragraph>
61+
<>
62+
<FadeCard ai={'center'} testID="error">
63+
<IconError size={'$4'} color={'$error'} />
64+
<YStack ai={'center'} gap={'$2'}>
65+
<Paragraph size={'$8'} fontWeight={500} ta={'center'}>
66+
Coinbase window was closed
67+
</Paragraph>
68+
<Paragraph
69+
size={'$5'}
70+
ta={'center'}
71+
color={'$lightGrayTextField'}
72+
$theme-light={{ color: '$darkGrayTextField' }}
73+
>
74+
{niceError}
75+
</Paragraph>
76+
</YStack>
77+
<PrimaryButton onPress={closeOnramp}>
78+
<PrimaryButton.Text>try again</PrimaryButton.Text>
79+
</PrimaryButton>
80+
</FadeCard>
81+
{shouldShowIOSPopupHelp && (
5682
<Paragraph
5783
size={'$5'}
5884
ta={'center'}
5985
color={'$lightGrayTextField'}
6086
$theme-light={{ color: '$darkGrayTextField' }}
6187
>
62-
{toNiceError(error)}
88+
Turn off "Block Popups" in iOS Safari Settings then try again.
6389
</Paragraph>
64-
</YStack>
65-
<PrimaryButton onPress={closeOnramp}>
66-
<PrimaryButton.Text>try again</PrimaryButton.Text>
67-
</PrimaryButton>
68-
</FadeCard>
90+
)}
91+
</>
6992
)
7093
case coinbaseStatus === 'success':
7194
return (

0 commit comments

Comments
 (0)