diff --git a/src/main/java/com/sparrowwallet/sparrow/control/DeviceDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/DeviceDialog.java index 016d7de0..198bb630 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/DeviceDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/DeviceDialog.java @@ -114,7 +114,7 @@ public abstract class DeviceDialog extends Dialog { if(operationFingerprints != null) { dialogDevices.removeIf(device -> { - return device.getFingerprint() != null && !operationFingerprints.contains(device.getFingerprint()) && !(device.getNeedsPinSent() || device.getNeedsPassphraseSent()); + return device.getFingerprint() != null && !operationFingerprints.contains(device.getFingerprint()) && !(device.isNeedsPinSent() || device.isNeedsPassphraseSent()); }); } diff --git a/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java b/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java index c6d3df14..bb813eeb 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java @@ -144,9 +144,9 @@ public class DevicePane extends TitledDescriptionPane { } private void initialise(Device device) { - if(device.getNeedsPinSent() != null && device.getNeedsPinSent()) { + if(device.isNeedsPinSent()) { unlockButton.setVisible(true); - } else if(device.getNeedsPassphraseSent() != null && device.getNeedsPassphraseSent()) { + } else if(device.isNeedsPassphraseSent()) { setPassphraseButton.setVisible(true); } else if(device.getError() != null) { setError("Error", device.getError()); @@ -165,7 +165,7 @@ public class DevicePane extends TitledDescriptionPane { } private void setDefaultStatus() { - setDescription(device.getNeedsPinSent() ? "Locked" : device.getNeedsPassphraseSent() ? "Passphrase Required" : "Unlocked"); + setDescription(device.isNeedsPinSent() ? "Locked" : device.isNeedsPassphraseSent() ? "Passphrase Required" : "Unlocked"); } private void createUnlockButton() { @@ -411,7 +411,7 @@ public class DevicePane extends TitledDescriptionPane { setExpanded(false); unlockButton.setVisible(false); - if(device.getNeedsPassphraseSent()) { + if(device.isNeedsPassphraseSent()) { setPassphraseButton.setVisible(true); setPassphraseButton.setDisable(true); setContent(getPassphraseEntry()); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java b/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java index 61cfd153..0d8d22b6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/UsbStatusButton.java @@ -22,7 +22,7 @@ public class UsbStatusButton extends MenuButton { public void setDevices(List devices) { for(Device device : devices) { MenuItem deviceItem = new MenuItem(device.getModel().toDisplayString()); - if(device.getNeedsPinSent()) { + if(device.isNeedsPinSent()) { deviceItem.setGraphic(getLockIcon()); } else { deviceItem.setGraphic(getLockOpenIcon()); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Device.java b/src/main/java/com/sparrowwallet/sparrow/io/Device.java index e9ec17bb..f417a372 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Device.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Device.java @@ -41,6 +41,10 @@ public class Device { return needsPinSent; } + public Boolean isNeedsPinSent() { + return needsPinSent != null && needsPinSent; + } + public void setNeedsPinSent(Boolean needsPinSent) { this.needsPinSent = needsPinSent; } @@ -49,6 +53,10 @@ public class Device { return needsPassphraseSent; } + public Boolean isNeedsPassphraseSent() { + return needsPassphraseSent != null && needsPassphraseSent; + } + public void setNeedsPassphraseSent(Boolean needsPassphraseSent) { this.needsPassphraseSent = needsPassphraseSent; } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java index 8bb22336..6196d241 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java @@ -148,7 +148,7 @@ public class ReceiveController extends WalletFormController implements Initializ List addressDevices = devices.stream().filter(device -> walletFingerprints.contains(device.getFingerprint())).collect(Collectors.toList()); if(addressDevices.isEmpty()) { - addressDevices = devices.stream().filter(device -> device.getNeedsPinSent() || device.getNeedsPassphraseSent()).collect(Collectors.toList()); + addressDevices = devices.stream().filter(device -> device.isNeedsPinSent() || device.isNeedsPassphraseSent()).collect(Collectors.toList()); } if(!addressDevices.isEmpty()) { @@ -198,7 +198,7 @@ public class ReceiveController extends WalletFormController implements Initializ List possibleDevices = (List)displayAddress.getUserData(); if(possibleDevices != null && !possibleDevices.isEmpty()) { - if(possibleDevices.size() > 1 || possibleDevices.get(0).getNeedsPinSent() || possibleDevices.get(0).getNeedsPassphraseSent()) { + if(possibleDevices.size() > 1 || possibleDevices.get(0).isNeedsPinSent() || possibleDevices.get(0).isNeedsPassphraseSent()) { DeviceAddressDialog dlg = new DeviceAddressDialog(wallet, addressDescriptor); dlg.showAndWait(); } else {