mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +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 getPreferredCurrency = async () => {
|
||||||
const item = await getPreferredCurrencyAsyncStorage();
|
const item = JSON.parse(await getPreferredCurrencyAsyncStorage());
|
||||||
_setPreferredFiatCurrency(item);
|
_setPreferredFiatCurrency(item);
|
||||||
|
return item;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setPreferredFiatCurrency = () => {
|
const setPreferredFiatCurrency = () => {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import loc, { formatBalance } from '../loc';
|
||||||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||||
import ToolTipMenu from './TooltipMenu';
|
import ToolTipMenu from './TooltipMenu';
|
||||||
import { BluePrivateBalance } from '../BlueComponents';
|
import { BluePrivateBalance } from '../BlueComponents';
|
||||||
|
import { FiatUnit } from '../models/fiatUnit';
|
||||||
|
|
||||||
interface TransactionsNavigationHeaderProps {
|
interface TransactionsNavigationHeaderProps {
|
||||||
wallet: AbstractWallet;
|
wallet: AbstractWallet;
|
||||||
|
@ -40,7 +41,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||||
const [wallet, setWallet] = useState(initialWallet);
|
const [wallet, setWallet] = useState(initialWallet);
|
||||||
const [allowOnchainAddress, setAllowOnchainAddress] = useState(false);
|
const [allowOnchainAddress, setAllowOnchainAddress] = useState(false);
|
||||||
|
|
||||||
const context = useContext(BlueStorageContext);
|
const { preferredFiatCurrency, saveToDisk } = useContext(BlueStorageContext);
|
||||||
const menuRef = useRef(null);
|
const menuRef = useRef(null);
|
||||||
|
|
||||||
const verifyIfWalletAllowsOnchainAddress = useCallback(() => {
|
const verifyIfWalletAllowsOnchainAddress = useCallback(() => {
|
||||||
|
@ -81,7 +82,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||||
|
|
||||||
const updatedWallet = updateWalletVisibility(wallet, !wallet.hideBalance);
|
const updatedWallet = updateWalletVisibility(wallet, !wallet.hideBalance);
|
||||||
setWallet(updatedWallet);
|
setWallet(updatedWallet);
|
||||||
context.saveToDisk();
|
saveToDisk();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateWalletWithNewUnit = (w: AbstractWallet, newPreferredUnit: BitcoinUnit) => {
|
const updateWalletWithNewUnit = (w: AbstractWallet, newPreferredUnit: BitcoinUnit) => {
|
||||||
|
@ -155,13 +156,18 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||||
})()}
|
})()}
|
||||||
style={styles.chainIcon}
|
style={styles.chainIcon}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Text testID="WalletLabel" numberOfLines={1} style={styles.walletLabel}>
|
<Text testID="WalletLabel" numberOfLines={1} style={styles.walletLabel}>
|
||||||
{wallet.getLabel()}
|
{wallet.getLabel()}
|
||||||
</Text>
|
</Text>
|
||||||
<ToolTipMenu
|
<ToolTipMenu
|
||||||
onPress={changeWalletBalanceUnit}
|
onPress={changeWalletBalanceUnit}
|
||||||
ref={menuRef}
|
ref={menuRef}
|
||||||
title={loc.wallets.balance}
|
title={`${loc.wallets.balance} (${
|
||||||
|
wallet.getPreferredBalanceUnit() === BitcoinUnit.LOCAL_CURRENCY
|
||||||
|
? preferredFiatCurrency.endPointKey ?? FiatUnit.USD
|
||||||
|
: wallet.getPreferredBalanceUnit()
|
||||||
|
})`}
|
||||||
onPressMenuItem={onPressMenuItem}
|
onPressMenuItem={onPressMenuItem}
|
||||||
actions={
|
actions={
|
||||||
wallet.hideBalance
|
wallet.hideBalance
|
||||||
|
|
Loading…
Add table
Reference in a new issue