From 483e4c8f38a2da6a61ecdd20f2e7ab1fa7d9c15d Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 5 Apr 2023 08:24:18 +0200 Subject: [PATCH] always show tapsigner in airgapped import options --- .../com/sparrowwallet/sparrow/control/CardImportPane.java | 8 ++++++++ .../sparrow/keystoreimport/HwAirgappedController.java | 7 +------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/CardImportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/CardImportPane.java index 74c02fad..9e29feed 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/CardImportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/CardImportPane.java @@ -33,6 +33,8 @@ import javax.smartcardio.CardException; import java.nio.charset.StandardCharsets; import java.util.List; +import static com.sparrowwallet.sparrow.io.CardApi.isReaderAvailable; + public class CardImportPane extends TitledDescriptionPane { private static final Logger log = LoggerFactory.getLogger(CardImportPane.class); @@ -62,6 +64,12 @@ public class CardImportPane extends TitledDescriptionPane { } private void importCard() { + if(!isReaderAvailable()) { + setError("No reader", "No card reader was detected."); + importButton.setDisable(false); + return; + } + if(pin.get().length() < 6) { setDescription(pin.get().isEmpty() ? "Enter PIN code" : "PIN code too short"); setContent(getPinEntry()); diff --git a/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java b/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java index 7fa8e2da..0a1ec44f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java +++ b/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java @@ -15,8 +15,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -import static com.sparrowwallet.sparrow.io.CardApi.isReaderAvailable; - public class HwAirgappedController extends KeystoreImportDetailController { private static final Logger log = LoggerFactory.getLogger(HwAirgappedController.class); @@ -40,10 +38,7 @@ public class HwAirgappedController extends KeystoreImportDetailController { } } - List cardImporters = Collections.emptyList(); - if(isReaderAvailable()) { - cardImporters = List.of(new Tapsigner()); - } + List cardImporters = List.of(new Tapsigner()); for(KeystoreCardImport importer : cardImporters) { if(!importer.isDeprecated() || Config.get().isShowDeprecatedImportExport()) { CardImportPane importPane = new CardImportPane(getMasterController().getWallet(), importer, getMasterController().getRequiredDerivation());