mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +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
|
@FXML
|
||||||
private Label step2Desc;
|
private Label step2Desc;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Hyperlink meetingFail;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ProgressBar sorobanProgressBar;
|
private ProgressBar sorobanProgressBar;
|
||||||
|
|
||||||
|
@ -188,6 +191,17 @@ public class InitiatorController extends SorobanController {
|
||||||
broadcastSuccessful.managedProperty().bind(broadcastSuccessful.visibleProperty());
|
broadcastSuccessful.managedProperty().bind(broadcastSuccessful.visibleProperty());
|
||||||
broadcastSuccessful.setVisible(false);
|
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);
|
step2.setVisible(false);
|
||||||
step3.setVisible(false);
|
step3.setVisible(false);
|
||||||
step4.setVisible(false);
|
step4.setVisible(false);
|
||||||
|
@ -419,17 +433,15 @@ public class InitiatorController extends SorobanController {
|
||||||
}
|
}
|
||||||
}, error -> {
|
}, error -> {
|
||||||
log.error("Error receiving meeting response", error);
|
log.error("Error receiving meeting response", error);
|
||||||
String cutFrom = "Exception: ";
|
step2Desc.setText(getErrorMessage(error));
|
||||||
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);
|
|
||||||
sorobanProgressLabel.setVisible(false);
|
sorobanProgressLabel.setVisible(false);
|
||||||
|
meetingFail.setVisible(true);
|
||||||
});
|
});
|
||||||
}, error -> {
|
}, error -> {
|
||||||
log.error("Error sending meeting request", error);
|
log.error("Error sending meeting request", error);
|
||||||
step2Desc.setText(error.getMessage());
|
step2Desc.setText(getErrorMessage(error));
|
||||||
sorobanProgressLabel.setVisible(false);
|
sorobanProgressLabel.setVisible(false);
|
||||||
|
meetingFail.setVisible(true);
|
||||||
});
|
});
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error sending meeting request", e);
|
log.error("Error sending meeting request", e);
|
||||||
|
@ -512,9 +524,7 @@ public class InitiatorController extends SorobanController {
|
||||||
},
|
},
|
||||||
error -> {
|
error -> {
|
||||||
log.error("Error creating mix transaction", error);
|
log.error("Error creating mix transaction", error);
|
||||||
String cutFrom = "Exception: ";
|
step2Desc.setText(getErrorMessage(error));
|
||||||
int index = error.getMessage().lastIndexOf(cutFrom);
|
|
||||||
step2Desc.setText(index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length()));
|
|
||||||
sorobanProgressLabel.setVisible(false);
|
sorobanProgressLabel.setVisible(false);
|
||||||
});
|
});
|
||||||
} catch(Exception e) {
|
} 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() {
|
public boolean isTransactionAccepted() {
|
||||||
return transactionAccepted.get() == Boolean.TRUE;
|
return transactionAccepted.get() == Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class InitiatorDialog extends Dialog<Transaction> {
|
||||||
dialogPane.setPrefHeight(530);
|
dialogPane.setPrefHeight(530);
|
||||||
AppServices.moveToActiveWindowScreen(this);
|
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("app.css").toExternalForm());
|
||||||
dialogPane.getStylesheets().add(AppServices.class.getResource("soroban/initiator.css").toExternalForm());
|
dialogPane.getStylesheets().add(AppServices.class.getResource("soroban/initiator.css").toExternalForm());
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,10 @@
|
||||||
<Region HBox.hgrow="ALWAYS" />
|
<Region HBox.hgrow="ALWAYS" />
|
||||||
<ProgressTimer fx:id="step2Timer" seconds="60" />
|
<ProgressTimer fx:id="step2Timer" seconds="60" />
|
||||||
</HBox>
|
</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>
|
<HBox>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets top="20" />
|
<Insets top="20" />
|
||||||
|
|
Loading…
Reference in a new issue