From d6ec4213abc797db3dc26682eae59102b515ae82 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Sat, 14 Sep 2024 21:21:03 +0300 Subject: [PATCH] ui: ability to finalize tx only when wallet is loaded --- src/gui/views/wallets/wallet/txs/content.rs | 5 +++-- src/gui/views/wallets/wallet/txs/tx.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/views/wallets/wallet/txs/content.rs b/src/gui/views/wallets/wallet/txs/content.rs index b1d98d0..e7a63dd 100644 --- a/src/gui/views/wallets/wallet/txs/content.rs +++ b/src/gui/views/wallets/wallet/txs/content.rs @@ -204,8 +204,10 @@ impl WalletTransactions { }); } + let wallet_loaded = wallet.foreign_api_port().is_some(); + // Draw button to show transaction finalization. - if tx.can_finalize { + if wallet_loaded && tx.can_finalize { let (icon, color) = (CHECK, Some(Colors::green())); View::item_button(ui, Rounding::default(), icon, color, || { cb.hide_keyboard(); @@ -214,7 +216,6 @@ impl WalletTransactions { } // Draw button to cancel transaction. - let wallet_loaded = wallet.foreign_api_port().is_some(); if wallet_loaded && tx.can_cancel() { let (icon, color) = (PROHIBIT, Some(Colors::red())); View::item_button(ui, Rounding::default(), icon, color, || { diff --git a/src/gui/views/wallets/wallet/txs/tx.rs b/src/gui/views/wallets/wallet/txs/tx.rs index 8bcc89a..cfc4ae7 100644 --- a/src/gui/views/wallets/wallet/txs/tx.rs +++ b/src/gui/views/wallets/wallet/txs/tx.rs @@ -140,8 +140,10 @@ impl WalletTransactionModal { return; } + let wallet_loaded = wallet.foreign_api_port().is_some(); + // 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 { (FILE_TEXT, None) } else { @@ -161,7 +163,6 @@ impl WalletTransactionModal { } // Draw button to cancel transaction. - let wallet_loaded = wallet.foreign_api_port().is_some(); if wallet_loaded && tx.can_cancel() { View::item_button(ui, Rounding::default(), PROHIBIT, Some(Colors::red()), || { cb.hide_keyboard();