ui: ability to finalize tx only when wallet is loaded

This commit is contained in:
ardocrat 2024-09-14 21:21:03 +03:00
parent 150a0de1c4
commit d6ec4213ab
2 changed files with 6 additions and 4 deletions

View file

@ -204,8 +204,10 @@ impl WalletTransactions {
}); });
} }
let wallet_loaded = wallet.foreign_api_port().is_some();
// Draw button to show transaction finalization. // Draw button to show transaction finalization.
if tx.can_finalize { if wallet_loaded && tx.can_finalize {
let (icon, color) = (CHECK, Some(Colors::green())); let (icon, color) = (CHECK, Some(Colors::green()));
View::item_button(ui, Rounding::default(), icon, color, || { View::item_button(ui, Rounding::default(), icon, color, || {
cb.hide_keyboard(); cb.hide_keyboard();
@ -214,7 +216,6 @@ impl WalletTransactions {
} }
// Draw button to cancel transaction. // Draw button to cancel transaction.
let wallet_loaded = wallet.foreign_api_port().is_some();
if wallet_loaded && tx.can_cancel() { if wallet_loaded && tx.can_cancel() {
let (icon, color) = (PROHIBIT, Some(Colors::red())); let (icon, color) = (PROHIBIT, Some(Colors::red()));
View::item_button(ui, Rounding::default(), icon, color, || { View::item_button(ui, Rounding::default(), icon, color, || {

View file

@ -140,8 +140,10 @@ impl WalletTransactionModal {
return; return;
} }
let wallet_loaded = wallet.foreign_api_port().is_some();
// Draw button to show transaction finalization or transaction info. // Draw button to show transaction finalization or transaction info.
if tx.can_finalize { if wallet_loaded && tx.can_finalize {
let (icon, color) = if self.show_finalization { let (icon, color) = if self.show_finalization {
(FILE_TEXT, None) (FILE_TEXT, None)
} else { } else {
@ -161,7 +163,6 @@ impl WalletTransactionModal {
} }
// Draw button to cancel transaction. // Draw button to cancel transaction.
let wallet_loaded = wallet.foreign_api_port().is_some();
if wallet_loaded && tx.can_cancel() { if wallet_loaded && tx.can_cancel() {
View::item_button(ui, Rounding::default(), PROHIBIT, Some(Colors::red()), || { View::item_button(ui, Rounding::default(), PROHIBIT, Some(Colors::red()), || {
cb.hide_keyboard(); cb.hide_keyboard();