From 14db333a6f97530d138228736f9a9d5238b58db7 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 8 Dec 2021 14:39:16 +0200 Subject: [PATCH] improve passphrase toggle of bitbox02 and trezor t --- .../com/sparrowwallet/sparrow/control/UsbStatusButton.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java b/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java index 9f8b2389..e9e984a2 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java @@ -27,13 +27,16 @@ public class UsbStatusButton extends MenuButton { public void setDevices(List devices) { for(Device device : devices) { MenuItem deviceItem = new MenuItem(device.getModel().toDisplayString()); - if(!device.isNeedsPinSent() && (device.getModel() == WalletModel.TREZOR_1 || device.getModel() == WalletModel.TREZOR_T || device.getModel() == WalletModel.KEEPKEY)) { + if(!device.isNeedsPinSent() && (device.getModel() == WalletModel.TREZOR_1 || device.getModel() == WalletModel.TREZOR_T || device.getModel() == WalletModel.KEEPKEY || device.getModel() == WalletModel.BITBOX_02)) { deviceItem = new Menu(device.getModel().toDisplayString()); - MenuItem toggleItem = new MenuItem("Toggle Passphrase " + (device.isNeedsPassphraseSent() ? "Off" : "On")); + MenuItem toggleItem = new MenuItem("Toggle Passphrase" + (!device.getModel().externalPassphraseEntry() ? "" : (device.isNeedsPassphraseSent() ? " Off" : " On"))); toggleItem.setOnAction(event -> { Hwi.TogglePassphraseService togglePassphraseService = new Hwi.TogglePassphraseService(device); togglePassphraseService.setOnSucceeded(event1 -> { EventManager.get().post(new RequestOpenWalletsEvent()); + if(!device.getModel().externalPassphraseEntry()) { + AppServices.showAlertDialog("Reconnect device", "Reconnect your " + device.getModel().toDisplayString() + " to reset the passphrase.", Alert.AlertType.INFORMATION); + } }); togglePassphraseService.setOnFailed(event1 -> { AppServices.showErrorDialog("Error toggling passphrase", event1.getSource().getException().getMessage());