Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
235 changes: 149 additions & 86 deletions views/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
View,
ScrollView,
TouchableOpacity,
TouchableWithoutFeedback
TouchableWithoutFeedback,
Switch
} from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
import { inject, observer } from 'mobx-react';
Expand Down Expand Up @@ -63,6 +64,7 @@ interface SendState {
maxShardAmt: string;
feeLimitSat: string;
message: string;
enableAtomicMultiPathPayment: boolean;
}

@inject(
Expand Down Expand Up @@ -98,7 +100,8 @@ export default class Send extends React.Component<SendProps, SendState> {
maxParts: '16',
maxShardAmt: '',
feeLimitSat: '',
message: ''
message: '',
enableAtomicMultiPathPayment: false
};
}

Expand Down Expand Up @@ -227,10 +230,16 @@ export default class Send extends React.Component<SendProps, SendState> {

sendKeySendPayment = (satAmount: string | number) => {
const { TransactionsStore, navigation } = this.props;
const { destination, maxParts, maxShardAmt, feeLimitSat, message } =
this.state;
const {
destination,
maxParts,
maxShardAmt,
feeLimitSat,
message,
enableAtomicMultiPathPayment
} = this.state;

if (RESTUtils.supportsAMP()) {
if (enableAtomicMultiPathPayment) {
TransactionsStore.sendPayment({
amount: satAmount.toString(),
pubkey: destination,
Expand Down Expand Up @@ -282,7 +291,8 @@ export default class Send extends React.Component<SendProps, SendState> {
maxParts,
maxShardAmt,
feeLimitSat,
message
message,
enableAtomicMultiPathPayment
} = this.state;
const { confirmedBlockchainBalance } = BalanceStore;
const { implementation, settings } = SettingsStore;
Expand Down Expand Up @@ -628,97 +638,146 @@ export default class Send extends React.Component<SendProps, SendState> {
/>
<Text
style={{
...styles.secondaryText,
color: themeColor(
'secondaryText'
)
}}
>
{`${localeString(
'views.PaymentRequest.maxParts'
)} (${localeString(
'general.optional'
)})`}
:
</Text>
<TextInput
keyboardType="numeric"
value={maxParts}
onChangeText={(text: string) =>
this.setState({
maxParts: text
})
}
style={styles.textInput}
/>
<Text
style={{
...styles.text,
...styles.label,
color: themeColor('text'),
paddingBottom: 15
top: 25
}}
>
{localeString(
'views.PaymentRequest.maxPartsDescription'
'views.PaymentRequest.amp'
)}
</Text>
<Text
<View
style={{
...styles.secondaryText,
color: themeColor(
'secondaryText'
)
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end'
}}
>
{`${localeString(
'views.PaymentRequest.feeLimit'
)} (${localeString(
'general.sats'
)}) (${localeString(
'general.optional'
)})`}
:
</Text>
<TextInput
keyboardType="numeric"
placeholder="100"
value={feeLimitSat}
onChangeText={(text: string) =>
this.setState({
feeLimitSat: text
})
}
style={styles.textInput}
/>
<Text
style={{
...styles.secondaryText,
color: themeColor(
'secondaryText'
)
}}
>
{`${localeString(
'views.PaymentRequest.maxShardAmt'
)} (${localeString(
'general.sats'
)}) (${localeString(
'general.optional'
)})`}
:
</Text>
<TextInput
keyboardType="numeric"
value={maxShardAmt}
onChangeText={(text: string) =>
this.setState({
maxShardAmt: text
})
}
style={styles.textInput}
/>
<View
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end'
}}
>
<Switch
value={
enableAtomicMultiPathPayment
}
onValueChange={() =>
this.setState({
enableAtomicMultiPathPayment:
!enableAtomicMultiPathPayment
})
}
trackColor={{
false: '#767577',
true: themeColor(
'highlight'
)
}}
/>
</View>
</View>
</React.Fragment>
)}
{RESTUtils.supportsAMP() &&
enableAtomicMultiPathPayment && (
<React.Fragment>
<Text
style={{
...styles.secondaryText,
color: themeColor(
'secondaryText'
)
}}
>
{`${localeString(
'views.PaymentRequest.maxParts'
)} (${localeString(
'general.optional'
)})`}
:
</Text>
<TextInput
keyboardType="numeric"
value={maxParts}
onChangeText={(text: string) =>
this.setState({
maxParts: text
})
}
style={styles.textInput}
/>
<Text
style={{
...styles.text,
color: themeColor('text'),
paddingBottom: 15
}}
>
{localeString(
'views.PaymentRequest.maxPartsDescription'
)}
</Text>
<Text
style={{
...styles.secondaryText,
color: themeColor(
'secondaryText'
)
}}
>
{`${localeString(
'views.PaymentRequest.feeLimit'
)} (${localeString(
'general.sats'
)}) (${localeString(
'general.optional'
)})`}
:
</Text>
<TextInput
keyboardType="numeric"
placeholder="100"
value={feeLimitSat}
onChangeText={(text: string) =>
this.setState({
feeLimitSat: text
})
}
style={styles.textInput}
/>
<Text
style={{
...styles.secondaryText,
color: themeColor(
'secondaryText'
)
}}
>
{`${localeString(
'views.PaymentRequest.maxShardAmt'
)} (${localeString(
'general.sats'
)}) (${localeString(
'general.optional'
)})`}
:
</Text>
<TextInput
keyboardType="numeric"
value={maxShardAmt}
onChangeText={(text: string) =>
this.setState({
maxShardAmt: text
})
}
style={styles.textInput}
/>
</React.Fragment>
)}
<View style={styles.button}>
<Button
title={localeString('general.send')}
Expand Down Expand Up @@ -848,5 +907,9 @@ const styles = StyleSheet.create({
editFeeButton: {
paddingTop: 15,
alignItems: 'center'
},
label: {
fontFamily: 'Lato-Regular',
paddingTop: 5
}
});