Skip to content

Commit

Permalink
Mesures sur certaines pages et modification du setup jest pour le moc…
Browse files Browse the repository at this point in the history
…k firebase
  • Loading branch information
pcanthelou-pass committed Nov 24, 2024
1 parent 020f1c2 commit be0e598
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions jest/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ jest.mock('libs/environment/env')
jest.mock('react-native-device-info', () => mockRNDeviceInfo)

jest.unmock('react-native-modal')

jest.mock('shared/performance/useFirebasePerformanceProfiler', () => ({
useFirebasePerformanceProfiler: jest.fn(),
}))
7 changes: 7 additions & 0 deletions src/features/favorites/pages/Favorites.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { useRoute } from '@react-navigation/native'
import React from 'react'
import styled from 'styled-components/native'

import { useAuthContext } from 'features/auth/context/AuthContext'
import { FavoritesResults } from 'features/favorites/components/FavoritesResults'
import { NotConnectedFavorites } from 'features/favorites/pages/NotConnectedFavorites'
import { UseRouteType } from 'features/navigation/RootNavigator/types'
import { useNetInfoContext } from 'libs/network/NetInfoWrapper'
import { OfflinePage } from 'libs/network/OfflinePage'
import { UsePerformanceProfilerOptions } from 'shared/performance/types'
import { useFirebasePerformanceProfiler } from 'shared/performance/useFirebasePerformanceProfiler'
import { PageHeader } from 'ui/components/headers/PageHeader'

export const Favorites: React.FC = () => {
const route = useRoute<UseRouteType<'Favorites'>>()
const { isConnected } = useNetInfoContext()
const { isLoggedIn } = useAuthContext()

useFirebasePerformanceProfiler('Favorites', { route } as UsePerformanceProfilerOptions)

if (!isConnected) {
return <OfflinePage />
}
Expand Down
3 changes: 3 additions & 0 deletions src/features/home/pages/GenericHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { useNetInfoContext } from 'libs/network/NetInfoWrapper'
import { OfflinePage } from 'libs/network/OfflinePage'
import { BatchEvent, BatchEventData, BatchUser } from 'libs/react-native-batch'
import { AccessibilityFooter } from 'shared/AccessibilityFooter/AccessibilityFooter'
import { useFirebasePerformanceProfiler } from 'shared/performance/useFirebasePerformanceProfiler'
import { ScrollToTopButton } from 'ui/components/ScrollToTopButton'
import { Spinner } from 'ui/components/Spinner'
import { getSpacing, Spacer } from 'ui/theme'
Expand Down Expand Up @@ -269,6 +270,8 @@ const OnlineHome: FunctionComponent<GenericHomeProps> = ({
[Header, shouldDisplayVideoInHeader, videoCarouselModules, homeId, HomeBanner]
)

useFirebasePerformanceProfiler('OnlineHome')

return (
<Container>
{showSkeleton ? (
Expand Down
7 changes: 6 additions & 1 deletion src/features/home/pages/ThematicHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { UseRouteType } from 'features/navigation/RootNavigator/types'
import { analytics } from 'libs/analytics'
import { useLocation } from 'libs/location/LocationWrapper'
import { LocationMode } from 'libs/location/types'
import { UsePerformanceProfilerOptions } from 'shared/performance/types'
import { useFirebasePerformanceProfiler } from 'shared/performance/useFirebasePerformanceProfiler'
import { useOpacityTransition } from 'ui/animations/helpers/useOpacityTransition'
import { getSpacing, Spacer } from 'ui/theme'

Expand Down Expand Up @@ -97,7 +99,8 @@ const ThematicHeaderWithGeolocBanner: FunctionComponent<{
)

export const ThematicHome: FunctionComponent = () => {
const { params } = useRoute<UseRouteType<'ThematicHome'>>()
const route = useRoute<UseRouteType<'ThematicHome'>>()
const { params } = route
const isFromDeeplink = params.from === 'deeplink'
const { modules, id, thematicHeader } = useHomepageData(params.homeId) || {}
const {
Expand Down Expand Up @@ -149,6 +152,8 @@ export const ThematicHome: FunctionComponent = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [hasGeolocPosition, isFromDeeplink])

useFirebasePerformanceProfiler('ThematicHome', { route } as UsePerformanceProfilerOptions)

return (
<Container>
<GenericHome
Expand Down

0 comments on commit be0e598

Please sign in to comment.