fix: hide qr on confirmed tx at modal, current wallet connection check

This commit is contained in:
ardocrat 2024-05-30 14:18:48 +03:00
parent 412b93bab7
commit 764a6eb787
2 changed files with 10 additions and 3 deletions

View file

@ -271,8 +271,8 @@ impl ConnectionSetup {
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| { ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
// Draw button to select connection. // Draw button to select connection.
let is_current_method = if let Some(wallet) = wallet { let is_current_method = if let Some(wallet) = wallet {
if let Some(cur) = wallet.get_current_ext_conn() { if let Some(cur) = wallet.get_config().ext_conn_id {
&cur == conn cur == conn.id
} else { } else {
false false
} }

View file

@ -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 && if !tx.posting && !tx.data.confirmed && !tx.cancelling &&
(tx.data.tx_type == TxLogEntryType::TxSent || (tx.data.tx_type == TxLogEntryType::TxSent ||
tx.data.tx_type == TxLogEntryType::TxReceived) { tx.data.tx_type == TxLogEntryType::TxReceived) {
self.tx_info_modal_slate_ui(ui, tx, wallet, modal, cb); 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); ui.add_space(8.0);
@ -589,6 +592,7 @@ impl WalletTransactions {
cols[0].vertical_centered_justified(|ui| { cols[0].vertical_centered_justified(|ui| {
View::button(ui, t!("close"), Colors::white_or_black(false), || { View::button(ui, t!("close"), Colors::white_or_black(false), || {
cb.stop_camera(); cb.stop_camera();
self.tx_info_scanner_content.clear_state();
self.tx_info_show_scanner = false; self.tx_info_show_scanner = false;
modal.close(); modal.close();
}); });
@ -596,6 +600,7 @@ impl WalletTransactions {
cols[1].vertical_centered_justified(|ui| { cols[1].vertical_centered_justified(|ui| {
View::button(ui, t!("back"), Colors::white_or_black(false), || { View::button(ui, t!("back"), Colors::white_or_black(false), || {
cb.stop_camera(); cb.stop_camera();
self.tx_info_scanner_content.clear_state();
self.tx_info_show_scanner = false; self.tx_info_show_scanner = false;
modal.enable_closing(); modal.enable_closing();
}); });
@ -711,6 +716,7 @@ impl WalletTransactions {
self.on_finalization_input_change(tx, wallet, modal, cb); self.on_finalization_input_change(tx, wallet, modal, cb);
modal.enable_closing(); modal.enable_closing();
self.tx_info_scanner_content.clear_state();
self.tx_info_show_scanner = false; self.tx_info_show_scanner = false;
} else { } else {
self.tx_info_scanner_content.ui(ui, cb); self.tx_info_scanner_content.ui(ui, cb);
@ -770,6 +776,7 @@ impl WalletTransactions {
if self.tx_info_show_qr { if self.tx_info_show_qr {
let text = message_edit.clone(); let text = message_edit.clone();
if text.is_empty() { if text.is_empty() {
self.tx_info_qr_code_content.clear_state();
self.tx_info_show_qr = false; self.tx_info_show_qr = false;
} else { } else {
// Draw QR code content. // Draw QR code content.