mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-12-11 20:33:32 +01:00
init offer address entry off user thread to prevent blocking
This commit is contained in:
parent
e956114239
commit
49ee3b19b1
@ -95,7 +95,6 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
||||
private final CoinFormatter btcFormatter;
|
||||
private final Navigation navigation;
|
||||
private final String offerId;
|
||||
private final XmrBalanceListener xmrBalanceListener;
|
||||
private final SetChangeListener<PaymentAccount> paymentAccountsChangeListener;
|
||||
|
||||
protected OfferDirection direction;
|
||||
@ -128,6 +127,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
||||
protected long triggerPrice;
|
||||
@Getter
|
||||
protected boolean reserveExactAmount;
|
||||
private XmrBalanceListener xmrBalanceListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -163,20 +163,12 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
||||
|
||||
offerId = OfferUtil.getRandomOfferId();
|
||||
shortOfferId = Utilities.getShortId(offerId);
|
||||
addressEntry = xmrWalletService.getOrCreateAddressEntry(offerId, XmrAddressEntry.Context.OFFER_FUNDING);
|
||||
|
||||
reserveExactAmount = preferences.getSplitOfferOutput();
|
||||
|
||||
useMarketBasedPrice.set(preferences.isUsePercentageBasedPrice());
|
||||
buyerSecurityDepositPct.set(Restrictions.getMinBuyerSecurityDepositAsPercent());
|
||||
|
||||
xmrBalanceListener = new XmrBalanceListener(getAddressEntry().getSubaddressIndex()) {
|
||||
@Override
|
||||
public void onBalanceChanged(BigInteger balance) {
|
||||
updateBalance();
|
||||
}
|
||||
};
|
||||
|
||||
paymentAccountsChangeListener = change -> fillPaymentAccounts();
|
||||
}
|
||||
|
||||
@ -212,6 +204,14 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
||||
|
||||
// called before activate()
|
||||
public boolean initWithData(OfferDirection direction, TradeCurrency tradeCurrency) {
|
||||
addressEntry = xmrWalletService.getOrCreateAddressEntry(offerId, XmrAddressEntry.Context.OFFER_FUNDING);
|
||||
xmrBalanceListener = new XmrBalanceListener(getAddressEntry().getSubaddressIndex()) {
|
||||
@Override
|
||||
public void onBalanceChanged(BigInteger balance) {
|
||||
updateBalance();
|
||||
}
|
||||
};
|
||||
|
||||
this.direction = direction;
|
||||
this.tradeCurrency = tradeCurrency;
|
||||
|
||||
|
@ -210,9 +210,6 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||
|
||||
paymentLabel = Res.get("createOffer.fundsBox.paymentLabel", dataModel.shortOfferId);
|
||||
|
||||
if (dataModel.getAddressEntry() != null) {
|
||||
addressAsString = dataModel.getAddressEntry().getAddressString();
|
||||
}
|
||||
createListeners();
|
||||
}
|
||||
|
||||
@ -568,6 +565,9 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||
|
||||
boolean initWithData(OfferDirection direction, TradeCurrency tradeCurrency) {
|
||||
boolean result = dataModel.initWithData(direction, tradeCurrency);
|
||||
if (dataModel.getAddressEntry() != null) {
|
||||
addressAsString = dataModel.getAddressEntry().getAddressString();
|
||||
}
|
||||
if (dataModel.paymentAccount != null)
|
||||
xmrValidator.setMaxValue(dataModel.paymentAccount.getPaymentMethod().getMaxTradeLimit(dataModel.getTradeCurrencyCode().get()));
|
||||
xmrValidator.setMaxTradeLimit(BigInteger.valueOf(dataModel.getMaxTradeLimit()));
|
||||
|
Loading…
Reference in New Issue
Block a user