mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 23:27:26 +01:00
Merge pull request #2181 from BlueWallet/successreuse
REF: Reuse Success screen
This commit is contained in:
commit
ed27ca799c
5 changed files with 17 additions and 33 deletions
|
@ -143,6 +143,14 @@ const WalletsRoot = () => (
|
||||||
<WalletsStack.Screen name="Broadcast" component={Broadcast} options={Broadcast.navigationOptions} />
|
<WalletsStack.Screen name="Broadcast" component={Broadcast} options={Broadcast.navigationOptions} />
|
||||||
<WalletsStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions} />
|
<WalletsStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions} />
|
||||||
<WalletsStack.Screen name="LnurlPaySuccess" component={LnurlPaySuccess} options={LnurlPaySuccess.navigationOptions} />
|
<WalletsStack.Screen name="LnurlPaySuccess" component={LnurlPaySuccess} options={LnurlPaySuccess.navigationOptions} />
|
||||||
|
<WalletsStack.Screen
|
||||||
|
name="Success"
|
||||||
|
component={Success}
|
||||||
|
options={{
|
||||||
|
headerShown: false,
|
||||||
|
gestureEnabled: false,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</WalletsStack.Navigator>
|
</WalletsStack.Navigator>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,13 @@ import loc from '../../loc';
|
||||||
import { useNavigation, useRoute, useTheme } from '@react-navigation/native';
|
import { useNavigation, useRoute, useTheme } from '@react-navigation/native';
|
||||||
|
|
||||||
const Success = () => {
|
const Success = () => {
|
||||||
|
const pop = () => {
|
||||||
|
dangerouslyGetParent().pop();
|
||||||
|
};
|
||||||
|
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
const { dangerouslyGetParent } = useNavigation();
|
const { dangerouslyGetParent } = useNavigation();
|
||||||
const { amount = 0, fee = 0, amountUnit = BitcoinUnit.BTC, invoiceDescription = '' } = useRoute().params;
|
const { amount = 0, fee = 0, amountUnit = BitcoinUnit.BTC, invoiceDescription = '', onDonePressed = pop } = useRoute().params;
|
||||||
const animationRef = useRef();
|
const animationRef = useRef();
|
||||||
const stylesHook = StyleSheet.create({
|
const stylesHook = StyleSheet.create({
|
||||||
root: {
|
root: {
|
||||||
|
@ -29,9 +33,6 @@ const Success = () => {
|
||||||
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
const pop = () => {
|
|
||||||
dangerouslyGetParent().pop();
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
animationRef.current.reset();
|
animationRef.current.reset();
|
||||||
|
@ -84,7 +85,7 @@ const Success = () => {
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.buttonContainer}>
|
<View style={styles.buttonContainer}>
|
||||||
<BlueButton onPress={pop} title={loc.send.success_done} />
|
<BlueButton onPress={onDonePressed} title={loc.send.success_done} />
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,7 +14,6 @@ import {
|
||||||
BlueText,
|
BlueText,
|
||||||
BlueSpacing,
|
BlueSpacing,
|
||||||
BlueNavigationStyle,
|
BlueNavigationStyle,
|
||||||
BlueBigCheckmark,
|
|
||||||
} from '../../BlueComponents';
|
} from '../../BlueComponents';
|
||||||
import { BlueCurrentTheme } from '../../components/themes';
|
import { BlueCurrentTheme } from '../../components/themes';
|
||||||
import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
||||||
|
@ -101,7 +100,6 @@ export default class CPFP extends Component {
|
||||||
await BlueElectrum.waitTillConnected();
|
await BlueElectrum.waitTillConnected();
|
||||||
const result = await this.state.wallet.broadcastTx(this.state.txhex);
|
const result = await this.state.wallet.broadcastTx(this.state.txhex);
|
||||||
if (result) {
|
if (result) {
|
||||||
this.setState({ stage: 3, isLoading: false });
|
|
||||||
this.onSuccessBroadcast();
|
this.onSuccessBroadcast();
|
||||||
} else {
|
} else {
|
||||||
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
|
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
|
||||||
|
@ -119,6 +117,7 @@ export default class CPFP extends Component {
|
||||||
onSuccessBroadcast() {
|
onSuccessBroadcast() {
|
||||||
this.context.txMetadata[this.state.newTxid] = { memo: 'Child pays for parent (CPFP)' };
|
this.context.txMetadata[this.state.newTxid] = { memo: 'Child pays for parent (CPFP)' };
|
||||||
Notifications.majorTomToGroundControl([], [], [this.state.newTxid]);
|
Notifications.majorTomToGroundControl([], [], [this.state.newTxid]);
|
||||||
|
this.props.navigation.navigate('Success', { onDonePressed: () => this.props.navigation.popToTop(), amount: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -203,20 +202,6 @@ export default class CPFP extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderStage3() {
|
|
||||||
return (
|
|
||||||
<SafeBlueArea style={styles.doneWrap}>
|
|
||||||
<BlueCard style={styles.center}>
|
|
||||||
<View style={styles.doneCard} />
|
|
||||||
</BlueCard>
|
|
||||||
<BlueBigCheckmark style={styles.blueBigCheckmark} />
|
|
||||||
<BlueCard>
|
|
||||||
<BlueButton onPress={() => this.props.navigation.popToTop()} title={loc.send.success_done} />
|
|
||||||
</BlueCard>
|
|
||||||
</SafeBlueArea>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.isLoading) {
|
if (this.state.isLoading) {
|
||||||
return (
|
return (
|
||||||
|
@ -226,10 +211,6 @@ export default class CPFP extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.stage === 3) {
|
|
||||||
return this.renderStage3();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state.stage === 2) {
|
if (this.state.stage === 2) {
|
||||||
return this.renderStage2();
|
return this.renderStage2();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ export default class RBFBumpFee extends CPFP {
|
||||||
if (this.context.txMetadata[this.state.txid]) {
|
if (this.context.txMetadata[this.state.txid]) {
|
||||||
this.context.txMetadata[this.state.newTxid] = this.context.txMetadata[this.state.txid];
|
this.context.txMetadata[this.state.newTxid] = this.context.txMetadata[this.state.txid];
|
||||||
}
|
}
|
||||||
|
this.props.navigation.navigate('Success', { onDonePressed: () => this.props.navigation.popToTop(), amount: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -76,10 +77,6 @@ export default class RBFBumpFee extends CPFP {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.stage === 3) {
|
|
||||||
return this.renderStage3();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state.stage === 2) {
|
if (this.state.stage === 2) {
|
||||||
return this.renderStage2();
|
return this.renderStage2();
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ export default class RBFCancel extends CPFP {
|
||||||
} else {
|
} else {
|
||||||
this.context.txMetadata[this.state.newTxid].memo = 'Cancelled transaction';
|
this.context.txMetadata[this.state.newTxid].memo = 'Cancelled transaction';
|
||||||
}
|
}
|
||||||
|
this.props.navigation.navigate('Success', { onDonePressed: () => this.props.navigation.popToTop(), amount: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -86,10 +87,6 @@ export default class RBFCancel extends CPFP {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.stage === 3) {
|
|
||||||
return this.renderStage3();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state.stage === 2) {
|
if (this.state.stage === 2) {
|
||||||
return this.renderStage2();
|
return this.renderStage2();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue