From 764a6eb78774f83a55d71eacafc3dc7c3fbc90f0 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 30 May 2024 14:18:48 +0300 Subject: [PATCH] fix: hide qr on confirmed tx at modal, current wallet connection check --- src/gui/views/wallets/setup/connection.rs | 4 ++-- src/gui/views/wallets/wallet/txs.rs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/views/wallets/setup/connection.rs b/src/gui/views/wallets/setup/connection.rs index 59701bd..0065da0 100644 --- a/src/gui/views/wallets/setup/connection.rs +++ b/src/gui/views/wallets/setup/connection.rs @@ -271,8 +271,8 @@ impl ConnectionSetup { ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| { // Draw button to select connection. let is_current_method = if let Some(wallet) = wallet { - if let Some(cur) = wallet.get_current_ext_conn() { - &cur == conn + if let Some(cur) = wallet.get_config().ext_conn_id { + cur == conn.id } else { false } diff --git a/src/gui/views/wallets/wallet/txs.rs b/src/gui/views/wallets/wallet/txs.rs index cd9bd35..86f5367 100644 --- a/src/gui/views/wallets/wallet/txs.rs +++ b/src/gui/views/wallets/wallet/txs.rs @@ -554,11 +554,14 @@ impl WalletTransactions { } } - // Show transaction Slatepack message response or finalization input. + // Show Slatepack message or reset flag to show QR if not available. if !tx.posting && !tx.data.confirmed && !tx.cancelling && (tx.data.tx_type == TxLogEntryType::TxSent || tx.data.tx_type == TxLogEntryType::TxReceived) { self.tx_info_modal_slate_ui(ui, tx, wallet, modal, cb); + } else if self.tx_info_show_qr { + self.tx_info_qr_code_content.clear_state(); + self.tx_info_show_qr = false; } ui.add_space(8.0); @@ -589,6 +592,7 @@ impl WalletTransactions { cols[0].vertical_centered_justified(|ui| { View::button(ui, t!("close"), Colors::white_or_black(false), || { cb.stop_camera(); + self.tx_info_scanner_content.clear_state(); self.tx_info_show_scanner = false; modal.close(); }); @@ -596,6 +600,7 @@ impl WalletTransactions { cols[1].vertical_centered_justified(|ui| { View::button(ui, t!("back"), Colors::white_or_black(false), || { cb.stop_camera(); + self.tx_info_scanner_content.clear_state(); self.tx_info_show_scanner = false; modal.enable_closing(); }); @@ -711,6 +716,7 @@ impl WalletTransactions { self.on_finalization_input_change(tx, wallet, modal, cb); modal.enable_closing(); + self.tx_info_scanner_content.clear_state(); self.tx_info_show_scanner = false; } else { self.tx_info_scanner_content.ui(ui, cb); @@ -770,6 +776,7 @@ impl WalletTransactions { if self.tx_info_show_qr { let text = message_edit.clone(); if text.is_empty() { + self.tx_info_qr_code_content.clear_state(); self.tx_info_show_qr = false; } else { // Draw QR code content.