mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 15:04:50 +01:00
ADD: See currency when tap and hold on balance
This commit is contained in:
parent
242a6a79c4
commit
2bc0d282a2
2 changed files with 11 additions and 4 deletions
|
@ -81,8 +81,9 @@ export const BlueStorageProvider = ({ children }) => {
|
|||
}, []);
|
||||
|
||||
const getPreferredCurrency = async () => {
|
||||
const item = await getPreferredCurrencyAsyncStorage();
|
||||
const item = JSON.parse(await getPreferredCurrencyAsyncStorage());
|
||||
_setPreferredFiatCurrency(item);
|
||||
return item;
|
||||
};
|
||||
|
||||
const setPreferredFiatCurrency = () => {
|
||||
|
|
|
@ -10,6 +10,7 @@ import loc, { formatBalance } from '../loc';
|
|||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||
import ToolTipMenu from './TooltipMenu';
|
||||
import { BluePrivateBalance } from '../BlueComponents';
|
||||
import { FiatUnit } from '../models/fiatUnit';
|
||||
|
||||
interface TransactionsNavigationHeaderProps {
|
||||
wallet: AbstractWallet;
|
||||
|
@ -40,7 +41,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
|||
const [wallet, setWallet] = useState(initialWallet);
|
||||
const [allowOnchainAddress, setAllowOnchainAddress] = useState(false);
|
||||
|
||||
const context = useContext(BlueStorageContext);
|
||||
const { preferredFiatCurrency, saveToDisk } = useContext(BlueStorageContext);
|
||||
const menuRef = useRef(null);
|
||||
|
||||
const verifyIfWalletAllowsOnchainAddress = useCallback(() => {
|
||||
|
@ -81,7 +82,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
|||
|
||||
const updatedWallet = updateWalletVisibility(wallet, !wallet.hideBalance);
|
||||
setWallet(updatedWallet);
|
||||
context.saveToDisk();
|
||||
saveToDisk();
|
||||
};
|
||||
|
||||
const updateWalletWithNewUnit = (w: AbstractWallet, newPreferredUnit: BitcoinUnit) => {
|
||||
|
@ -155,13 +156,18 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
|||
})()}
|
||||
style={styles.chainIcon}
|
||||
/>
|
||||
|
||||
<Text testID="WalletLabel" numberOfLines={1} style={styles.walletLabel}>
|
||||
{wallet.getLabel()}
|
||||
</Text>
|
||||
<ToolTipMenu
|
||||
onPress={changeWalletBalanceUnit}
|
||||
ref={menuRef}
|
||||
title={loc.wallets.balance}
|
||||
title={`${loc.wallets.balance} (${
|
||||
wallet.getPreferredBalanceUnit() === BitcoinUnit.LOCAL_CURRENCY
|
||||
? preferredFiatCurrency.endPointKey ?? FiatUnit.USD
|
||||
: wallet.getPreferredBalanceUnit()
|
||||
})`}
|
||||
onPressMenuItem={onPressMenuItem}
|
||||
actions={
|
||||
wallet.hideBalance
|
||||
|
|
Loading…
Add table
Reference in a new issue