mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
show progress indicator when retrieving paynym
This commit is contained in:
parent
238aae5ea9
commit
cf2616ec2b
2 changed files with 11 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<Tooltip text="Retrieves and claims the PayNym for this wallet" />
|
||||
</tooltip>
|
||||
</Button>
|
||||
<ProgressIndicator fx:id="retrievePayNymProgress" />
|
||||
</HBox>
|
||||
<HBox styleClass="field-box">
|
||||
<Label text="Payment code:" styleClass="field-label" />
|
||||
|
|
Loading…
Reference in a new issue