Skip to content

Commit a55ad8c

Browse files
committed
Change the buy tab label to "Deposit" for GB IPs
1 parent a266be2 commit a55ad8c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- added: Add disableSurveyModal option
77
- changed: Disable Home scene swap and FIO cards if configured
88
- changed: Allow some chains to be disabled in env.json
9+
- changed: "Buy" tab shows "Deposit" for UK users
910
- fixed: FIO OBT data not showing in received transaction memos
1011

1112
## 4.11.0

src/components/themed/MenuTabs.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
1111
import Ionicon from 'react-native-vector-icons/Ionicons'
1212
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
1313

14+
import { getCountryCodeByIp } from '../../actions/AccountReferralActions'
1415
import { writeDefaultScreen } from '../../actions/DeviceSettingsActions'
1516
import { Fontello } from '../../assets/vector/index'
1617
import { ENV } from '../../env'
18+
import { useAsyncEffect } from '../../hooks/useAsyncEffect'
1719
import { useHandler } from '../../hooks/useHandler'
1820
import { LocaleStringKey } from '../../locales/en_US'
1921
import { lstrings } from '../../locales/strings'
@@ -44,6 +46,7 @@ const title: { readonly [key: string]: string } = {
4446
homeTab: lstrings.title_home,
4547
walletsTab: lstrings.title_assets,
4648
buyTab: lstrings.title_buy,
49+
buyTabAlt: lstrings.loan_fragment_deposit,
4750
sellTab: lstrings.title_sell,
4851
swapTab: lstrings.title_exchange,
4952
extraTab: lstrings[extraTabString],
@@ -187,6 +190,17 @@ const Tab = ({
187190
const theme = useTheme()
188191
const insets = useSafeAreaInsets()
189192
const color = isActive ? theme.tabBarIconHighlighted : theme.tabBarIcon
193+
const [countryCode, setCountryCode] = React.useState<string | undefined>()
194+
195+
// Set countryCode once
196+
useAsyncEffect(
197+
async () => {
198+
const countryCode = await getCountryCodeByIp().catch(() => '')
199+
setCountryCode(countryCode)
200+
},
201+
[],
202+
'countryCode'
203+
)
190204

191205
const icon: { readonly [key: string]: JSX.Element } = {
192206
homeTab: <SimpleLineIcons name="home" size={theme.rem(1.25)} color={color} />,
@@ -227,7 +241,7 @@ const Tab = ({
227241
<TabContainer accessible={false} insetBottom={insets.bottom} key={route.key} onPress={handleOnPress}>
228242
{icon[route.name]}
229243
<Label accessible numberOfLines={1} adjustsFontSizeToFit minimumFontScale={0.65} isActive={isActive} openRatio={footerOpenRatio}>
230-
{title[route.name]}
244+
{route.name === 'buyTab' && countryCode === 'GB' ? title.buyTabAlt : title[route.name]}
231245
</Label>
232246
</TabContainer>
233247
)

0 commit comments

Comments
 (0)