diff --git a/src/main/java/com/sparrowwallet/sparrow/control/SeedDisplayDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/SeedDisplayDialog.java index 8ca81a56..4f07c20c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/SeedDisplayDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/SeedDisplayDialog.java @@ -20,6 +20,7 @@ public class SeedDisplayDialog extends Dialog { AnchorPane anchorPane = new AnchorPane(); ScrollPane scrollPane = new ScrollPane(); + scrollPane.getStyleClass().add("edge-to-edge"); scrollPane.setPrefHeight(74 + height); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); @@ -32,6 +33,7 @@ public class SeedDisplayDialog extends Dialog { scrollPane.setContent(keystoreAccordion); MnemonicKeystoreImportPane keystorePane = new MnemonicKeystoreImportPane(decryptedKeystore); + keystorePane.setAnimated(false); keystoreAccordion.getPanes().add(keystorePane); stackPane.getChildren().addAll(anchorPane); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java index c959fdce..f55199ec 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java @@ -52,7 +52,7 @@ public class WalletNameDialog extends Dialog { dialogPane.getButtonTypes().addAll(okButtonType); Button okButton = (Button) dialogPane.lookupButton(okButtonType); BooleanBinding isInvalid = Bindings.createBooleanBinding(() -> - name.getText().length() == 0 || Storage.getWalletFile(name.getText()).exists(), name.textProperty()); + name.getText().length() == 0 || Storage.walletExists(name.getText()), name.textProperty()); okButton.disableProperty().bind(isInvalid); name.setPromptText("Wallet Name"); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Storage.java b/src/main/java/com/sparrowwallet/sparrow/io/Storage.java index 620cef20..44c57c31 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Storage.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Storage.java @@ -46,7 +46,6 @@ public class Storage { public Storage(File walletFile) { this.walletFile = walletFile; this.gson = getGson(); - this.encryptionPubKey = NO_PASSWORD_KEY; } public File getWalletFile() { diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index 2304c796..33f0819d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -436,9 +436,9 @@ public class HeadersController extends TransactionFormController implements Init blockchainForm.setVisible(true); if(currentHeight == null) { - blockStatus.setText(blockTransaction.getBlockHash() == null ? "Unconfirmed" : "Confirmed"); + blockStatus.setText(blockTransaction.getHeight() > 0 ? "Confirmed" : "Unconfirmed"); } else { - int confirmations = blockTransaction.getBlockHash() == null ? 0 : currentHeight - blockTransaction.getHeight() + 1; + int confirmations = blockTransaction.getHeight() > 0 ? currentHeight - blockTransaction.getHeight() + 1 : 0; if(confirmations == 0) { blockStatus.setText("Unconfirmed"); } else if(confirmations == 1) { diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java index 42586645..64fef401 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java @@ -15,6 +15,7 @@ import com.sparrowwallet.sparrow.control.WalletPasswordDialog; import com.sparrowwallet.sparrow.event.StorageEvent; import com.sparrowwallet.sparrow.event.TimedEvent; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; +import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands; import com.sparrowwallet.sparrow.io.Storage; import com.sparrowwallet.sparrow.keystoreimport.KeystoreImportDialog; import com.sparrowwallet.sparrow.event.SettingsChangedEvent; @@ -48,6 +49,9 @@ public class KeystoreController extends WalletFormController implements Initiali @FXML private Label type; + @FXML + private Button viewSeedButton; + @FXML private Button importButton; @@ -84,6 +88,8 @@ public class KeystoreController extends WalletFormController implements Initiali selectSourcePane.setVisible(false); } + viewSeedButton.managedProperty().bind(viewSeedButton.visibleProperty()); + updateType(); label.setText(keystore.getLabel()); @@ -170,15 +176,10 @@ public class KeystoreController extends WalletFormController implements Initiali private void updateType() { type.setText(getTypeLabel(keystore)); - if(keystore.getSource() == KeystoreSource.SW_SEED) { - Glyph searchGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE); - searchGlyph.setFontSize(12); - type.setGraphic(searchGlyph); - } else { - type.setGraphic(null); - } + type.setGraphic(getTypeIcon(keystore)); + viewSeedButton.setVisible(keystore.getSource() == KeystoreSource.SW_SEED); - importButton.setText(keystore.getSource() == KeystoreSource.SW_WATCH ? "Import..." : "Edit..."); + importButton.setText(keystore.getSource() == KeystoreSource.SW_WATCH ? "Import..." : "Replace..."); boolean editable = (keystore.getSource() == KeystoreSource.SW_WATCH); fingerprint.setEditable(editable); @@ -200,6 +201,20 @@ public class KeystoreController extends WalletFormController implements Initiali } } + private Glyph getTypeIcon(Keystore keystore) { + switch (keystore.getSource()) { + case HW_USB: + return new Glyph(FontAwesome5Brands.FONT_NAME, FontAwesome5Brands.Glyph.USB); + case HW_AIRGAPPED: + return new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.SD_CARD); + case SW_SEED: + return new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.LAPTOP); + case SW_WATCH: + default: + return new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE); + } + } + public void importKeystore(ActionEvent event) { KeystoreSource initialSource = keystore.getSource(); if(initialSource == null || !KeystoreImportDialog.getSupportedSources().contains(initialSource)) { @@ -232,7 +247,7 @@ public class KeystoreController extends WalletFormController implements Initiali } } - public void showSeed(MouseEvent event) { + public void showSeed(ActionEvent event) { int keystoreIndex = getWalletForm().getWallet().getKeystores().indexOf(keystore); Wallet copy = getWalletForm().getWallet().copy(); diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.css b/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.css index 270d10b3..84be80ad 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.css +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.css @@ -15,4 +15,8 @@ #fingerprint, #derivation, #xpub { -fx-font-family: Courier; +} + +#type { + -fx-padding: 0 17 0 0; } \ No newline at end of file diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml b/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml index 2a143ddb..b0b3e935 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml @@ -20,7 +20,15 @@
-