Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
pythcoiner committed Aug 2, 2024
1 parent b734c35 commit 4eacd15
Show file tree
Hide file tree
Showing 12 changed files with 305 additions and 171 deletions.
2 changes: 1 addition & 1 deletion gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bitcoin_hashes = "0.12"
reqwest = { version = "0.11", default-features=false, features = ["json", "rustls-tls"] }
rust-ini = "0.19.0"

ledger_manager = { git = "https://github.com/pythcoiner/ledger_installer.git", branch = "liana", ref = "bdefcefad4a5c8d15cfaea2c1103effdc961fe18"}
ledger_manager = { git = "https://github.com/pythcoiner/ledger_installer.git", branch = "liana", ref = "53477ee2077590c461e605350aa0d76494a162d9"}

[patch.crates-io]
iced_style = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
Expand Down
2 changes: 1 addition & 1 deletion gui/src/app/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ pub enum Message {
LabelsUpdated(Result<HashMap<String, Option<String>>, Error>),
BroadcastModal(Result<HashSet<Txid>, Error>),
RbfModal(Box<HistoryTransaction>, bool, Result<HashSet<Txid>, Error>),
UpgradeLedger(String),
UpgradeLedger(String, Network),
Upgrade(UpgradeMessage),
}
10 changes: 6 additions & 4 deletions gui/src/app/state/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ pub struct SignAction {
signed: HashSet<Fingerprint>,
is_saved: bool,
display_modal: bool,
runtime: tokio::runtime::Handle,
}

impl SignAction {
Expand All @@ -431,14 +432,15 @@ impl SignAction {
signed,
is_saved,
display_modal: true,
runtime: tokio::runtime::Handle::current(),
}
}
}

impl Action for SignAction {
fn subscription(&self) -> Subscription<Message> {
let mut subs = maybe_ledger_upgrade_subscription(&self.hws);
subs.push(self.hws.refresh().map(Message::HardwareWallets));
let ( mut subs, upgrading_hws ) = maybe_ledger_upgrade_subscription(&self.hws, self.runtime.clone());
subs.push(self.hws.refresh(upgrading_hws).map(Message::HardwareWallets));
Subscription::batch(subs)
}

Expand Down Expand Up @@ -526,8 +528,8 @@ impl Action for SignAction {
self.error = Some(e.into());
}
},
Message::UpgradeLedger(id) => {
maybe_start_upgrade(id, &mut self.hws);
Message::UpgradeLedger(id, network) => {
maybe_start_upgrade(id, &mut self.hws, network);
}
Message::Upgrade(msg) => {
update_upgrade_state(msg, &mut self.hws);
Expand Down
15 changes: 11 additions & 4 deletions gui/src/app/state/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ pub struct VerifyAddressModal {
hws: HardwareWallets,
address: Address,
derivation_index: ChildNumber,
runtime: tokio::runtime::Handle,
}

impl VerifyAddressModal {
Expand All @@ -240,6 +241,7 @@ impl VerifyAddressModal {
hws: HardwareWallets::new(data_dir, network).with_wallet(wallet),
address,
derivation_index,
runtime: tokio::runtime::Handle::current(),
}
}
}
Expand All @@ -256,8 +258,13 @@ impl VerifyAddressModal {
}

fn subscription(&self) -> Subscription<Message> {
let mut subs = maybe_ledger_upgrade_subscription(&self.hws);
subs.push(self.hws.refresh().map(Message::HardwareWallets));
let (mut subs, upgrading_hws) =
maybe_ledger_upgrade_subscription(&self.hws, self.runtime.clone());
subs.push(
self.hws
.refresh(upgrading_hws)
.map(Message::HardwareWallets),
);
Subscription::batch(subs)
}

Expand Down Expand Up @@ -300,8 +307,8 @@ impl VerifyAddressModal {
Command::none()
}
}
Message::UpgradeLedger(id) => {
maybe_start_upgrade(id, &mut self.hws);
Message::UpgradeLedger(id, network) => {
maybe_start_upgrade(id, &mut self.hws, network);
Command::none()
}
Message::Upgrade(msg) => {
Expand Down
15 changes: 11 additions & 4 deletions gui/src/app/state/settings/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ pub struct RegisterWalletModal {
hws: HardwareWallets,
registered: HashSet<Fingerprint>,
processing: bool,
runtime: tokio::runtime::Handle,
}

impl RegisterWalletModal {
Expand All @@ -220,6 +221,7 @@ impl RegisterWalletModal {
wallet,
processing: false,
registered,
runtime: tokio::runtime::Handle::current(),
}
}
}
Expand All @@ -236,8 +238,13 @@ impl RegisterWalletModal {
}

fn subscription(&self) -> Subscription<Message> {
let mut subs = maybe_ledger_upgrade_subscription(&self.hws);
subs.push(self.hws.refresh().map(Message::HardwareWallets));
let (mut subs, upgrading_hws) =
maybe_ledger_upgrade_subscription(&self.hws, self.runtime.clone());
subs.push(
self.hws
.refresh(upgrading_hws)
.map(Message::HardwareWallets),
);
Subscription::batch(subs)
}

Expand Down Expand Up @@ -303,8 +310,8 @@ impl RegisterWalletModal {
Command::none()
}
}
Message::UpgradeLedger(id) => {
maybe_start_upgrade(id, &mut self.hws);
Message::UpgradeLedger(id, network) => {
maybe_start_upgrade(id, &mut self.hws, network);
Command::none()
}
Message::Upgrade(msg) => {
Expand Down
Loading

0 comments on commit 4eacd15

Please sign in to comment.