Skip to content

Commit

Permalink
Replace ForceUpdateBanner by RemoteBanner, get data from Firestore (+…
Browse files Browse the repository at this point in the history
…cheatcodes)
  • Loading branch information
cgerrard-pass committed Feb 7, 2025
1 parent 04978b9 commit bcb5090
Show file tree
Hide file tree
Showing 24 changed files with 812 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ exports[`Home page should render correctly 1`] = `
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"disabled": false,
"expanded": undefined,
"selected": undefined,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ exports[`Profile component should render correctly 1`] = `
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"disabled": false,
"expanded": undefined,
"selected": undefined,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`RemoteBanner matches the snapshot 1`] = `
<View
accessibilityLabel="Nouvelle fenêtre : https://www.test.fr"
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": false,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"userSelect": "auto",
}
}
testID="Nouvelle fenêtre : https://www.test.fr"
>
<View
style={
[
{
"borderRadius": 7,
"overflow": "hidden",
},
]
}
>
<View
accessibilityIgnoresInvertColors={true}
style={
[
{
"backgroundColor": "#eb0055",
"justifyContent": "center",
"width": "100%",
},
]
}
>
<Image
source={
{
"testUri": "../../../public/images/BannerRectangle.png",
}
}
style={
[
{
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
{
"height": undefined,
"width": "100%",
},
undefined,
]
}
testID="module-background"
/>
<View
style={
[
{
"alignItems": "center",
"borderColor": "#90949D",
"borderRadius": 7,
"borderStyle": "solid",
"borderWidth": 1,
"flexDirection": "row",
"padding": 16,
"width": "100%",
},
[
{
"borderWidth": 0,
},
],
]
}
>
<View
style={
[
{
"alignContent": "center",
"marginRight": 16,
},
]
}
>
<View
height={32}
testID="ArrowAgain"
width={32}
>
<Text>
ArrowAgain-SVG-Mock
</Text>
</View>
</View>
<View
style={
[
{
"flexGrow": 1,
"flexShrink": 1,
"marginRight": 16,
"textAlign": "start",
},
]
}
>
<Text
style={
[
{
"color": "#ffffff",
"fontFamily": "Montserrat-Bold",
"fontSize": 16,
"lineHeight": 25.6,
},
]
}
>
title 1
</Text>
<Text
style={
[
{
"color": "#ffffff",
"fontFamily": "Montserrat-Medium",
"fontSize": 16,
"lineHeight": 25.6,
},
]
}
>
subtitle 1
</Text>
</View>
<View>
<View
height={24}
width={24}
>
<Text>
undefined-SVG-Mock
</Text>
</View>
</View>
</View>
</View>
</View>
</View>
`;
1 change: 1 addition & 0 deletions src/cheatcodes/pages/CheatcodesMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function CheatcodesMenu(): React.JSX.Element {
...cheatcodesNavigationTutorialButtons,
...cheatcodesNavigationForceUpdateButtons,
{ title: 'Share 🔗', screen: 'CheatcodesNavigationShare', subscreens: [] },
{ title: 'RemoteBanner 🆒', screen: 'CheatcodesScreenRemoteBanner', subscreens: [] },
]

const otherButtons: CheatcodesButtonsWithSubscreensProps[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'

import { CheatcodesTemplateScreen } from 'cheatcodes/components/CheatcodesTemplateScreen'
import { RemoteBanner } from 'features/remoteBanner/components/RemoteBanner'
import { Spacer } from 'ui/theme'

export const CheatcodesScreenRemoteBanner = () => {
return (
<CheatcodesTemplateScreen title="RemoteBanner 🆒" flexDirection="column">
<Spacer.Column numberOfSpaces={3} />
<RemoteBanner />
</CheatcodesTemplateScreen>
)
}
23 changes: 0 additions & 23 deletions src/features/forceUpdate/components/ForceUpdateBanner.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,40 @@ const mockUseGeolocation = jest.mocked(useLocation)
jest.mock('shared/user/useGetDepositAmountsByAge')
const mockDepositAmounts = jest.mocked(useGetDepositAmountsByAge)

jest.mock('@react-native-firebase/firestore')

jest.useFakeTimers()

describe('<HomeBanner/>', () => {
beforeEach(() => {
setFeatureFlags()
})

it('should display force update banner when feature flag showForceUpdateBanner is enable', async () => {
setFeatureFlags([RemoteStoreFeatureFlags.SHOW_FORCE_UPDATE_BANNER])
mockSubscriptionStepper()
mockBannerFromBackend({
banner: {
name: BannerName.retry_identity_check_banner,
title: 'Retente ubble',
text: 'pour débloquer ton crédit',
},
describe('when feature flag showForceUpdateBanner is enable', () => {
beforeEach(() => {
setFeatureFlags([RemoteStoreFeatureFlags.SHOW_FORCE_UPDATE_BANNER], {
title: 'title 1',
subtitle: 'subtitle 1',
redirectionUrl: 'https://www.test.fr',
redirectionType: 'external',
})
})

renderHomeBanner({})
await act(async () => {})
it('should display force update banner', async () => {
mockSubscriptionStepper()
mockBannerFromBackend({
banner: {
name: BannerName.retry_identity_check_banner,
title: 'Retente ubble',
text: 'pour débloquer ton crédit',
},
})
renderHomeBanner({})

const banner = await screen.findByText('title 1')

expect(screen.getByText('Mise à jour requise !')).toBeOnTheScreen()
expect(banner).toBeOnTheScreen()
})
})

describe('When wipAppV2SystemBlock feature flag deactivated', () => {
Expand Down Expand Up @@ -124,7 +138,7 @@ describe('<HomeBanner/>', () => {
})

describe('When wipAppV2SystemBlock feature flag activated', () => {
beforeAll(() => {
beforeEach(() => {
setFeatureFlags([RemoteStoreFeatureFlags.WIP_APP_V2_SYSTEM_BLOCK])
})

Expand Down
4 changes: 2 additions & 2 deletions src/features/home/components/modules/banners/HomeBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React, { ComponentType, FunctionComponent, useCallback, useMemo } from 'r
import styled from 'styled-components/native'

import { BannerName } from 'api/gen'
import { ForceUpdateBanner } from 'features/forceUpdate/components/ForceUpdateBanner'
import { useActivationBanner } from 'features/home/api/useActivationBanner'
import { ActivationBanner } from 'features/home/components/banners/ActivationBanner'
import { SignupBanner } from 'features/home/components/banners/SignupBanner'
import { StepperOrigin, UseNavigationType } from 'features/navigation/RootNavigator/types'
import { RemoteBanner } from 'features/remoteBanner/components/RemoteBanner'
import { useFeatureFlag } from 'libs/firebase/firestore/featureFlags/useFeatureFlag'
import { RemoteStoreFeatureFlags } from 'libs/firebase/firestore/types'
import { SystemBanner as GenericSystemBanner } from 'ui/components/ModuleBanner/SystemBanner'
Expand Down Expand Up @@ -141,7 +141,7 @@ export const HomeBanner = ({ isLoggedIn }: HomeBannerProps) => {
if (showForceUpdateBanner) {
return (
<BannerContainer>
<ForceUpdateBanner />
<RemoteBanner />
</BannerContainer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CheatcodesNavigationIdentityCheck } from 'cheatcodes/pages/features/ide
import { CheatcodesNavigationNewIdentificationFlow } from 'cheatcodes/pages/features/identityCheck/CheatcodesNavigationNewIdentificationFlow'
import { CheatcodesNavigationInternal } from 'cheatcodes/pages/features/internal/CheatcodesNavigationInternal'
import { CheatcodesNavigationProfile } from 'cheatcodes/pages/features/profile/CheatcodesNavigationProfile'
import { CheatcodesScreenRemoteBanner } from 'cheatcodes/pages/features/remoteBanner/CheatcodesScreenRemoteBanner'
import { CheatcodesNavigationShare } from 'cheatcodes/pages/features/share/CheatcodesNavigationShare'
import { CheatcodesNavigationSubscription } from 'cheatcodes/pages/features/subscription/CheatcodesNavigationSubscription'
import { CheatcodesNavigationTrustedDevice } from 'cheatcodes/pages/features/trustedDevice/CheatcodesNavigationTrustedDevice'
Expand Down Expand Up @@ -137,6 +138,10 @@ const routes: CheatcodesStackRoute[] = [
name: 'CheatcodesScreenNewCaledonia',
component: CheatcodesScreenNewCaledonia,
},
{
name: 'CheatcodesScreenRemoteBanner',
component: CheatcodesScreenRemoteBanner,
},
{
name: 'CheatcodesNavigationErrors',
component: withAsyncErrorBoundary(CheatcodesNavigationErrors),
Expand Down
Loading

0 comments on commit bcb5090

Please sign in to comment.