From 2cfd428c4c84ae54829caaeca984e0a0a0823e3d Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 19 Sep 2024 21:39:59 +0300 Subject: [PATCH] ui: do not clear qr state --- src/gui/views/qr.rs | 6 ------ src/gui/views/wallets/wallet/txs/tx.rs | 24 +++++------------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/gui/views/qr.rs b/src/gui/views/qr.rs index 86599cf..a0bf1a4 100644 --- a/src/gui/views/qr.rs +++ b/src/gui/views/qr.rs @@ -432,10 +432,4 @@ impl QrCodeContent { } Some(img_raw) } - - /// Reset QR code image content state to default. - pub fn clear_state(&mut self) { - let mut w_create = self.qr_image_state.write(); - *w_create = QrImageState::default(); - } } \ No newline at end of file diff --git a/src/gui/views/wallets/wallet/txs/tx.rs b/src/gui/views/wallets/wallet/txs/tx.rs index 95a57ca..06395ab 100644 --- a/src/gui/views/wallets/wallet/txs/tx.rs +++ b/src/gui/views/wallets/wallet/txs/tx.rs @@ -34,8 +34,6 @@ use crate::wallet::Wallet; pub struct WalletTransactionModal { /// Transaction identifier. tx_id: u32, - /// Identifier for [`Slate`]. - slate_id: Option, /// Response Slatepack message input value. response_edit: String, @@ -66,11 +64,8 @@ impl WalletTransactionModal { pub fn new(wallet: &Wallet, tx: &WalletTransaction, show_finalization: bool) -> Self { Self { tx_id: tx.data.id, - slate_id: match tx.data.tx_slate_id { - None => None, - Some(id) => Some(id.to_string()) - }, - response_edit: if !tx.data.confirmed && tx.data.tx_slate_id.is_some() && + response_edit: if !tx.cancelling && !tx.finalizing && !tx.data.confirmed && + tx.data.tx_slate_id.is_some() && (tx.data.tx_type == TxLogEntryType::TxSent || tx.data.tx_type == TxLogEntryType::TxReceived) { let mut slate = Slate::blank(1, false); @@ -190,13 +185,9 @@ impl WalletTransactionModal { } } - // Show Slatepack message or reset QR code state if not available. - if !tx.finalizing && !tx.data.confirmed && !tx.cancelling && - (tx.data.tx_type == TxLogEntryType::TxSent || - tx.data.tx_type == TxLogEntryType::TxReceived) && !self.response_edit.is_empty() { + // Show Slatepack message interaction. + if !self.response_edit.is_empty() { self.message_ui(ui, tx, wallet, modal, cb); - } else if let Some(qr_content) = self.qr_code_content.as_mut() { - qr_content.clear_state(); } if !self.finalizing { @@ -331,11 +322,6 @@ impl WalletTransactionModal { wallet: &Wallet, modal: &Modal, cb: &dyn PlatformCallbacks) { - if self.slate_id.is_none() { - cb.hide_keyboard(); - modal.close(); - return; - } ui.add_space(6.0); // Draw QR code scanner content if requested. @@ -414,7 +400,7 @@ impl WalletTransactionModal { Id::from("tx_info_message_finalize") } else { Id::from("tx_info_message_request") - }.with(self.slate_id.clone().unwrap()).with(tx.data.id); + }.with(tx.data.id); View::horizontal_line(ui, Colors::item_stroke()); ui.add_space(3.0); ScrollArea::vertical()