diff --git a/src/components/dialogs/LinkWarning.tsx b/src/components/dialogs/LinkWarning.tsx index aeb3e959ce..181d411ce4 100644 --- a/src/components/dialogs/LinkWarning.tsx +++ b/src/components/dialogs/LinkWarning.tsx @@ -27,6 +27,21 @@ export function LinkWarningDialog() { ) } +export function CustomLinkWarningDialog({ + control, + link, +}: { + control: Dialog.DialogControlProps + link?: {href: string; displayText: string; share?: boolean} +}) { + return ( + + + + + ) +} + function LinkWarningDialogInner({ link, }: { diff --git a/src/screens/Profile/components/GermButton.tsx b/src/screens/Profile/components/GermButton.tsx index cdd115ac26..17aefc89b9 100644 --- a/src/screens/Profile/components/GermButton.tsx +++ b/src/screens/Profile/components/GermButton.tsx @@ -17,6 +17,7 @@ import {useAgent, useSession} from '#/state/session' import {atoms as a, useTheme, web} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' +import {CustomLinkWarningDialog} from '#/components/dialogs/LinkWarning' import {ArrowTopRight_Stroke2_Corner0_Rounded as ArrowTopRightIcon} from '#/components/icons/Arrow' import {Link} from '#/components/Link' import {Loader} from '#/components/Loader' @@ -34,6 +35,7 @@ export function GermButton({ const {_} = useLingui() const t = useTheme() const {currentAccount} = useSession() + const linkWarningControl = Dialog.useDialogControl() // exclude `none` and all unknown values if ( @@ -57,23 +59,40 @@ export function GermButton({ } return ( - - - - Germ DM - - - + <> + { + if (isCustomGermDomain(url)) { + evt.preventDefault() + linkWarningControl.open() + return false + } + }} + label={_(msg`Open Germ DM`)} + overridePresentation={false} + shouldProxy={false} + style={[ + t.atoms.bg_contrast_50, + a.rounded_full, + a.self_start, + {padding: 6}, + ]}> + + + Germ DM + + + + + ) } @@ -251,6 +270,15 @@ function constructGermUrl( } } +function isCustomGermDomain(url: string) { + try { + const urlp = new URL(url) + return urlp.hostname !== 'landing.ger.mx' + } catch { + return false + } +} + function platform() { switch (Platform.OS) { case 'ios':