diff --git a/gui/src/app/view/hw.rs b/gui/src/app/view/hw.rs index a44e0ca4..05cacf60 100644 --- a/gui/src/app/view/hw.rs +++ b/gui/src/app/view/hw.rs @@ -6,6 +6,7 @@ use crate::{ app::view::message::*, hw::{HardwareWallet, UnsupportedReason}, }; +use async_hwi::DeviceKind; pub fn hw_list_view( i: usize, @@ -52,7 +53,6 @@ pub fn hw_list_view( UnsupportedReason::NotPartOfWallet(fg) => { hw::unrelated_hardware_wallet(&kind.to_string(), version.as_ref(), fg) } - _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, HardwareWallet::Locked { @@ -111,7 +111,6 @@ pub fn hw_list_view_for_registration( UnsupportedReason::NotPartOfWallet(fg) => { hw::unrelated_hardware_wallet(&kind.to_string(), version.as_ref(), fg) } - _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, HardwareWallet::Locked { @@ -134,7 +133,7 @@ pub fn hw_list_view_verify_address( hw: &HardwareWallet, chosen: bool, ) -> Element { - let mut bttn = Button::new(match hw { + let (content, selectable) = match hw { HardwareWallet::Supported { kind, version, @@ -143,9 +142,32 @@ pub fn hw_list_view_verify_address( .. } => { if chosen { - hw::processing_hardware_wallet(kind, version.as_ref(), fingerprint, alias.as_ref()) + ( + hw::processing_hardware_wallet( + kind, + version.as_ref(), + fingerprint, + alias.as_ref(), + ), + false, + ) } else { - hw::supported_hardware_wallet(kind, version.as_ref(), fingerprint, alias.as_ref()) + match kind { + DeviceKind::Specter | DeviceKind::SpecterSimulator => { + (hw::unimplemented_method_hardware_wallet( + &kind.to_string(), + version.as_ref(), + fingerprint, + "Liana cannot request the device to display the address. \n The verification must be done manually with the device control." + ), false) + } + _ => (hw::supported_hardware_wallet( + kind, + version.as_ref(), + fingerprint, + alias.as_ref(), + ), true), + } } } HardwareWallet::Unsupported { @@ -153,20 +175,26 @@ pub fn hw_list_view_verify_address( kind, reason, .. - } => match reason { - UnsupportedReason::NotPartOfWallet(fg) => { - hw::unrelated_hardware_wallet(&kind.to_string(), version.as_ref(), fg) - } - - _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), - }, + } => ( + match reason { + UnsupportedReason::NotPartOfWallet(fg) => { + hw::unrelated_hardware_wallet(&kind.to_string(), version.as_ref(), fg) + } + _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), + }, + false, + ), HardwareWallet::Locked { kind, pairing_code, .. - } => hw::locked_hardware_wallet(kind, pairing_code.as_ref()), - }) - .style(theme::Button::Border) - .width(Length::Fill); - if !chosen && hw.is_supported() { + } => ( + hw::locked_hardware_wallet(kind, pairing_code.as_ref()), + false, + ), + }; + let mut bttn = Button::new(content) + .style(theme::Button::Border) + .width(Length::Fill); + if selectable && hw.is_supported() { bttn = bttn.on_press(Message::SelectHardwareWallet(i)); } Container::new(bttn) diff --git a/gui/ui/src/component/hw.rs b/gui/ui/src/component/hw.rs index aad400ad..848935e5 100644 --- a/gui/ui/src/component/hw.rs +++ b/gui/ui/src/component/hw.rs @@ -87,6 +87,35 @@ pub fn unregistered_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Displa .padding(10) } +pub fn unimplemented_method_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Display>( + kind: K, + version: Option, + fingerprint: F, + message: &'static str, +) -> Container<'a, T> { + container( + tooltip::Tooltip::new( + container( + column(vec![ + text::p1_regular(format!("#{}", fingerprint)).into(), + Row::new() + .spacing(5) + .push(text::caption(kind.to_string())) + .push_maybe(version.map(|v| text::caption(v.to_string()))) + .into(), + ]) + .width(Length::Fill), + ) + .width(Length::Fill) + .padding(10), + message, + tooltip::Position::Bottom, + ) + .style(theme::Container::Card(theme::Card::Simple)), + ) + .width(Length::Fill) +} + pub fn unrelated_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Display>( kind: K, version: Option, @@ -107,7 +136,7 @@ pub fn unrelated_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Display>( ) .width(Length::Fill) .padding(10), - "The signing device is not part of the wallet setup", + "This signer does not have a key in this wallet.", tooltip::Position::Bottom, ) .style(theme::Container::Card(theme::Card::Simple)),