This commit is contained in:
Marcos Rodriguez Velez 2024-09-15 12:15:29 -04:00
commit 7830eccc4a
10 changed files with 108 additions and 61 deletions

View File

@ -0,0 +1,53 @@
import React, { useCallback, useMemo } from 'react';
import { StyleSheet, TouchableOpacity, GestureResponderEvent } from 'react-native';
import { Icon } from '@rneui/themed';
import { useTheme } from './themes';
import ToolTipMenu from './TooltipMenu';
import { CommonToolTipActions } from '../typings/CommonToolTipActions';
import loc from '../loc';
import { navigationRef } from '../NavigationService';
type AddWalletButtonProps = {
onPress?: (event: GestureResponderEvent) => void;
};
const styles = StyleSheet.create({
ball: {
width: 30,
height: 30,
borderRadius: 15,
justifyContent: 'center',
alignContent: 'center',
},
});
const AddWalletButton: React.FC<AddWalletButtonProps> = ({ onPress }) => {
const { colors } = useTheme();
const stylesHook = StyleSheet.create({
ball: {
backgroundColor: colors.buttonBackgroundColor,
},
});
const onPressMenuItem = useCallback((action: string) => {
switch (action) {
case CommonToolTipActions.ImportWallet.id:
navigationRef.current?.navigate('AddWalletRoot', { screen: 'ImportWallet' });
break;
default:
break;
}
}, []);
const actions = useMemo(() => [CommonToolTipActions.ImportWallet], []);
return (
<ToolTipMenu accessibilityRole="button" accessibilityLabel={loc.wallets.add_title} onPressMenuItem={onPressMenuItem} actions={actions}>
<TouchableOpacity style={[styles.ball, stylesHook.ball]} onPress={onPress}>
<Icon name="add" size={22} type="ionicons" color={colors.foregroundColor} />
</TouchableOpacity>
</ToolTipMenu>
);
};
export default AddWalletButton;

View File

@ -1,7 +1,7 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import PlusIcon from './icons/PlusIcon';
import { useTheme } from './themes';
import AddWalletButton from './AddWalletButton';
interface HeaderProps {
leftText: string;
@ -25,7 +25,7 @@ export const Header: React.FC<HeaderProps> = ({ leftText, isDrawerList, onNewWal
return (
<View style={[styles.root, styleWithProps.root]}>
<Text style={[styles.text, styleWithProps.text]}>{leftText}</Text>
{onNewWalletPress && <PlusIcon onPress={onNewWalletPress} />}
{onNewWalletPress && <AddWalletButton onPress={onNewWalletPress} />}
</View>
);
};

View File

@ -1,42 +0,0 @@
import React from 'react';
import { StyleSheet, TouchableOpacity, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed';
import { useTheme } from '../themes';
import loc from '../../loc';
type PlusIconProps = {
onPress: () => void;
};
const styles = StyleSheet.create({
ball: {
width: 30,
height: 30,
borderRadius: 15,
justifyContent: 'center',
alignContent: 'center',
} as ViewStyle,
});
const PlusIcon: React.FC<PlusIconProps> = ({ onPress }) => {
const { colors } = useTheme();
const stylesHook = StyleSheet.create({
ball: {
backgroundColor: colors.buttonBackgroundColor,
},
});
return (
<TouchableOpacity
style={[styles.ball, stylesHook.ball]}
accessibilityLabel={loc.wallets.add_title}
onPress={onPress}
accessibilityRole="button"
>
<Icon name="add" size={22} type="ionicons" color={colors.foregroundColor} />
</TouchableOpacity>
);
};
export default PlusIcon;

View File

@ -1,9 +1,11 @@
import React from 'react';
import React, { useCallback, useMemo } from 'react';
import { StyleSheet, TouchableOpacity } from 'react-native';
import { Icon } from '@rneui/themed';
import { useTheme } from '../themes';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import loc from '../../loc';
import ToolTipMenu from '../TooltipMenu';
import { CommonToolTipActions } from '../../typings/CommonToolTipActions';
const SettingsButton = () => {
const { colors } = useTheme();
@ -12,16 +14,32 @@ const SettingsButton = () => {
navigate('Settings');
};
const onPressMenuItem = useCallback(
(menuItem: string) => {
switch (menuItem) {
case CommonToolTipActions.ManageWallet.id:
navigate('ManageWallets');
break;
default:
break;
}
},
[navigate],
);
const actions = useMemo(() => [CommonToolTipActions.ManageWallet], []);
return (
<TouchableOpacity
accessibilityRole="button"
accessibilityLabel={loc.settings.default_title}
testID="SettingsButton"
style={[style.buttonStyle, { backgroundColor: colors.lightButton }]}
onPress={onPress}
>
<Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} />
</TouchableOpacity>
<ToolTipMenu onPressMenuItem={onPressMenuItem} actions={actions}>
<TouchableOpacity
accessibilityRole="button"
accessibilityLabel={loc.settings.default_title}
testID="SettingsButton"
style={[style.buttonStyle, { backgroundColor: colors.lightButton }]}
onPress={onPress}
>
<Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} />
</TouchableOpacity>
</ToolTipMenu>
);
};

View File

@ -58,7 +58,6 @@ import SignVerifyStackRoot from './SignVerifyStack';
import ViewEditMultisigCosignersStackRoot from './ViewEditMultisigCosignersStack';
import WalletExportStack from './WalletExportStack';
import WalletXpubStackRoot from './WalletXpubStack';
import PlusIcon from '../components/icons/PlusIcon';
import SettingsButton from '../components/icons/SettingsButton';
import ExportMultisigCoordinationSetupStack from './ExportMultisigCoordinationSetupStack';
import ManageWallets from '../screen/wallets/ManageWallets';
@ -66,6 +65,7 @@ import getWalletTransactionsOptions from './helpers/getWalletTransactionsOptions
import { useSettings } from '../hooks/context/useSettings';
import { useStorage } from '../hooks/context/useStorage';
import WalletTransactions from '../screen/wallets/WalletTransactions';
import AddWalletButton from '../components/AddWalletButton';
const DetailViewStackScreensStack = () => {
const theme = useTheme();
@ -82,7 +82,7 @@ const DetailViewStackScreensStack = () => {
const RightBarButtons = useMemo(
() => (
<>
<PlusIcon onPress={navigateToAddWallet} />
<AddWalletButton onPress={navigateToAddWallet} />
<View style={styles.width24} />
<SettingsButton />
</>

4
package-lock.json generated
View File

@ -29,7 +29,7 @@
"@remobile/react-native-qrcode-local-image": "github:BlueWallet/react-native-qrcode-local-image#31b0113110fbafcf5a5f3ca4183a563550f5c352",
"@rneui/base": "4.0.0-rc.8",
"@rneui/themed": "4.0.0-rc.8",
"@spsina/bip47": "github:BlueWallet/bip47#f4b8047",
"@spsina/bip47": "github:BlueWallet/bip47#df82345",
"aezeed": "0.0.5",
"assert": "2.1.0",
"base-x": "4.0.0",
@ -6366,7 +6366,7 @@
},
"node_modules/@spsina/bip47": {
"version": "1.0.1",
"resolved": "git+ssh://git@github.com/BlueWallet/bip47.git#f4b8047c7efbe382c268b3074a4956698087f984",
"resolved": "git+ssh://git@github.com/BlueWallet/bip47.git#df823454092a9993edeea11d663f8eb9a522a174",
"license": "MIT",
"dependencies": {
"bip32": "^3.0.1",

View File

@ -93,7 +93,7 @@
"@remobile/react-native-qrcode-local-image": "github:BlueWallet/react-native-qrcode-local-image#31b0113110fbafcf5a5f3ca4183a563550f5c352",
"@rneui/base": "4.0.0-rc.8",
"@rneui/themed": "4.0.0-rc.8",
"@spsina/bip47": "github:BlueWallet/bip47#f4b8047",
"@spsina/bip47": "github:BlueWallet/bip47#df82345",
"aezeed": "0.0.5",
"assert": "2.1.0",
"base-x": "4.0.0",

View File

@ -34,7 +34,7 @@ const styles = StyleSheet.create({
borderRadius: 20,
position: 'absolute',
left: 16,
top: 44,
top: 55,
},
closeImage: {
alignSelf: 'center',

View File

@ -18,7 +18,7 @@
renderTorchButton() {
- return (!this.isCaptureRetakeMode() && (<TouchableOpacity style={{ paddingHorizontal: 15 }} onPress={() => this.onSetTorch()}>
- <Image style={[{ flex: 1, justifyContent: 'center' }, this.props.torchImageStyle]} source={this.state.torchMode ? this.props.torchOnImage : this.props.torchOffImage} resizeMode="contain"/>
+ return (!this.isCaptureRetakeMode() && (<TouchableOpacity style={{ backgroundColor: '#FFFFFF', borderRadius: 20 }} onPress={() => this.onSetTorch()}>
+ return (!this.isCaptureRetakeMode() && (<TouchableOpacity style={{ backgroundColor: '#FFFFFF', borderRadius: 20, height: 40, marginHorizontal: 15 }} onPress={() => this.onSetTorch()}>
+ <Image style={[{ width: 40, height: 40, justifyContent: 'center' }, this.props.torchImageStyle]} source={this.state.torchMode ? this.props.torchOnImage : this.props.torchOffImage} resizeMode="contain"/>
</TouchableOpacity>));
}

View File

@ -7,6 +7,8 @@ const keys = {
OpenInBlockExplorer: 'open_in_blockExplorer',
CopyAmount: 'copyAmount',
CopyNote: 'copyNote',
ManageWallets: 'manageWallets',
ImportWallet: 'importWallet',
HideBalance: 'hideBalance',
ViewInBitcoin: 'viewInBitcoin',
ViewInSats: 'viewInSats',
@ -35,6 +37,12 @@ const icons = {
Note: {
iconValue: 'note.text',
},
ManageWallets: {
iconValue: 'slider.horizontal.3',
},
ImportWallet: {
iconValue: 'square.and.arrow.down.on.square',
},
ViewInBitcoin: {
iconValue: 'bitcoinsign.circle',
},
@ -92,6 +100,16 @@ export const CommonToolTipActions = {
text: loc.transactions.details_copy_note,
icon: icons.Clipboard,
},
ManageWallet: {
id: keys.ManageWallets,
text: loc.wallets.manage_title,
icon: icons.ManageWallets,
},
ImportWallet: {
id: keys.ImportWallet,
text: loc.wallets.add_import_wallet,
icon: icons.ImportWallet,
},
HideBalance: {
id: keys.HideBalance,
text: loc.transactions.details_balance_hide,