Skip to content

Commit

Permalink
Change the buy tab label to "Deposit" for GB IPs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge committed Aug 13, 2024
1 parent a266be2 commit a55ad8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- added: Add disableSurveyModal option
- changed: Disable Home scene swap and FIO cards if configured
- changed: Allow some chains to be disabled in env.json
- changed: "Buy" tab shows "Deposit" for UK users
- fixed: FIO OBT data not showing in received transaction memos

## 4.11.0
Expand Down
16 changes: 15 additions & 1 deletion src/components/themed/MenuTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
import Ionicon from 'react-native-vector-icons/Ionicons'
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'

import { getCountryCodeByIp } from '../../actions/AccountReferralActions'
import { writeDefaultScreen } from '../../actions/DeviceSettingsActions'
import { Fontello } from '../../assets/vector/index'
import { ENV } from '../../env'
import { useAsyncEffect } from '../../hooks/useAsyncEffect'
import { useHandler } from '../../hooks/useHandler'
import { LocaleStringKey } from '../../locales/en_US'
import { lstrings } from '../../locales/strings'
Expand Down Expand Up @@ -44,6 +46,7 @@ const title: { readonly [key: string]: string } = {
homeTab: lstrings.title_home,
walletsTab: lstrings.title_assets,
buyTab: lstrings.title_buy,
buyTabAlt: lstrings.loan_fragment_deposit,
sellTab: lstrings.title_sell,
swapTab: lstrings.title_exchange,
extraTab: lstrings[extraTabString],
Expand Down Expand Up @@ -187,6 +190,17 @@ const Tab = ({
const theme = useTheme()
const insets = useSafeAreaInsets()
const color = isActive ? theme.tabBarIconHighlighted : theme.tabBarIcon
const [countryCode, setCountryCode] = React.useState<string | undefined>()

// Set countryCode once
useAsyncEffect(
async () => {
const countryCode = await getCountryCodeByIp().catch(() => '')
setCountryCode(countryCode)
},
[],
'countryCode'
)

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

0 comments on commit a55ad8c

Please sign in to comment.