mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-10 05:03:35 +01:00
update offer state on same thread to fix blocking
This commit is contained in:
parent
6fea58c197
commit
59fbd805a5
@ -265,7 +265,7 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setState(Offer.State state) {
|
||||
UserThread.await(() -> stateProperty().set(state));
|
||||
stateProperty.set(state);
|
||||
}
|
||||
|
||||
public ObjectProperty<Offer.State> stateProperty() {
|
||||
|
@ -200,6 +200,7 @@ public class MarketView extends ActivatableView<TabPane, Void> {
|
||||
}
|
||||
|
||||
private String getAllOffersWithReferralId() {
|
||||
synchronized (offerBook.getOfferBookListItems()) {
|
||||
List<String> list = offerBook.getOfferBookListItems().stream()
|
||||
.map(OfferBookListItem::getOffer)
|
||||
.filter(offer -> offer.getExtraDataMap() != null)
|
||||
@ -219,3 +220,4 @@ public class MarketView extends ActivatableView<TabPane, Void> {
|
||||
return Joiner.on("\n\n").join(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +147,7 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
||||
|
||||
private void fillTradeCurrencies() {
|
||||
// Don't use a set as we need all entries
|
||||
synchronized (offerBookListItems) {
|
||||
List<TradeCurrency> tradeCurrencyList = offerBookListItems.stream()
|
||||
.map(e -> {
|
||||
String currencyCode = e.getOffer().getCurrencyCode();
|
||||
@ -158,6 +159,7 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
||||
|
||||
currencyListItems.updateWithCurrencies(tradeCurrencyList, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activate() {
|
||||
|
@ -350,6 +350,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void applyOfferState(Offer.State state) {
|
||||
UserThread.execute(() -> {
|
||||
offerWarning.set(null);
|
||||
|
||||
// We have 2 situations handled here:
|
||||
@ -394,6 +395,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
updateSpinnerInfo();
|
||||
|
||||
updateButtonDisableState();
|
||||
});
|
||||
}
|
||||
|
||||
private void applyTradeErrorMessage(@Nullable String errorMessage) {
|
||||
|
Loading…
Reference in New Issue
Block a user