mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
allow soroban initiator to try again if meeting request fails
This commit is contained in:
parent
6534ccb07e
commit
e438389953
3 changed files with 33 additions and 10 deletions
|
@ -105,6 +105,9 @@ public class InitiatorController extends SorobanController {
|
|||
@FXML
|
||||
private Label step2Desc;
|
||||
|
||||
@FXML
|
||||
private Hyperlink meetingFail;
|
||||
|
||||
@FXML
|
||||
private ProgressBar sorobanProgressBar;
|
||||
|
||||
|
@ -188,6 +191,17 @@ public class InitiatorController extends SorobanController {
|
|||
broadcastSuccessful.managedProperty().bind(broadcastSuccessful.visibleProperty());
|
||||
broadcastSuccessful.setVisible(false);
|
||||
|
||||
meetingFail.managedProperty().bind(meetingFail.visibleProperty());
|
||||
meetingFail.setVisited(true);
|
||||
meetingFail.setVisible(false);
|
||||
meetingFail.setOnAction(event -> {
|
||||
meetingFail.setVisible(false);
|
||||
step2Desc.setText("Retrying...");
|
||||
sorobanProgressLabel.setVisible(true);
|
||||
startInitiatorMeetingRequest(AppServices.getSorobanServices().getSoroban(walletId), wallet);
|
||||
step2Timer.start();
|
||||
});
|
||||
|
||||
step2.setVisible(false);
|
||||
step3.setVisible(false);
|
||||
step4.setVisible(false);
|
||||
|
@ -419,17 +433,15 @@ public class InitiatorController extends SorobanController {
|
|||
}
|
||||
}, error -> {
|
||||
log.error("Error receiving meeting response", error);
|
||||
String cutFrom = "Exception: ";
|
||||
int index = error.getMessage().lastIndexOf(cutFrom);
|
||||
String msg = index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length());
|
||||
msg = msg.replace("#Cahoots", "mix transaction");
|
||||
step2Desc.setText(msg);
|
||||
step2Desc.setText(getErrorMessage(error));
|
||||
sorobanProgressLabel.setVisible(false);
|
||||
meetingFail.setVisible(true);
|
||||
});
|
||||
}, error -> {
|
||||
log.error("Error sending meeting request", error);
|
||||
step2Desc.setText(error.getMessage());
|
||||
step2Desc.setText(getErrorMessage(error));
|
||||
sorobanProgressLabel.setVisible(false);
|
||||
meetingFail.setVisible(true);
|
||||
});
|
||||
} catch(Exception e) {
|
||||
log.error("Error sending meeting request", e);
|
||||
|
@ -512,9 +524,7 @@ public class InitiatorController extends SorobanController {
|
|||
},
|
||||
error -> {
|
||||
log.error("Error creating mix transaction", error);
|
||||
String cutFrom = "Exception: ";
|
||||
int index = error.getMessage().lastIndexOf(cutFrom);
|
||||
step2Desc.setText(index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length()));
|
||||
step2Desc.setText(getErrorMessage(error));
|
||||
sorobanProgressLabel.setVisible(false);
|
||||
});
|
||||
} catch(Exception e) {
|
||||
|
@ -667,6 +677,15 @@ public class InitiatorController extends SorobanController {
|
|||
}
|
||||
}
|
||||
|
||||
private static String getErrorMessage(Throwable error) {
|
||||
String cutFrom = "Exception: ";
|
||||
int index = error.getMessage().lastIndexOf(cutFrom);
|
||||
String msg = index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length());
|
||||
msg = msg.replace("#Cahoots", "mix transaction");
|
||||
msg = msg.endsWith(".") ? msg : msg + ".";
|
||||
return msg;
|
||||
}
|
||||
|
||||
public boolean isTransactionAccepted() {
|
||||
return transactionAccepted.get() == Boolean.TRUE;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public class InitiatorDialog extends Dialog<Transaction> {
|
|||
dialogPane.setPrefHeight(530);
|
||||
AppServices.moveToActiveWindowScreen(this);
|
||||
|
||||
dialogPane.getStylesheets().add(AppServices.class.getResource("general.css").toExternalForm());
|
||||
dialogPane.getStylesheets().add(AppServices.class.getResource("app.css").toExternalForm());
|
||||
dialogPane.getStylesheets().add(AppServices.class.getResource("soroban/initiator.css").toExternalForm());
|
||||
|
||||
|
|
|
@ -76,7 +76,10 @@
|
|||
<Region HBox.hgrow="ALWAYS" />
|
||||
<ProgressTimer fx:id="step2Timer" seconds="60" />
|
||||
</HBox>
|
||||
<Label fx:id="step2Desc" text="Ask your mix partner to select Find Mix Partner in the Sparrow Tools menu or Receive Online Cahoots in the Samourai Receive menu." wrapText="true" styleClass="content-text" />
|
||||
<HBox spacing="5">
|
||||
<Label fx:id="step2Desc" text="Ask your mix partner to select Find Mix Partner in the Sparrow Tools menu or Receive Online Cahoots in the Samourai Receive menu." wrapText="true" styleClass="content-text" />
|
||||
<Hyperlink fx:id="meetingFail" text="Try again?" styleClass="content-text"/>
|
||||
</HBox>
|
||||
<HBox>
|
||||
<padding>
|
||||
<Insets top="20" />
|
||||
|
|
Loading…
Reference in a new issue