use of io.bitsquare.common.handlers.ResultHandler in project bitsquare by bitsquare.
the class Offer method checkOfferAvailability.
///////////////////////////////////////////////////////////////////////////////////////////
// Availability
///////////////////////////////////////////////////////////////////////////////////////////
public void checkOfferAvailability(OfferAvailabilityModel model, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
availabilityProtocol = new OfferAvailabilityProtocol(model, () -> {
cancelAvailabilityRequest();
resultHandler.handleResult();
}, (errorMessage) -> {
if (availabilityProtocol != null)
availabilityProtocol.cancel();
log.error(errorMessage);
errorMessageHandler.handleErrorMessage(errorMessage);
});
availabilityProtocol.sendOfferAvailabilityRequest();
}
use of io.bitsquare.common.handlers.ResultHandler in project bitsquare by bitsquare.
the class BuyerStep5View method doWithdrawal.
private void doWithdrawal(Coin receiverAmount) {
String toAddress = withdrawAddressTextField.getText();
ResultHandler resultHandler = this::handleTradeCompleted;
FaultHandler faultHandler = (errorMessage, throwable) -> {
useSavingsWalletButton.setDisable(false);
withdrawToExternalWalletButton.setDisable(false);
if (throwable != null && throwable.getMessage() != null)
new Popup().error(errorMessage + "\n\n" + throwable.getMessage()).show();
else
new Popup().error(errorMessage).show();
};
if (model.dataModel.walletService.getWallet().isEncrypted()) {
UserThread.runAfter(() -> model.dataModel.walletPasswordWindow.onAesKey(aesKey -> doWithdrawRequest(toAddress, receiverAmount, aesKey, resultHandler, faultHandler)).show(), 300, TimeUnit.MILLISECONDS);
} else
doWithdrawRequest(toAddress, receiverAmount, null, resultHandler, faultHandler);
}
Aggregations