diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index c239dd14..09b664a3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -1065,6 +1065,10 @@ public class AppController implements Initializable { new KeystoneSinglesig(), new KeystoneMultisig(), new CaravanMultisig()); for(WalletImport importer : walletImporters) { + if(importer.isDeprecated() && !Config.get().isShowDeprecatedImportExport()) { + continue; + } + try(FileInputStream inputStream = new FileInputStream(file)) { if(importer.isEncrypted(file) && password == null) { WalletPasswordDialog dlg = new WalletPasswordDialog(file.getName(), WalletPasswordDialog.PasswordRequirement.LOAD); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java index b98f97f2..73056095 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java @@ -50,9 +50,11 @@ public class WalletExportDialog extends Dialog { } Accordion exportAccordion = new Accordion(); - for (WalletExport exporter : exporters) { - FileWalletExportPane exportPane = new FileWalletExportPane(wallet, exporter); - exportAccordion.getPanes().add(exportPane); + for(WalletExport exporter : exporters) { + if(!exporter.isDeprecated() || Config.get().isShowDeprecatedImportExport()) { + FileWalletExportPane exportPane = new FileWalletExportPane(wallet, exporter); + exportAccordion.getPanes().add(exportPane); + } } exportAccordion.getPanes().sort(Comparator.comparing(o -> ((TitledDescriptionPane) o).getTitle())); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java index ba7956ce..eb589b93 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java @@ -51,14 +51,18 @@ public class WalletImportDialog extends Dialog { importAccordion = new Accordion(); List keystoreImporters = List.of(new ColdcardSinglesig(), new CoboVaultSinglesig(), new Jade(), new KeystoneSinglesig(), new PassportSinglesig(), new GordianSeedTool(), new SeedSigner(), new SpecterDIY()); for(KeystoreFileImport importer : keystoreImporters) { - FileWalletKeystoreImportPane importPane = new FileWalletKeystoreImportPane(importer); - importAccordion.getPanes().add(importPane); + if(!importer.isDeprecated() || Config.get().isShowDeprecatedImportExport()) { + FileWalletKeystoreImportPane importPane = new FileWalletKeystoreImportPane(importer); + importAccordion.getPanes().add(importPane); + } } List walletImporters = List.of(new CaravanMultisig(), new ColdcardMultisig(), new CoboVaultMultisig(), new Electrum(), new KeystoneMultisig(), new Descriptor(), new SpecterDesktop(), new BlueWalletMultisig(), new Sparrow()); for(WalletImport importer : walletImporters) { - FileWalletImportPane importPane = new FileWalletImportPane(importer); - importAccordion.getPanes().add(importPane); + if(!importer.isDeprecated() || Config.get().isShowDeprecatedImportExport()) { + FileWalletImportPane importPane = new FileWalletImportPane(importer); + importAccordion.getPanes().add(importPane); + } } importAccordion.getPanes().sort(Comparator.comparing(o -> ((TitledDescriptionPane) o).getTitle())); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultMultisig.java b/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultMultisig.java index 6b2dfba6..4c12168c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultMultisig.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultMultisig.java @@ -67,4 +67,9 @@ public class CoboVaultMultisig extends ColdcardMultisig { public boolean isWalletExportScannable() { return true; } + + @Override + public boolean isDeprecated() { + return true; + } } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultSinglesig.java b/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultSinglesig.java index 0ce22f40..a9f36a28 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultSinglesig.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/CoboVaultSinglesig.java @@ -102,6 +102,11 @@ public class CoboVaultSinglesig implements KeystoreFileImport, WalletImport { return true; } + @Override + public boolean isDeprecated() { + return true; + } + private static class CoboVaultSinglesigKeystore { public String ExtPubKey; public String MasterFingerprint; diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Config.java b/src/main/java/com/sparrowwallet/sparrow/io/Config.java index b3ca7010..b3a450dd 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Config.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Config.java @@ -46,6 +46,7 @@ public class Config { private boolean showTransactionHex = true; private boolean showLoadingLog = true; private boolean showAddressTransactionCount = false; + private boolean showDeprecatedImportExport = false; private boolean preventSleep = false; private List recentWalletFiles; private Integer keyDerivationPeriod; @@ -301,6 +302,15 @@ public class Config { flush(); } + public boolean isShowDeprecatedImportExport() { + return showDeprecatedImportExport; + } + + public void setShowDeprecatedImportExport(boolean showDeprecatedImportExport) { + this.showDeprecatedImportExport = showDeprecatedImportExport; + flush(); + } + public boolean isPreventSleep() { return preventSleep; } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/FileImport.java b/src/main/java/com/sparrowwallet/sparrow/io/FileImport.java index ef2a6114..5382aea5 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/FileImport.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/FileImport.java @@ -2,6 +2,6 @@ package com.sparrowwallet.sparrow.io; import java.io.File; -public interface FileImport extends Import { +public interface FileImport extends ImportExport { boolean isEncrypted(File file); } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Import.java b/src/main/java/com/sparrowwallet/sparrow/io/Import.java deleted file mode 100644 index bd0e53cf..00000000 --- a/src/main/java/com/sparrowwallet/sparrow/io/Import.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.sparrowwallet.sparrow.io; - -import com.sparrowwallet.drongo.wallet.WalletModel; - -public interface Import { - String getName(); - WalletModel getWalletModel(); -} diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Export.java b/src/main/java/com/sparrowwallet/sparrow/io/ImportExport.java similarity index 60% rename from src/main/java/com/sparrowwallet/sparrow/io/Export.java rename to src/main/java/com/sparrowwallet/sparrow/io/ImportExport.java index 8265e966..38fe31a1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Export.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/ImportExport.java @@ -2,7 +2,10 @@ package com.sparrowwallet.sparrow.io; import com.sparrowwallet.drongo.wallet.WalletModel; -public interface Export { +public interface ImportExport { String getName(); WalletModel getWalletModel(); + default boolean isDeprecated() { + return false; + } } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/KeystoreImport.java b/src/main/java/com/sparrowwallet/sparrow/io/KeystoreImport.java index 882abc55..9cf790fc 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/KeystoreImport.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/KeystoreImport.java @@ -1,5 +1,5 @@ package com.sparrowwallet.sparrow.io; -public interface KeystoreImport extends Import { +public interface KeystoreImport extends ImportExport { String getKeystoreImportDescription(); } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java b/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java index 3653e735..4ce23842 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java @@ -4,7 +4,7 @@ import com.sparrowwallet.drongo.wallet.Wallet; import java.io.OutputStream; -public interface WalletExport extends Export { +public interface WalletExport extends ImportExport { void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException; String getWalletExportDescription(); String getExportFileExtension(Wallet wallet); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java b/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java index 8d74aabe..ee206761 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java @@ -4,7 +4,7 @@ import com.sparrowwallet.drongo.wallet.Wallet; import java.io.InputStream; -public interface WalletImport extends Import, FileImport { +public interface WalletImport extends FileImport { String getWalletImportDescription(); Wallet importWallet(InputStream inputStream, String password) throws ImportException; boolean isWalletImportScannable(); diff --git a/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java b/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java index a891dfa7..933793b1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java +++ b/src/main/java/com/sparrowwallet/sparrow/keystoreimport/HwAirgappedController.java @@ -24,9 +24,11 @@ public class HwAirgappedController extends KeystoreImportDetailController { } for(KeystoreFileImport importer : importers) { - FileKeystoreImportPane importPane = new FileKeystoreImportPane(getMasterController().getWallet(), importer, getMasterController().getRequiredDerivation()); - if(getMasterController().getRequiredModel() == null || getMasterController().getRequiredModel() == importer.getWalletModel()) { - importAccordion.getPanes().add(importPane); + if(!importer.isDeprecated() || Config.get().isShowDeprecatedImportExport()) { + FileKeystoreImportPane importPane = new FileKeystoreImportPane(getMasterController().getWallet(), importer, getMasterController().getRequiredDerivation()); + if(getMasterController().getRequiredModel() == null || getMasterController().getRequiredModel() == importer.getWalletModel()) { + importAccordion.getPanes().add(importPane); + } } } diff --git a/src/main/java/com/sparrowwallet/sparrow/keystoreimport/SwController.java b/src/main/java/com/sparrowwallet/sparrow/keystoreimport/SwController.java index 4ede87a6..de008a3e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/keystoreimport/SwController.java +++ b/src/main/java/com/sparrowwallet/sparrow/keystoreimport/SwController.java @@ -18,6 +18,10 @@ public class SwController extends KeystoreImportDetailController { List importers = List.of(new Bip39(), new Electrum(), new Bip32()); for(KeystoreImport importer : importers) { + if(importer.isDeprecated() && !Config.get().isShowDeprecatedImportExport()) { + continue; + } + TitledDescriptionPane importPane = null; if(importer instanceof KeystoreFileImport) {