mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-09 16:24:53 +00:00
collaborative mix aesthetic tweaks
This commit is contained in:
@@ -54,10 +54,6 @@ public class PayNymAvatar extends StackPane {
|
||||
this.paymentCodeProperty.set(paymentCode);
|
||||
}
|
||||
|
||||
public void setPayNymAvatarUri(String uri) {
|
||||
setPaymentCode(new PaymentCode(uri.replace("/", "").replace("avatar", "")));
|
||||
}
|
||||
|
||||
private class PayNymAvatarService extends Service<Image> {
|
||||
private final PaymentCode paymentCode;
|
||||
|
||||
@@ -77,7 +73,7 @@ public class PayNymAvatar extends StackPane {
|
||||
try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream())) {
|
||||
return new Image(is, getWidth(), getHeight(), true, false);
|
||||
} catch(Exception e) {
|
||||
log.warn("Error loading PayNym avatar", e);
|
||||
log.debug("Error loading PayNym avatar", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,11 +208,11 @@ public class TransactionDiagram extends GridPane {
|
||||
if(externalUserSet || addUserSet) {
|
||||
boolean replace = !isFinal() && set > 0 && SorobanServices.canWalletMix(walletTx.getWallet());
|
||||
Glyph bracketGlyph = !replace && walletTx.isCoinControlUsed() ? getLockGlyph() : (addUserSet ? getUserAddGlyph() : getCoinsGlyph(replace));
|
||||
String tooltipText = addUserSet ? "Click to add a mixing partner" : (walletTx.getWallet().getFullDisplayName() + (replace ? "\nClick to replace with a mixing partner" : ""));
|
||||
String tooltipText = addUserSet ? "Click to add a mix partner" : (walletTx.getWallet().getFullDisplayName() + (replace ? "\nClick to replace with a mix partner" : ""));
|
||||
StackPane stackPane = getBracket(width, setHeight, bracketGlyph, tooltipText);
|
||||
allBrackets.getChildren().add(stackPane);
|
||||
} else {
|
||||
StackPane stackPane = getBracket(width, setHeight, getUserGlyph(), "Mixing partner");
|
||||
StackPane stackPane = getBracket(width, setHeight, getUserGlyph(), "Mix partner");
|
||||
allBrackets.getChildren().add(stackPane);
|
||||
}
|
||||
}
|
||||
@@ -564,7 +564,7 @@ public class TransactionDiagram extends GridPane {
|
||||
|
||||
private Pane getTransactionPane() {
|
||||
VBox txPane = new VBox();
|
||||
txPane.setPadding(new Insets(0, 10, 0, 10));
|
||||
txPane.setPadding(new Insets(0, 8, 0, 8));
|
||||
txPane.setAlignment(Pos.CENTER);
|
||||
txPane.getChildren().add(createSpacer());
|
||||
|
||||
@@ -897,7 +897,7 @@ public class TransactionDiagram extends GridPane {
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return "Add Mixing Partner?";
|
||||
return "Add Mix Partner?";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@ public class CounterpartyController extends SorobanController {
|
||||
@FXML
|
||||
private Label mixingPartner;
|
||||
|
||||
@FXML
|
||||
private PayNymAvatar mixPartnerAvatar;
|
||||
|
||||
@FXML
|
||||
private Label meetingFail;
|
||||
|
||||
@@ -156,8 +159,6 @@ public class CounterpartyController extends SorobanController {
|
||||
payNym.managedProperty().bind(payNym.visibleProperty());
|
||||
payNymAvatar.managedProperty().bind(payNymAvatar.visibleProperty());
|
||||
payNymAvatar.visibleProperty().bind(payNym.visibleProperty());
|
||||
payNymAvatar.prefWidthProperty().bind(payNym.heightProperty());
|
||||
payNymAvatar.prefHeightProperty().bind(payNym.heightProperty());
|
||||
payNymButton.managedProperty().bind(payNymButton.visibleProperty());
|
||||
payNymButton.visibleProperty().bind(payNym.visibleProperty().not());
|
||||
if(Config.get().isUsePayNym()) {
|
||||
@@ -242,12 +243,8 @@ public class CounterpartyController extends SorobanController {
|
||||
private void updateMixPartner(Soroban soroban, PaymentCode paymentCodeInitiator, CahootsType cahootsType) {
|
||||
String code = paymentCodeInitiator.toString();
|
||||
mixingPartner.setText(code.substring(0, 12) + "..." + code.substring(code.length() - 5));
|
||||
PayNymAvatar payNymAvatar = new PayNymAvatar();
|
||||
payNymAvatar.setPrefHeight(mixingPartner.getHeight());
|
||||
payNymAvatar.setPrefWidth(mixingPartner.getHeight());
|
||||
payNymAvatar.setPaymentCode(paymentCodeInitiator);
|
||||
mixingPartner.setGraphic(payNymAvatar);
|
||||
if(Config.get().isUsePayNym()) {
|
||||
mixPartnerAvatar.setPaymentCode(paymentCodeInitiator);
|
||||
soroban.getPayNym(paymentCodeInitiator.toString()).subscribe(payNym -> {
|
||||
mixingPartner.setText(payNym.nymName());
|
||||
}, error -> {
|
||||
|
||||
@@ -148,8 +148,6 @@ public class InitiatorController extends SorobanController {
|
||||
});
|
||||
|
||||
payNymAvatar.managedProperty().bind(payNymAvatar.visibleProperty());
|
||||
payNymAvatar.prefWidthProperty().bind(counterparty.heightProperty());
|
||||
payNymAvatar.prefHeightProperty().bind(counterparty.heightProperty());
|
||||
payNymFollowers.prefWidthProperty().bind(counterparty.widthProperty());
|
||||
payNymFollowers.valueProperty().addListener((observable, oldValue, payNym) -> {
|
||||
if(payNym == FIND_FOLLOWERS) {
|
||||
@@ -236,7 +234,12 @@ public class InitiatorController extends SorobanController {
|
||||
soroban.getFollowers().subscribe(followerPayNyms -> {
|
||||
payNymFollowers.setItems(FXCollections.observableList(followerPayNyms));
|
||||
}, error -> {
|
||||
log.warn("Could not retrieve followers: ", error);
|
||||
if(error.getMessage().endsWith("404")) {
|
||||
Config.get().setUsePayNym(false);
|
||||
AppServices.showErrorDialog("Could not retrieve PayNym", "This wallet does not have an associated PayNym or any followers. You can retrieve the PayNym using the Tools menu → Find Mix Partner.");
|
||||
} else {
|
||||
log.warn("Could not retrieve followers: ", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -302,17 +305,17 @@ public class InitiatorController extends SorobanController {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(JavaFxScheduler.platform())
|
||||
.subscribe(meetingRequest -> {
|
||||
sorobanProgressLabel.setText("Waiting for mixing partner...");
|
||||
sorobanProgressLabel.setText("Waiting for mix partner...");
|
||||
sorobanMeetingService.receiveMeetingResponse(paymentCodeCounterparty, meetingRequest, TIMEOUT_MS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(JavaFxScheduler.platform())
|
||||
.subscribe(sorobanResponse -> {
|
||||
if(sorobanResponse.isAccept()) {
|
||||
sorobanProgressBar.setProgress(0.1);
|
||||
sorobanProgressLabel.setText("Mixing partner accepted!");
|
||||
sorobanProgressLabel.setText("Mix partner accepted!");
|
||||
startInitiatorCollaborative(initiatorCahootsWallet, paymentCodeCounterparty);
|
||||
} else {
|
||||
step2Desc.setText("Mixing partner declined.");
|
||||
step2Desc.setText("Mix partner declined.");
|
||||
sorobanProgressLabel.setVisible(false);
|
||||
}
|
||||
}, error -> {
|
||||
@@ -364,7 +367,7 @@ public class InitiatorController extends SorobanController {
|
||||
if(accepted) {
|
||||
interaction.sorobanAccept();
|
||||
} else {
|
||||
interaction.sorobanReject("Mixing partner declined to broadcast the transaction.");
|
||||
interaction.sorobanReject("Mix partner declined to broadcast the transaction.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public class PayNymService {
|
||||
public Observable<PayNym> getPayNym(String nymIdentifier) {
|
||||
return fetchPayNym(nymIdentifier).map(nymMap -> {
|
||||
List<Map<String, Object>> codes = (List<Map<String, Object>>)nymMap.get("codes");
|
||||
PaymentCode code = new PaymentCode((String)codes.get(0).get("code"));
|
||||
PaymentCode code = new PaymentCode((String)codes.stream().filter(codeMap -> codeMap.get("segwit") == Boolean.FALSE).map(codeMap -> codeMap.get("code")).findFirst().orElse(codes.get(0).get("code")));
|
||||
return new PayNym(code, (String)nymMap.get("nymID"), (String)nymMap.get("nymName"), (Boolean)nymMap.get("segwit"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1435,9 +1435,9 @@ public class SendController extends WalletFormController implements Initializabl
|
||||
}
|
||||
|
||||
if(!SorobanServices.canWalletMix(getWalletForm().getWallet())) {
|
||||
addLabel("Can only add mixing partner to Native Segwit software wallets", getInfoGlyph());
|
||||
addLabel("Can only add mix partner to Native Segwit software wallets", getInfoGlyph());
|
||||
} else {
|
||||
addLabel("Add a mixing partner to create a two person coinjoin", getInfoGlyph());
|
||||
addLabel("Add a mix partner to create a two person coinjoin", getInfoGlyph());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user