diff --git a/core/auth/components/AlreadyHaveAccountText.tsx b/core/auth/components/AlreadyHaveAccountText.tsx index 0ce8456b70c08c87f92377be4499979b6f9e5857..9453356691dc667ebea6ffdfd8a719c314a44f26 100644 --- a/core/auth/components/AlreadyHaveAccountText.tsx +++ b/core/auth/components/AlreadyHaveAccountText.tsx @@ -7,16 +7,11 @@ import { Text } from 'holi-bricks/components/text' import { View } from 'react-native' export interface AlreadyHaveAccountTextProps { - mobileNavigateBackFirst?: boolean trackingEvent: TrackingEvent onPress?(): void } -const AlreadyHaveAccountText = ({ - mobileNavigateBackFirst = false, - trackingEvent, - onPress, -}: AlreadyHaveAccountTextProps) => { +const AlreadyHaveAccountText = ({ trackingEvent, onPress }: AlreadyHaveAccountTextProps) => { const { t } = useTranslation() return ( @@ -28,7 +23,6 @@ const AlreadyHaveAccountText = ({ onPress={onPress} href="/login" size="sm" - mobileNavigateBackFirst={mobileNavigateBackFirst} trackingEvent={trackingEvent} > {t('auth.login')} diff --git a/core/auth/components/RecoverPasswordForm.tsx b/core/auth/components/RecoverPasswordForm.tsx index b2a4c30c3d9cda1cf6f8a775658793773918b793..b1fd18f67134abd267aa8fb9172e8ce1cc42c3e0 100644 --- a/core/auth/components/RecoverPasswordForm.tsx +++ b/core/auth/components/RecoverPasswordForm.tsx @@ -76,7 +76,7 @@ const RecoverPasswordForm = (props: RecoverPasswordFormProps) => { {!props.webview && ( <> <HoliGap size="s" /> - <AlreadyHaveAccountText mobileNavigateBackFirst trackingEvent={TrackingEvent.Auth.LoginButtonPressed} /> + <AlreadyHaveAccountText trackingEvent={TrackingEvent.Auth.LoginButtonPressed} /> <HoliGap size="l" /> <HoliHeading level="2" align="center"> {t('auth.login.signUp.link.headline')} diff --git a/core/auth/screens/Login.tsx b/core/auth/screens/Login.tsx index c847e203cf8810478739a8b1be7654e2f106993d..e7b876d1599cf473f314ab21b1af6317c2199687 100644 --- a/core/auth/screens/Login.tsx +++ b/core/auth/screens/Login.tsx @@ -120,7 +120,6 @@ const Login = () => { href="/forgotPassword" size="sm" textAlign="center" - mobileNavigateBackFirst trackingEvent={TrackingEvent.Auth.ForgotPasswordButtonPressed} > {t('auth.login.link.forgotPassword')} diff --git a/core/navigation/components/HoliLink/index.tsx b/core/navigation/components/HoliLink/index.tsx index eb2aa4e55bf7ceeb4c7f7039766c11c4dee277c0..410d08668c696d3ab1abb4de7567733974df8901 100644 --- a/core/navigation/components/HoliLink/index.tsx +++ b/core/navigation/components/HoliLink/index.tsx @@ -11,11 +11,10 @@ export const HoliLink = ({ external, onPress, children, - mobileNavigateBackFirst, isFullHeight = false, testID = 'link', }: PropsWithChildren<HoliLinkProps>) => { - const handleLinkPress = useLink({ href, external, onPress, mobileNavigateBackFirst }) + const handleLinkPress = useLink({ href, external, onPress }) return ( <Pressable diff --git a/core/navigation/components/HoliTextLink/index.tsx b/core/navigation/components/HoliTextLink/index.tsx index 7d8e191ad9b574d3b587b994ba021cdbf1047288..36ff618305384cdc633da3d31948a3ec50fab9d6 100644 --- a/core/navigation/components/HoliTextLink/index.tsx +++ b/core/navigation/components/HoliTextLink/index.tsx @@ -11,12 +11,11 @@ export const HoliTextLink = ({ external, onPress, children, - mobileNavigateBackFirst, color, size, textAlign, }: PropsWithChildren<HoliTextLinkProps>) => { - const handleLinkPress = useLink({ href, external, onPress, mobileNavigateBackFirst }) + const handleLinkPress = useLink({ href, external, onPress }) return ( <TextLink size={size} color={color} textAlign={textAlign} onPress={handleLinkPress} aria-label={label}> diff --git a/core/navigation/components/HoliTextLink/index.web.tsx b/core/navigation/components/HoliTextLink/index.web.tsx index 3d858988fbe2d2b89c806fcce792fde72d29927c..8a4f4677c9ccc323bfeacfc7902775b84b94ea83 100644 --- a/core/navigation/components/HoliTextLink/index.web.tsx +++ b/core/navigation/components/HoliTextLink/index.web.tsx @@ -11,20 +11,13 @@ export const HoliTextLink = ({ external, onPress, children, - mobileNavigateBackFirst, color, textAlign, size, }: PropsWithChildren<HoliTextLinkProps>) => { return ( <TextLink size={size} color={color} textAlign={textAlign} role="none"> - <HoliLink - href={href} - label={label} - external={external} - onPress={onPress} - mobileNavigateBackFirst={mobileNavigateBackFirst} - > + <HoliLink href={href} label={label} external={external} onPress={onPress}> {children} </HoliLink> </TextLink> diff --git a/core/navigation/hooks/__tests__/useLink.test.ts b/core/navigation/hooks/__tests__/useLink.test.ts index 73ac82e9507a1d7e9ed1fbd6490f92e34f2f7eb0..858a2680500cd79fdd9924987d29e14a2e0b11f1 100644 --- a/core/navigation/hooks/__tests__/useLink.test.ts +++ b/core/navigation/hooks/__tests__/useLink.test.ts @@ -79,15 +79,6 @@ describe('useLink', () => { expect(mockOpenURL).toHaveBeenCalledWith('/') }) - it('should navigate back first on mobile', async () => { - const { result } = renderHook(() => useLink({ href: '/spaces', mobileNavigateBackFirst: true })) - - result.current(testEvent) - - expect(mockNavigateBack).toHaveBeenCalled() - await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('//spaces')) - }) - it('should ignore domain and locale path param on mobile', () => { const originalPlatform = Platform.OS Platform.OS = 'android' diff --git a/core/navigation/hooks/useLink.ts b/core/navigation/hooks/useLink.ts index c5ccbc14f04e0c25d2ed13b65c809f3bd9cd5000..54cee3968991b59f0564572ce98f670a0ada7d5f 100644 --- a/core/navigation/hooks/useLink.ts +++ b/core/navigation/hooks/useLink.ts @@ -9,11 +9,10 @@ export interface UseLinkProps { /** if given, `onPress` will be executed before opening href (if given). if `onPress` returns `false` (synchronously, required for web) event propagation will be stopped */ onPress?: (event: React.SyntheticEvent | GestureResponderEvent) => unknown | Promise<unknown> external?: boolean - mobileNavigateBackFirst?: boolean } -const useLink = ({ onPress, external, href, mobileNavigateBackFirst }: UseLinkProps) => { - const { navigate, navigateBack } = useRouting() +const useLink = ({ onPress, external, href }: UseLinkProps) => { + const { navigate } = useRouting() return useCallback( async (event: React.SyntheticEvent | GestureResponderEvent) => { @@ -31,17 +30,12 @@ const useLink = ({ onPress, external, href, mobileNavigateBackFirst }: UseLinkPr if (Platform.OS === 'ios' || Platform.OS === 'android') { // If the platform is mobile and the link domain matches our app's domain, navigate to the route instead of opening the link const route = '/' + href.replace(/https:\/\/(app\.holi\.social|staging\.dev\.holi\.social)(\/(en|de))?\/?/, '') - if (mobileNavigateBackFirst) { - navigateBack() - setTimeout(() => navigate(route), 300) - } else { - navigate(route) - } + navigate(route) } else { navigate(href) } }, - [external, href, mobileNavigateBackFirst, navigate, navigateBack, onPress] + [external, href, navigate, onPress] ) } diff --git a/core/screens/notifications/components/NotificationChallengesItem.tsx b/core/screens/notifications/components/NotificationChallengesItem.tsx index f10ecf98d26abf9aa42620c65e9dae474dc9c0b6..01542e90894be1af347376e99433c8146d97fcca 100644 --- a/core/screens/notifications/components/NotificationChallengesItem.tsx +++ b/core/screens/notifications/components/NotificationChallengesItem.tsx @@ -34,7 +34,7 @@ export const NotificationChallengesItem = ({ paddingVertical: 12, }} > - <HoliLink href={route} label={'notification'} mobileNavigateBackFirst> + <HoliLink href={route} label={'notification'}> <View style={styles.link}> <HoliIcon icon={challengesColored} size={40} /> <View style={styles.content}> diff --git a/core/screens/notifications/components/NotificationPollUpdatesItem.tsx b/core/screens/notifications/components/NotificationPollUpdatesItem.tsx index 9ccc26e1d17a607d3cddfefbb5a8a7b5d24b1fb5..ccacbb9a55fd66aa8a6ea745202930219148589c 100644 --- a/core/screens/notifications/components/NotificationPollUpdatesItem.tsx +++ b/core/screens/notifications/components/NotificationPollUpdatesItem.tsx @@ -21,7 +21,7 @@ const NotificationPollUpdatesItem = ({ notification }: NotificationProps<Notific return ( <View> - <HoliLink href={`/insights/${poll.insightId}`} label={poll.title} mobileNavigateBackFirst> + <HoliLink href={`/insights/${poll.insightId}`} label={poll.title}> <View style={styles.link}> <View style={styles.image}> <HoliLocalImage diff --git a/core/screens/notifications/components/NotificationReleaseInfoItem.tsx b/core/screens/notifications/components/NotificationReleaseInfoItem.tsx index 005d3289dffc1a1b8dfe8894b1af7f59f2b4ee2d..6b27dac8ed1b3b1d9b0778b65843194fba5aceb7 100644 --- a/core/screens/notifications/components/NotificationReleaseInfoItem.tsx +++ b/core/screens/notifications/components/NotificationReleaseInfoItem.tsx @@ -24,7 +24,7 @@ const NotificationReleaseInfoItem: React.FC<NotificationProps<NotificationReleas return ( <View style={style} testID={testID}> - <HoliLink href={`/posts/${post?.id}`} label={post?.title} mobileNavigateBackFirst> + <HoliLink href={`/posts/${post?.id}`} label={post?.title}> <View style={styles.link}> <HoliLocalImage imageSource={require('@holi/ui/assets/img/holi/holi_brandmark.svg')} diff --git a/core/screens/notifications/components/NotificationSpaceAppointmentBaseItem.tsx b/core/screens/notifications/components/NotificationSpaceAppointmentBaseItem.tsx index 68fc1a3765595ed427c81aacf9b6fd3530fde7a6..f5cbdc7e90f03b85d152cfc98da2f8ca1d1d3962 100644 --- a/core/screens/notifications/components/NotificationSpaceAppointmentBaseItem.tsx +++ b/core/screens/notifications/components/NotificationSpaceAppointmentBaseItem.tsx @@ -35,7 +35,7 @@ export const NotificationSpaceAppointmentBaseItem = ({ paddingVertical: 12, }} > - <HoliLink href={link ?? '/'} label={space.title} mobileNavigateBackFirst> + <HoliLink href={link ?? '/'} label={space.title}> <View style={styles.link}> <SpaceAvatar space={space} size="sm" /> diff --git a/core/screens/notifications/components/NotificationSpaceItem.tsx b/core/screens/notifications/components/NotificationSpaceItem.tsx index 6723aa98e538acbc4f5ddd89560da6e6f64857ba..d772f2a5512000cda63914af31d05c085009a592 100644 --- a/core/screens/notifications/components/NotificationSpaceItem.tsx +++ b/core/screens/notifications/components/NotificationSpaceItem.tsx @@ -46,7 +46,7 @@ const NotificationSpaceItem = ({ return ( <View style={style} testID={testID}> - <HoliLink href={href} label={title} mobileNavigateBackFirst> + <HoliLink href={href} label={title}> <View style={styles.container}> <View style={styles.imageContainer}> <SpaceAvatar space={notification.options.space} size="sm" /> diff --git a/core/screens/notifications/components/NotificationSpacePostItem.tsx b/core/screens/notifications/components/NotificationSpacePostItem.tsx index 6b187a171bc5aab1aad515c859790bd2f534fee9..d33cdf703317edad15cea74742305f995285546b 100644 --- a/core/screens/notifications/components/NotificationSpacePostItem.tsx +++ b/core/screens/notifications/components/NotificationSpacePostItem.tsx @@ -21,7 +21,7 @@ const NotificationSpacePostItem = ({ notification, style, testID = '' }: Notific return ( <View style={style} testID={testID}> - <HoliLink href={`/spaces/${space.name}?tab=updates`} label={space.title} mobileNavigateBackFirst> + <HoliLink href={`/spaces/${space.name}?tab=updates`} label={space.title}> <View style={styles.link}> <SpaceAvatar space={space} size="sm" /> diff --git a/core/screens/notifications/components/NotificationWithUserAvatar.tsx b/core/screens/notifications/components/NotificationWithUserAvatar.tsx index 9c724a16b4eba608b8d63f7e7b036fbb7fd643b6..37363d86098cdfdc66d16c1f8356127766b38e99 100644 --- a/core/screens/notifications/components/NotificationWithUserAvatar.tsx +++ b/core/screens/notifications/components/NotificationWithUserAvatar.tsx @@ -38,7 +38,7 @@ const NotificationWithUserAvatar = ({ return ( <View style={style} testID={testID}> - <HoliLink href={href} label={userFullName} mobileNavigateBackFirst> + <HoliLink href={href} label={userFullName}> <View style={styles.link}> <Avatar imgPlaceholder={avatarBlurhash}