Browse Source

ADD: User confirmation for use of all funds.

keystore
Marcos Rodriguez 5 years ago
committed by Overtorment
parent
commit
ff0f7d17b9
  1. 25
      BlueComponents.js
  2. 36
      screen/send/details.js

25
BlueComponents.js

@ -790,14 +790,31 @@ export class BlueUseAllFundsButton extends Component {
paddingBottom: 12,
}}
>
Total: {loc.formatBalanceWithoutSuffix(this.props.wallet.getBalance(), BitcoinUnit.BTC, true).toString()} {BitcoinUnit.BTC}
Total:
</Text>
{this.props.wallet.allowSendMax() && this.props.wallet.getBalance() > 0 && (
{this.props.wallet.allowSendMax() ? (
<BlueButtonLink
style={{ marginLeft: 8, paddingRight: 0, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
title="Use All"
onPress={this.props.onUseAllPressed}
style={{ marginLeft: 8, paddingRight: 0, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
title={`${loc.formatBalanceWithoutSuffix(this.props.wallet.getBalance(), BitcoinUnit.BTC, true).toString()} ${
BitcoinUnit.BTC
}`}
/>
) : (
<Text
style={{
color: BlueApp.settings.alternativeTextColor,
fontSize: 16,
marginLeft: 8,
marginRight: 0,
paddingRight: 0,
paddingLeft: 0,
paddingTop: 12,
paddingBottom: 12,
}}
>
{loc.formatBalanceWithoutSuffix(this.props.wallet.getBalance(), BitcoinUnit.BTC, true).toString()} {BitcoinUnit.BTC}
</Text>
)}
</View>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'flex-end' }}>

36
screen/send/details.js

@ -4,6 +4,7 @@ import {
ActivityIndicator,
View,
TextInput,
Alert,
StatusBar,
TouchableOpacity,
KeyboardAvoidingView,
@ -724,21 +725,48 @@ export default class SendDetails extends Component {
ios: (
<BlueUseAllFundsButton
onUseAllPressed={() => {
this.setState({ amount: 'MAX' });
ReactNativeHapticFeedback.trigger('notificationWarning');
Alert.alert(
'Use full balance',
`Are you sure you want to use your wallet's full balance for this transaction?`,
[
{
text: loc._.ok,
onPress: async () => {
this.setState({ amount: 'MAX' });
},
style: 'default',
},
{ text: loc.send.details.cancel, onPress: () => {}, style: 'cancel' },
],
{ cancelable: false },
);
Keyboard.dismiss();
}}
wallet={this.state.fromWallet}
visi
/>
),
android: this.state.isAmountToolbarVisibleForAndroid && (
<BlueUseAllFundsButton
onUseAllPressed={() => {
this.setState({ amount: 'MAX' });
Alert.alert(
'Use all funds',
`Are you sure you want to use your all of your wallet's funds for this transaction?`,
[
{
text: loc._.ok,
onPress: async () => {
this.setState({ amount: 'MAX' });
},
style: 'default',
},
{ text: loc.send.details.cancel, onPress: () => {}, style: 'cancel' },
],
{ cancelable: false },
);
Keyboard.dismiss();
}}
wallet={this.state.fromWallet}
visi
/>
),
})}

Loading…
Cancel
Save