Skip to content

Commit

Permalink
fix missing confirmation screen passport RBF
Browse files Browse the repository at this point in the history
  • Loading branch information
InvertedX committed May 21, 2024
1 parent 17b1e4e commit 409aa4b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
16 changes: 10 additions & 6 deletions lib/ui/home/cards/accounts/spend/rbf/rbf_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,18 @@ class _TxRBFButtonState extends ConsumerState<TxRBFButton> {
});
}
} catch (e) {
setState(() {
_isLoading = false;
});
if (mounted) {
setState(() {
_isLoading = false;
});
}
kPrint(e);
} finally {
setState(() {
_isLoading = false;
});
if (mounted) {
setState(() {
_isLoading = false;
});
}
}
}

Expand Down
38 changes: 35 additions & 3 deletions lib/ui/home/cards/accounts/spend/rbf/rbf_spend_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class _RBFSpendScreenState extends ConsumerState<RBFSpendScreen> {
bool _warningShown = false;
bool _inputsChanged = false;
RawTransaction? _rawTransaction;
Psbt? finalizedPsbt;

@override
void initState() {
Expand Down Expand Up @@ -179,8 +180,7 @@ class _RBFSpendScreenState extends ConsumerState<RBFSpendScreen> {
Opacity(
opacity: _rebuildingTx ? 0.3 : 1,
child: EnvoyButton(
label: S()
.replaceByFee_coindetails_overlay_modal_heading,
label: getButtonText(context),
state: ButtonState.defaultState,
onTap: !_rebuildingTx
? () => _boostTx(context)
Expand Down Expand Up @@ -566,14 +566,22 @@ class _RBFSpendScreenState extends ConsumerState<RBFSpendScreen> {
if (account.wallet.hot) {
broadcastTx(account, psbt, context);
} else {
if (finalizedPsbt != null) {
broadcastTx(account, psbt, context);
return;
}
await Navigator.of(context, rootNavigator: false).push(MaterialPageRoute(
builder: (context) => background(
child: PsbtCard(
psbt,
account,
onSignedPsbtScanned: (psbt) {
Navigator.pop(context);
broadcastTx(account, psbt, context);
if (mounted) {
setState(() {
finalizedPsbt = psbt;
});
}
},
),
context: context)));
Expand Down Expand Up @@ -967,9 +975,33 @@ class _RBFSpendScreenState extends ConsumerState<RBFSpendScreen> {
),
).show(context);
return;
} else {
if (context.mounted) {
EnvoyToast(
backgroundColor: EnvoyColors.danger,
replaceExisting: true,
duration: const Duration(seconds: 4),
message: "Error: unable construct transaction,changes rever",
// TODO: Figma
icon: const Icon(
Icons.info_outline,
color: EnvoyColors.solidWhite,
),
).show(context);
}
}
}
}
}
}

String getButtonText(BuildContext context) {
Account? account = ref.read(selectedAccountProvider);
if (account != null && !account.wallet.hot) {
if (finalizedPsbt == null) {
return S().coincontrol_txDetail_cta1_passport;
}
}
return S().replaceByFee_coindetails_overlay_modal_heading;
}
}

0 comments on commit 409aa4b

Please sign in to comment.