ui: do not clear qr state
This commit is contained in:
parent
c155deedb5
commit
2cfd428c4c
2 changed files with 5 additions and 25 deletions
|
@ -432,10 +432,4 @@ impl QrCodeContent {
|
||||||
}
|
}
|
||||||
Some(img_raw)
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -34,8 +34,6 @@ use crate::wallet::Wallet;
|
||||||
pub struct WalletTransactionModal {
|
pub struct WalletTransactionModal {
|
||||||
/// Transaction identifier.
|
/// Transaction identifier.
|
||||||
tx_id: u32,
|
tx_id: u32,
|
||||||
/// Identifier for [`Slate`].
|
|
||||||
slate_id: Option<String>,
|
|
||||||
|
|
||||||
/// Response Slatepack message input value.
|
/// Response Slatepack message input value.
|
||||||
response_edit: String,
|
response_edit: String,
|
||||||
|
@ -66,11 +64,8 @@ impl WalletTransactionModal {
|
||||||
pub fn new(wallet: &Wallet, tx: &WalletTransaction, show_finalization: bool) -> Self {
|
pub fn new(wallet: &Wallet, tx: &WalletTransaction, show_finalization: bool) -> Self {
|
||||||
Self {
|
Self {
|
||||||
tx_id: tx.data.id,
|
tx_id: tx.data.id,
|
||||||
slate_id: match tx.data.tx_slate_id {
|
response_edit: if !tx.cancelling && !tx.finalizing && !tx.data.confirmed &&
|
||||||
None => None,
|
tx.data.tx_slate_id.is_some() &&
|
||||||
Some(id) => Some(id.to_string())
|
|
||||||
},
|
|
||||||
response_edit: if !tx.data.confirmed && tx.data.tx_slate_id.is_some() &&
|
|
||||||
(tx.data.tx_type == TxLogEntryType::TxSent ||
|
(tx.data.tx_type == TxLogEntryType::TxSent ||
|
||||||
tx.data.tx_type == TxLogEntryType::TxReceived) {
|
tx.data.tx_type == TxLogEntryType::TxReceived) {
|
||||||
let mut slate = Slate::blank(1, false);
|
let mut slate = Slate::blank(1, false);
|
||||||
|
@ -190,13 +185,9 @@ impl WalletTransactionModal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show Slatepack message or reset QR code state if not available.
|
// Show Slatepack message interaction.
|
||||||
if !tx.finalizing && !tx.data.confirmed && !tx.cancelling &&
|
if !self.response_edit.is_empty() {
|
||||||
(tx.data.tx_type == TxLogEntryType::TxSent ||
|
|
||||||
tx.data.tx_type == TxLogEntryType::TxReceived) && !self.response_edit.is_empty() {
|
|
||||||
self.message_ui(ui, tx, wallet, modal, cb);
|
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 {
|
if !self.finalizing {
|
||||||
|
@ -331,11 +322,6 @@ impl WalletTransactionModal {
|
||||||
wallet: &Wallet,
|
wallet: &Wallet,
|
||||||
modal: &Modal,
|
modal: &Modal,
|
||||||
cb: &dyn PlatformCallbacks) {
|
cb: &dyn PlatformCallbacks) {
|
||||||
if self.slate_id.is_none() {
|
|
||||||
cb.hide_keyboard();
|
|
||||||
modal.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ui.add_space(6.0);
|
ui.add_space(6.0);
|
||||||
|
|
||||||
// Draw QR code scanner content if requested.
|
// Draw QR code scanner content if requested.
|
||||||
|
@ -414,7 +400,7 @@ impl WalletTransactionModal {
|
||||||
Id::from("tx_info_message_finalize")
|
Id::from("tx_info_message_finalize")
|
||||||
} else {
|
} else {
|
||||||
Id::from("tx_info_message_request")
|
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());
|
View::horizontal_line(ui, Colors::item_stroke());
|
||||||
ui.add_space(3.0);
|
ui.add_space(3.0);
|
||||||
ScrollArea::vertical()
|
ScrollArea::vertical()
|
||||||
|
|
Loading…
Reference in a new issue