From cf2616ec2be18b838cba1606026ef1c4e2f105ee Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 9 Dec 2021 12:04:53 +0200 Subject: [PATCH] show progress indicator when retrieving paynym --- .../sparrow/soroban/PayNymController.java | 10 ++++++++++ .../com/sparrowwallet/sparrow/soroban/paynym.fxml | 1 + 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java index e77b659b..e563cf29 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java @@ -47,6 +47,9 @@ public class PayNymController extends SorobanController { @FXML private Button payNymRetrieve; + @FXML + private ProgressIndicator retrievePayNymProgress; + @FXML private PaymentCodeTextField paymentCode; @@ -76,6 +79,10 @@ public class PayNymController extends SorobanController { payNymRetrieve.managedProperty().bind(payNymRetrieve.visibleProperty()); payNymRetrieve.visibleProperty().bind(payNymName.visibleProperty().not()); + retrievePayNymProgress.managedProperty().bind(retrievePayNymProgress.visibleProperty()); + retrievePayNymProgress.maxHeightProperty().bind(payNymName.heightProperty()); + retrievePayNymProgress.setVisible(false); + Soroban soroban = AppServices.getSorobanServices().getSoroban(walletId); if(soroban.getPaymentCode() != null) { paymentCode.setPaymentCode(soroban.getPaymentCode()); @@ -145,8 +152,10 @@ public class PayNymController extends SorobanController { if(soroban.getPaymentCode() == null) { throw new IllegalStateException("Payment code has not been set"); } + retrievePayNymProgress.setVisible(true); soroban.getPayNym(soroban.getPaymentCode().toString()).subscribe(payNym -> { + retrievePayNymProgress.setVisible(false); walletPayNym = payNym; payNymName.setText(payNym.nymName()); paymentCode.setPaymentCode(payNym.paymentCode()); @@ -157,6 +166,7 @@ public class PayNymController extends SorobanController { followersList.setPlaceholder(new Label("No followers")); followersList.setItems(FXCollections.observableList(payNym.followers())); }, error -> { + retrievePayNymProgress.setVisible(false); if(error.getMessage().endsWith("404")) { payNymName.setVisible(false); } else { diff --git a/src/main/resources/com/sparrowwallet/sparrow/soroban/paynym.fxml b/src/main/resources/com/sparrowwallet/sparrow/soroban/paynym.fxml index cd0da853..9be2b18a 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/soroban/paynym.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/soroban/paynym.fxml @@ -41,6 +41,7 @@ +