From 340eb12fa0865dc0187860c5b5e426b969bbfdc3 Mon Sep 17 00:00:00 2001 From: Dmitriy Kudasov Date: Thu, 15 Aug 2024 13:09:24 +0300 Subject: [PATCH] feat(HW-582): Hide bech32 if disabled through remote config --- src/components/account-detail.tsx | 193 +++++++++++++------------ src/models/provider/provider-config.ts | 4 + src/services/indexer/indexer.types.ts | 1 + 3 files changed, 105 insertions(+), 93 deletions(-) diff --git a/src/components/account-detail.tsx b/src/components/account-detail.tsx index b109d3eaa..e91dd754d 100644 --- a/src/components/account-detail.tsx +++ b/src/components/account-detail.tsx @@ -1,6 +1,7 @@ import React, {useCallback, useMemo, useRef, useState} from 'react'; import Clipboard from '@react-native-clipboard/clipboard'; +import {observer} from 'mobx-react'; import {Share, View, useWindowDimensions} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import QRCode from 'react-native-qrcode-svg'; @@ -22,6 +23,7 @@ import { } from '@app/components/ui'; import {createTheme} from '@app/helpers'; import {I18N} from '@app/i18n'; +import {RemoteProviderConfig} from '@app/models/provider'; import {Wallet} from '@app/models/wallet'; import {sendNotification} from '@app/services'; import {GRADIENT_END, GRADIENT_START} from '@app/variables/common'; @@ -36,107 +38,112 @@ export interface DetailsQrModalProps { onClose: () => void; } -export const AccountDetail = ({wallet, onClose}: DetailsQrModalProps) => { - const svg = useRef(); - const {width} = useWindowDimensions(); +export const AccountDetail = observer( + ({wallet, onClose}: DetailsQrModalProps) => { + const svg = useRef(); + const {width} = useWindowDimensions(); - const [activeTab, setActiveTab] = useState(TabNames.evm); - const address = useMemo( - () => (activeTab === TabNames.evm ? wallet.address : wallet.cosmosAddress), - [activeTab, wallet.address], - ); + const [activeTab, setActiveTab] = useState(TabNames.evm); + const address = useMemo( + () => + activeTab === TabNames.evm ? wallet.address : wallet.cosmosAddress, + [activeTab, wallet.address], + ); - const onCopy = useCallback(() => { - Clipboard.setString(address); - sendNotification(I18N.notificationCopied); - }, [address]); + const onCopy = useCallback(() => { + Clipboard.setString(address); + sendNotification(I18N.notificationCopied); + }, [address]); - const onShare = useCallback(() => { - Share.share({message: address}); - }, [address]); + const onShare = useCallback(() => { + Share.share({message: address}); + }, [address]); - const onTabChange = useCallback((tabName: TabNames) => { - setActiveTab(tabName); - }, []); + const onTabChange = useCallback((tabName: TabNames) => { + setActiveTab(tabName); + }, []); - return ( - - - - - - - - } - /> - - - + return ( + + + + + {RemoteProviderConfig.isBech32Enabled && ( + + )} + - - (svg.current = c)} - logoSize={width / 5.86} - logoBorderRadius={8} + } + /> + + + + + + (svg.current = c)} + logoSize={width / 5.86} + logoBorderRadius={8} + /> + + + {wallet?.name} + + + {address} + + + + +