mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06: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
|
@FXML
|
||||||
private Button payNymRetrieve;
|
private Button payNymRetrieve;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ProgressIndicator retrievePayNymProgress;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private PaymentCodeTextField paymentCode;
|
private PaymentCodeTextField paymentCode;
|
||||||
|
|
||||||
|
@ -76,6 +79,10 @@ public class PayNymController extends SorobanController {
|
||||||
payNymRetrieve.managedProperty().bind(payNymRetrieve.visibleProperty());
|
payNymRetrieve.managedProperty().bind(payNymRetrieve.visibleProperty());
|
||||||
payNymRetrieve.visibleProperty().bind(payNymName.visibleProperty().not());
|
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);
|
Soroban soroban = AppServices.getSorobanServices().getSoroban(walletId);
|
||||||
if(soroban.getPaymentCode() != null) {
|
if(soroban.getPaymentCode() != null) {
|
||||||
paymentCode.setPaymentCode(soroban.getPaymentCode());
|
paymentCode.setPaymentCode(soroban.getPaymentCode());
|
||||||
|
@ -145,8 +152,10 @@ public class PayNymController extends SorobanController {
|
||||||
if(soroban.getPaymentCode() == null) {
|
if(soroban.getPaymentCode() == null) {
|
||||||
throw new IllegalStateException("Payment code has not been set");
|
throw new IllegalStateException("Payment code has not been set");
|
||||||
}
|
}
|
||||||
|
retrievePayNymProgress.setVisible(true);
|
||||||
|
|
||||||
soroban.getPayNym(soroban.getPaymentCode().toString()).subscribe(payNym -> {
|
soroban.getPayNym(soroban.getPaymentCode().toString()).subscribe(payNym -> {
|
||||||
|
retrievePayNymProgress.setVisible(false);
|
||||||
walletPayNym = payNym;
|
walletPayNym = payNym;
|
||||||
payNymName.setText(payNym.nymName());
|
payNymName.setText(payNym.nymName());
|
||||||
paymentCode.setPaymentCode(payNym.paymentCode());
|
paymentCode.setPaymentCode(payNym.paymentCode());
|
||||||
|
@ -157,6 +166,7 @@ public class PayNymController extends SorobanController {
|
||||||
followersList.setPlaceholder(new Label("No followers"));
|
followersList.setPlaceholder(new Label("No followers"));
|
||||||
followersList.setItems(FXCollections.observableList(payNym.followers()));
|
followersList.setItems(FXCollections.observableList(payNym.followers()));
|
||||||
}, error -> {
|
}, error -> {
|
||||||
|
retrievePayNymProgress.setVisible(false);
|
||||||
if(error.getMessage().endsWith("404")) {
|
if(error.getMessage().endsWith("404")) {
|
||||||
payNymName.setVisible(false);
|
payNymName.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<Tooltip text="Retrieves and claims the PayNym for this wallet" />
|
<Tooltip text="Retrieves and claims the PayNym for this wallet" />
|
||||||
</tooltip>
|
</tooltip>
|
||||||
</Button>
|
</Button>
|
||||||
|
<ProgressIndicator fx:id="retrievePayNymProgress" />
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox styleClass="field-box">
|
<HBox styleClass="field-box">
|
||||||
<Label text="Payment code:" styleClass="field-label" />
|
<Label text="Payment code:" styleClass="field-label" />
|
||||||
|
|
Loading…
Reference in a new issue