diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index 2c454ff4df..6057412844 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.2.1-SNAPSHOT + 0.2.1 4.0.0 diff --git a/bootstrap/src/main/java/io/bitsquare/app/bootstrap/BootstrapNode.java b/bootstrap/src/main/java/io/bitsquare/app/bootstrap/BootstrapNode.java index b8a46d791a..96ec85e448 100644 --- a/bootstrap/src/main/java/io/bitsquare/app/bootstrap/BootstrapNode.java +++ b/bootstrap/src/main/java/io/bitsquare/app/bootstrap/BootstrapNode.java @@ -122,7 +122,7 @@ public class BootstrapNode { @Override public void peerUpdated(PeerAddress peerAddress, PeerStatistic peerStatistics) { try { - log.info("Peer updated: peerAddress=" + peerAddress + ", peerStatistics=" + peerStatistics); + //log.info("Peer updated: peerAddress=" + peerAddress + ", peerStatistics=" + peerStatistics); } catch (Throwable t) { log.error("Exception at peerUpdated " + t.getMessage()); } diff --git a/core/pom.xml b/core/pom.xml index 3a998c9c86..26e4703e10 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -6,7 +6,7 @@ parent io.bitsquare - 0.2.1-SNAPSHOT + 0.2.1 core @@ -47,7 +47,7 @@ net.tomp2p tomp2p-all - 5.0-Beta6 + 5.0-Beta7 @@ -56,21 +56,20 @@ 1.52 + + com.google.inject + guice + 3.0 + com.google.guava guava 16.0.1 - - ch.qos.logback - logback-core - 1.1.2 - - - ch.qos.logback - logback-classic - 1.1.2 + com.google.code.gson + gson + 2.2.4 @@ -88,43 +87,33 @@ jopt-simple 4.8 - - com.google.inject - guice - 3.0 - - - com.google.code.gson - gson - 2.2.4 - net.glxn qrgen 1.3 - - com.google.code.findbugs - jsr305 - 2.0.1 - - - net.jcip - jcip-annotations - 1.0 - + + org.jetbrains annotations 13.0 - - org.fxmisc.easybind - easybind - 1.0.2 - + com.codahale.metrics @@ -132,5 +121,17 @@ 3.0.2 + + ch.qos.logback + logback-core + 1.1.2 + + + ch.qos.logback + logback-classic + 1.1.2 + + + diff --git a/core/src/main/java/io/bitsquare/btc/FeePolicy.java b/core/src/main/java/io/bitsquare/btc/FeePolicy.java index 523215193a..7cf4705e88 100644 --- a/core/src/main/java/io/bitsquare/btc/FeePolicy.java +++ b/core/src/main/java/io/bitsquare/btc/FeePolicy.java @@ -56,8 +56,8 @@ public class FeePolicy { takeOfferFeeAddress = "1BVxNn3T12veSK6DgqwU4Hdn7QHcDDRag7"; break; case REGTEST: - createOfferFeeAddress = "mxmKZruv9x9JLcEj6rZx6Hnm4LLAcQHtcr"; - takeOfferFeeAddress = "mxmKZruv9x9JLcEj6rZx6Hnm4LLAcQHtcr"; + createOfferFeeAddress = "mkNW1omJFA7RD3AZ94mfKqubRff2gx21KE"; + takeOfferFeeAddress = "mkNW1omJFA7RD3AZ94mfKqubRff2gx21KE"; break; default: throw new BitsquareException("Unknown bitcoin network: %s", bitcoinNetwork); diff --git a/core/src/main/java/io/bitsquare/crypto/CryptoService.java b/core/src/main/java/io/bitsquare/crypto/CryptoService.java index e6254dd36e..953b090d08 100644 --- a/core/src/main/java/io/bitsquare/crypto/CryptoService.java +++ b/core/src/main/java/io/bitsquare/crypto/CryptoService.java @@ -148,26 +148,38 @@ public class CryptoService { Cipher cipherAsym = Cipher.getInstance(ASYM_CIPHER); cipherAsym.init(Cipher.DECRYPT_MODE, keyRing.getMsgEncryptionKeyPair().getPrivate()); Object secretKeyObject = sealedSecretKey.getObject(cipherAsym); - assert secretKeyObject instanceof SecretKey; - SecretKey secretKey = (SecretKey) secretKeyObject; + if (secretKeyObject instanceof SecretKey) { + SecretKey secretKey = (SecretKey) secretKeyObject; - // Decrypt signedMessage with secretKey - Cipher cipherSym = Cipher.getInstance(SYM_CIPHER); - cipherSym.init(Cipher.DECRYPT_MODE, secretKey); - Object signedMessageObject = sealedMessage.getObject(cipherSym); - assert signedMessageObject instanceof SignedObject; - SignedObject signedMessage = (SignedObject) signedMessageObject; + // Decrypt signedMessage with secretKey + Cipher cipherSym = Cipher.getInstance(SYM_CIPHER); + cipherSym.init(Cipher.DECRYPT_MODE, secretKey); + Object signedMessageObject = sealedMessage.getObject(cipherSym); + if (signedMessageObject instanceof SignedObject) { + SignedObject signedMessage = (SignedObject) signedMessageObject; - // Verify message with peers pubKey - if (signedMessage.verify(signaturePubKey, Signature.getInstance(MSG_SIGN_ALGO))) { - // Get message - Object messageObject = signedMessage.getObject(); - assert messageObject instanceof Message; - log.debug("Decryption needed {} ms", System.currentTimeMillis() - ts); - return new MessageWithPubKey((Message) messageObject, signaturePubKey); + // Verify message with peers pubKey + if (signedMessage.verify(signaturePubKey, Signature.getInstance(MSG_SIGN_ALGO))) { + // Get message + Object messageObject = signedMessage.getObject(); + if (messageObject instanceof Message) { + log.debug("Decryption needed {} ms", System.currentTimeMillis() - ts); + return new MessageWithPubKey((Message) messageObject, signaturePubKey); + } + else { + throw new CryptoException("messageObject is not instance of Message"); + } + } + else { + throw new CryptoException("Signature is not valid"); + } + } + else { + throw new CryptoException("signedMessageObject is not instance of SignedObject"); + } } else { - throw new CryptoException("Signature is not valid"); + throw new CryptoException("secretKeyObject is not instance of SecretKey"); } } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | BadPaddingException | ClassNotFoundException | IllegalBlockSizeException | IOException | SignatureException e) { @@ -175,7 +187,6 @@ public class CryptoService { } } - public String signMessage(ECKey key, Sha256Hash hash) { ECKey.ECDSASignature sig = key.sign(hash, null); // Now we have to work backwards to figure out the recId needed to recover the signature. diff --git a/core/src/main/java/io/bitsquare/p2p/tomp2p/BootstrappedPeerBuilder.java b/core/src/main/java/io/bitsquare/p2p/tomp2p/BootstrappedPeerBuilder.java index 6f37ffb36b..0da9545450 100644 --- a/core/src/main/java/io/bitsquare/p2p/tomp2p/BootstrappedPeerBuilder.java +++ b/core/src/main/java/io/bitsquare/p2p/tomp2p/BootstrappedPeerBuilder.java @@ -171,8 +171,8 @@ public class BootstrappedPeerBuilder { try { // port is evaluated from btc network. 7366 for mainnet, 7367 for testnet and 7368 for regtest bootstrapNode = Node.at(bootstrapNode.getName(), bootstrapNode.getIp(), bootstrapNode.getPort() + networkId); - log.debug("Bootstrap to {}", bootstrapNode.toString()); - + log.debug("Bootstrap to {} with networkId {}", bootstrapNode.toString(), networkId); + DefaultEventExecutorGroup eventExecutorGroup = new DefaultEventExecutorGroup(20); ChannelClientConfiguration clientConf = PeerBuilder.createDefaultChannelClientConfiguration(); clientConf.pipelineFilter(new PeerBuilder.EventExecutorGroupFilter(eventExecutorGroup)); diff --git a/core/src/main/java/io/bitsquare/p2p/tomp2p/TomP2PNode.java b/core/src/main/java/io/bitsquare/p2p/tomp2p/TomP2PNode.java index 4bf2b57d94..bcef4754bb 100644 --- a/core/src/main/java/io/bitsquare/p2p/tomp2p/TomP2PNode.java +++ b/core/src/main/java/io/bitsquare/p2p/tomp2p/TomP2PNode.java @@ -127,8 +127,8 @@ public class TomP2PNode implements ClientNode { @Override public void peerUpdated(PeerAddress peerAddress, PeerStatistic peerStatistic) { BaseP2PService.getUserThread().execute(() -> numPeers.set(peerDHT.peerBean().peerMap().all().size())); - log.debug("peerUpdated " + peerAddress); - log.debug("Number of peers = " + peerDHT.peerBean().peerMap().all().size()); + // log.debug("peerUpdated " + peerAddress); + // log.debug("Number of peers = " + peerDHT.peerBean().peerMap().all().size()); } }); /* peerDHT.peerBean().addPeerStatusListener(new PeerStatusListener() { diff --git a/core/src/main/java/io/bitsquare/trade/Trade.java b/core/src/main/java/io/bitsquare/trade/Trade.java index ad4c8a5cdf..03062ebc42 100644 --- a/core/src/main/java/io/bitsquare/trade/Trade.java +++ b/core/src/main/java/io/bitsquare/trade/Trade.java @@ -256,7 +256,7 @@ abstract public class Trade implements Tradable, Model, Serializable { abstract public void setFailedState(); public boolean isCriticalFault() { - return tradeState.getPhase().ordinal() >= TradeState.Phase.DEPOSIT_PAID.ordinal(); + return tradeState.getPhase() != null && tradeState.getPhase().ordinal() >= TradeState.Phase.DEPOSIT_PAID.ordinal(); } diff --git a/core/src/main/java/io/bitsquare/trade/TradeManager.java b/core/src/main/java/io/bitsquare/trade/TradeManager.java index 66b59707ae..d2928cc7ee 100644 --- a/core/src/main/java/io/bitsquare/trade/TradeManager.java +++ b/core/src/main/java/io/bitsquare/trade/TradeManager.java @@ -88,7 +88,7 @@ public class TradeManager { private final CryptoService cryptoService; private final OpenOfferManager openOfferManager; private final ClosedTradableManager closedTradableManager; - private FailedTradesManager failedTradesManager; + private final FailedTradesManager failedTradesManager; private final ArbitrationRepository arbitrationRepository; private final Storage> pendingTradesStorage; diff --git a/gui/pom.xml b/gui/pom.xml index 121aada48e..846dcf7de7 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -22,7 +22,7 @@ parent io.bitsquare - 0.2.1-SNAPSHOT + 0.2.1 4.0.0 @@ -131,11 +131,11 @@ - - com.vinumeris - crashfx-client - 1.1 - + org.controlsfx diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java index 75490b717c..8bfda3308f 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java @@ -60,6 +60,8 @@ import static io.bitsquare.app.BitsquareEnvironment.APP_NAME_KEY; public class BitsquareApp extends Application { private static final Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(BitsquareApp.class); + public static final boolean DEV_MODE = true; + private static Environment env; private BitsquareAppModule bitsquareAppModule; @@ -96,7 +98,7 @@ public class BitsquareApp extends Application { Threading.USER_THREAD = Platform::runLater; // Use CrashFX for report crash logs - /* CrashFX.setup("Bitsquare/" + Version.VERSION, + /*CrashFX.setup("Bitsquare/" + Version.VERSION, Paths.get(env.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "crashes"), URI.create("http://188.226.179.109/crashfx/upload"));*/ // Server not setup yet, so we use client side only support @@ -136,7 +138,8 @@ public class BitsquareApp extends Application { new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) stop(); else if (new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) - showDebugWindow(); + if (BitsquareApp.DEV_MODE) + showDebugWindow(); }); // configure the primary stage @@ -160,7 +163,6 @@ public class BitsquareApp extends Application { // make the UI visible primaryStage.show(); - //TODO just temp. //showDebugWindow(); } catch (Throwable throwable) { showErrorPopup(throwable, true); diff --git a/gui/src/main/java/io/bitsquare/app/UpdateProcess.java b/gui/src/main/java/io/bitsquare/app/UpdateProcess.java index b2c2b357f0..03e04532b0 100644 --- a/gui/src/main/java/io/bitsquare/app/UpdateProcess.java +++ b/gui/src/main/java/io/bitsquare/app/UpdateProcess.java @@ -47,7 +47,7 @@ import rx.subjects.Subject; public class UpdateProcess { private static final Logger log = LoggerFactory.getLogger(UpdateProcess.class); - private static final List UPDATE_SIGNING_KEYS = Crypto.decode("0296CFF54A8B1611499D4C1024E654140AFBB58C505FE4BB7C847B4F4A7C683DF6"); + private static final List UPDATE_SIGNING_KEYS = Crypto.decode("038396415C265C59042AB05A5436356E8D0FA19F13E3DE4915AFF763CB4785345E"); private static final String UPDATES_BASE_URL = "http://bitsquare.io/updateFX/"; private static final int UPDATE_SIGNING_THRESHOLD = 1; private static final Path ROOT_CLASS_PATH = UpdateFX.findCodePath(BitsquareAppMain.class); diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainView.java b/gui/src/main/java/io/bitsquare/gui/main/MainView.java index 070b964ba5..cff736a743 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainView.java @@ -97,19 +97,19 @@ public class MainView extends InitializableView { @Override protected void initialize() { ToggleButton homeButton = new NavButton(HomeView.class, "Overview") {{ - setDisable(true); // alpha + setDisable(true); // TODO for alpha }}; ToggleButton buyButton = new NavButton(BuyOfferView.class, "Buy BTC"); ToggleButton sellButton = new NavButton(SellOfferView.class, "Sell BTC"); ToggleButton portfolioButton = new NavButton(PortfolioView.class, "Portfolio"); ToggleButton fundsButton = new NavButton(FundsView.class, "Funds"); ToggleButton msgButton = new NavButton(MsgView.class, "Messages") {{ - setDisable(true); // alpha + setDisable(true); // TODO for alpha }}; ToggleButton settingsButton = new NavButton(SettingsView.class, "Settings"); - ToggleButton accountButton = new NavButton(AccountView.class, "Account"); /*{{ - setDisable(true); // alpha - }};*/ + ToggleButton accountButton = new NavButton(AccountView.class, "Account") {{ + setDisable(true); // TODO for alpha + }}; Pane portfolioButtonHolder = new Pane(portfolioButton); Pane bankAccountComboBoxHolder = new Pane(); @@ -208,7 +208,7 @@ public class MainView extends InitializableView { blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfo); walletServiceErrorMsgListener = (ov, oldValue, newValue) -> { blockchainSyncLabel.setId("splash-error-state-msg"); - openBTCConnectionErrorPopup(newValue); + // error popup is called by error handler at createFooter }; model.walletServiceErrorMsg.addListener(walletServiceErrorMsgListener); @@ -257,7 +257,7 @@ public class MainView extends InitializableView { bootstrapErrorMsgListener = (ov, oldValue, newValue) -> { bootstrapStateLabel.setId("splash-error-state-msg"); bootstrapIndicator.setVisible(false); - openBTCConnectionErrorPopup(model.bootstrapErrorMsg.get()); + // error popup is handled by handler at createFooter }; model.bootstrapErrorMsg.addListener(bootstrapErrorMsgListener); @@ -490,7 +490,7 @@ public class MainView extends InitializableView { vBox.setAlignment(Pos.CENTER); vBox.getChildren().setAll(comboBox, titleLabel); - // For alpha + // TODO for alpha vBox.setDisable(true); return vBox; @@ -559,7 +559,7 @@ public class MainView extends InitializableView { } private void openBTCConnectionErrorPopup(String errorMsg) { - Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + errorMsg - + "\nPlease check your internet connection."); + Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + errorMsg); + // + "\nPlease check your internet connection." } } \ No newline at end of file diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java index 025b6c48f4..6b574e1814 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java @@ -64,8 +64,9 @@ import rx.Observable; class MainViewModel implements ViewModel { private static final Logger log = LoggerFactory.getLogger(MainViewModel.class); - private static final long BLOCKCHAIN_SYNC_TIMEOUT = 30000; - private static final long LOST_CONNECTION_TIMEOUT = 10000; + private static final long BLOCKCHAIN_SYNC_TIMEOUT = 60000; + private static final long LOST_P2P_CONNECTION_TIMEOUT = 5000; + private static final long LOST_BTC_CONNECTION_TIMEOUT = 2000; private final User user; private final KeyRing keyRing; @@ -112,7 +113,8 @@ class MainViewModel implements ViewModel { final String bitcoinNetworkAsString; private Timer blockchainSyncTimeoutTimer; - private Timer lostConnectionTimeoutTimer; + private Timer lostP2PConnectionTimeoutTimer; + private Timer lostBTCConnectionTimeoutTimer; @Inject @@ -160,11 +162,23 @@ class MainViewModel implements ViewModel { setBitcoinNetworkSyncProgress(walletService.downloadPercentageProperty().get()); walletService.numPeersProperty().addListener((observable, oldValue, newValue) -> { + numBTCPeers.set(String.valueOf(newValue) + " peers"); - if ((int) newValue < 1) - walletServiceErrorMsg.set("We lost connection to the last peer."); - else + if ((int) newValue < 1) { + if (lostBTCConnectionTimeoutTimer != null) + lostBTCConnectionTimeoutTimer.cancel(); + lostBTCConnectionTimeoutTimer = Utilities.setTimeout(LOST_BTC_CONNECTION_TIMEOUT, () -> { + log.trace("Connection lost timeout reached"); + walletServiceErrorMsg.set("We lost connection to the last peer."); + }); + } + else { + if (lostBTCConnectionTimeoutTimer != null) { + lostBTCConnectionTimeoutTimer.cancel(); + lostBTCConnectionTimeoutTimer = null; + } walletServiceErrorMsg.set(null); + } }); // Set executor for all P2PServices @@ -173,17 +187,17 @@ class MainViewModel implements ViewModel { clientNode.numPeersProperty().addListener((observable, oldValue, newValue) -> { numDHTPeers.set(String.valueOf(newValue) + " peers"); if ((int) newValue == 0) { - if (lostConnectionTimeoutTimer != null) - lostConnectionTimeoutTimer.cancel(); - lostConnectionTimeoutTimer = Utilities.setTimeout(LOST_CONNECTION_TIMEOUT, () -> { + if (lostP2PConnectionTimeoutTimer != null) + lostP2PConnectionTimeoutTimer.cancel(); + lostP2PConnectionTimeoutTimer = Utilities.setTimeout(LOST_P2P_CONNECTION_TIMEOUT, () -> { log.trace("Connection lost timeout reached"); bootstrapErrorMsg.set("We lost connection to the last peer."); }); } else if ((int) oldValue == 0 && (int) newValue > 0) { - if (lostConnectionTimeoutTimer != null) { - lostConnectionTimeoutTimer.cancel(); - lostConnectionTimeoutTimer = null; + if (lostP2PConnectionTimeoutTimer != null) { + lostP2PConnectionTimeoutTimer.cancel(); + lostP2PConnectionTimeoutTimer = null; } bootstrapErrorMsg.set(null); } @@ -243,7 +257,7 @@ class MainViewModel implements ViewModel { updateNumPendingTrades(); showAppScreen.set(true); - // For alpha version + // TODO for alpha version if (!user.isRegistered()) { FiatAccount fiatAccount = new FiatAccount(FiatAccount.Type.IRC, "EUR", @@ -400,7 +414,6 @@ class MainViewModel implements ViewModel { log.trace("startBlockchainSyncTimeout"); stopBlockchainSyncTimeout(); - blockchainSyncTimeoutTimer = Utilities.setTimeout(BLOCKCHAIN_SYNC_TIMEOUT, () -> { log.trace("Timeout reached"); setWalletServiceException(new TimeoutException()); diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java index fe5bfda2e0..6ee6deece3 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java @@ -17,6 +17,7 @@ package io.bitsquare.gui.main.offer.createoffer; +import io.bitsquare.app.BitsquareApp; import io.bitsquare.gui.Navigation; import io.bitsquare.gui.OverlayManager; import io.bitsquare.gui.common.view.ActivatableViewAndModel; @@ -279,10 +280,11 @@ public class CreateOfferView extends ActivatableViewAndModel { - // TODO temp just for testing - newValue = false; - close(); - navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class); + if (BitsquareApp.DEV_MODE) { + newValue = false; + close(); + navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class); + } if (newValue) { overlayManager.blurContent(); @@ -386,25 +388,26 @@ public class CreateOfferView extends ActivatableViewAndModel actions = new ArrayList<>(); - actions.add(new AbstractAction(BSResources.get("shared.close")) { - @Override - public void handle(ActionEvent actionEvent) { - getProperties().put("type", "CLOSE"); - Dialog.Actions.CLOSE.handle(actionEvent); - } - }); - Popups.openInfoPopup("To ensure that both traders behave fair they need to pay a security deposit.", - "The deposit will stay in your local trading wallet until the offer gets accepted by " + - "another trader. " + - "\nIt will be refunded to you after the trade has successfully completed.", - actions); + if (!BitsquareApp.DEV_MODE) { + if (model.getDisplaySecurityDepositInfo()) { + overlayManager.blurContent(); + List actions = new ArrayList<>(); + actions.add(new AbstractAction(BSResources.get("shared.close")) { + @Override + public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); + Dialog.Actions.CLOSE.handle(actionEvent); + } + }); + Popups.openInfoPopup("To ensure that both traders behave fair they need to pay a security deposit.", + "The deposit will stay in your local trading wallet until the offer gets accepted by " + + "another trader. " + + "\nIt will be refunded to you after the trade has successfully completed.", + actions); - model.securityDepositInfoDisplayed(); - }*/ + model.onSecurityDepositInfoDisplayed(); + } + } priceAmountPane.setInactive(); diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java index 5ff0acdcf7..c2bc4100bd 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java @@ -58,8 +58,6 @@ import org.controlsfx.dialog.Dialog; import static javafx.beans.binding.Bindings.createStringBinding; -// Note: countryColumn is deactivated in alpha version - @FxmlView public class OfferBookView extends ActivatableViewAndModel { @@ -110,7 +108,8 @@ public class OfferBookView extends ActivatableViewAndModel im price.addListener(priceListener); volume.addListener(volumeListener); - amount.set("1"); - price.set("300"); - setAmountToModel(); - setPriceToModel(); + if (BitsquareApp.DEV_MODE) { + amount.set("1"); + price.set("300"); + setAmountToModel(); + setPriceToModel(); + } } private void removeListeners() { diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java index c246fe50bf..3b1a78007a 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java @@ -18,6 +18,7 @@ package io.bitsquare.gui.main.offer.takeoffer; +import io.bitsquare.app.BitsquareApp; import io.bitsquare.gui.Navigation; import io.bitsquare.gui.OverlayManager; import io.bitsquare.gui.common.view.ActivatableViewAndModel; @@ -203,11 +204,12 @@ public class TakeOfferView extends ActivatableViewAndModel { - // TODO temp just for testing - newValue = false; - close(); - navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class); - + if (BitsquareApp.DEV_MODE) { + newValue = false; + close(); + navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class); + } + if (newValue) { overlayManager.blurContent(); @@ -371,24 +373,25 @@ public class TakeOfferView extends ActivatableViewAndModel actions = new ArrayList<>(); - actions.add(new AbstractAction(BSResources.get("shared.close")) { - @Override - public void handle(ActionEvent actionEvent) { - getProperties().put("type", "CLOSE"); - Dialog.Actions.CLOSE.handle(actionEvent); - } - }); - Popups.openInfoPopup("To ensure that both traders behave fair they need to pay a security deposit.", - "The deposit will stay in your local trading wallet until the offer gets accepted by another trader. " + - "\nIt will be refunded to you after the trade has successfully completed.", - actions); + if (!BitsquareApp.DEV_MODE) { + if (model.getDisplaySecurityDepositInfo()) { + overlayManager.blurContent(); + List actions = new ArrayList<>(); + actions.add(new AbstractAction(BSResources.get("shared.close")) { + @Override + public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); + Dialog.Actions.CLOSE.handle(actionEvent); + } + }); + Popups.openInfoPopup("To ensure that both traders behave fair they need to pay a security deposit.", + "The deposit will stay in your local trading wallet until the offer gets accepted by another trader. " + + "\nIt will be refunded to you after the trade has successfully completed.", + actions); - model.securityDepositInfoDisplayed(); - }*/ + model.onSecurityDepositInfoDisplayed(); + } + } priceAmountPane.setInactive(); takeOfferButton.setVisible(true); diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferViewModel.java index 4493069a45..0f23e5b3da 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferViewModel.java @@ -455,7 +455,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel im return dataModel.getDirection() == Offer.Direction.BUY; } - void securityDepositInfoDisplayed() { + void onSecurityDepositInfoDisplayed() { dataModel.onSecurityDepositInfoDisplayed(); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.fxml b/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.fxml index 45dc826f3b..3b362ca950 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.fxml +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.fxml @@ -27,6 +27,5 @@ - diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java index 6eaa322732..b6bda3fd26 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java @@ -29,29 +29,34 @@ import io.bitsquare.gui.main.portfolio.closedtrades.ClosedTradesView; import io.bitsquare.gui.main.portfolio.failedtrades.FailedTradesView; import io.bitsquare.gui.main.portfolio.openoffer.OpenOffersView; import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView; +import io.bitsquare.trade.Trade; +import io.bitsquare.trade.failed.FailedTradesManager; import javax.inject.Inject; import javafx.beans.value.ChangeListener; +import javafx.collections.ListChangeListener; import javafx.fxml.FXML; import javafx.scene.control.*; @FxmlView public class PortfolioView extends ActivatableViewAndModel { - @FXML Tab openOffersTab, pendingTradesTab, closedTradesTab, failedTradesTab; - + @FXML Tab openOffersTab, pendingTradesTab, closedTradesTab; + private Tab failedTradesTab = new Tab("Failed"); private Tab currentTab; private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; private final ViewLoader viewLoader; private final Navigation navigation; + private FailedTradesManager failedTradesManager; @Inject - public PortfolioView(CachingViewLoader viewLoader, Navigation navigation) { + public PortfolioView(CachingViewLoader viewLoader, Navigation navigation, FailedTradesManager failedTradesManager) { this.viewLoader = viewLoader; this.navigation = navigation; + this.failedTradesManager = failedTradesManager; } @Override @@ -77,6 +82,16 @@ public class PortfolioView extends ActivatableViewAndModel @Override public void doActivate() { + failedTradesManager.getFailedTrades().addListener((ListChangeListener) c -> { + if (failedTradesManager.getFailedTrades().size() > 0 && root.getTabs().size() == 3) + root.getTabs().add(failedTradesTab); + else + root.getTabs().remove(failedTradesTab); + }); + if (failedTradesManager.getFailedTrades().size() > 0 && root.getTabs().size() == 3) + root.getTabs().add(failedTradesTab); + else + root.getTabs().remove(failedTradesTab); root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener); navigation.addListener(navigationListener); diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/steps/CompletedView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/steps/CompletedView.java index 4ce144e119..3b5189775a 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/steps/CompletedView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/steps/CompletedView.java @@ -17,6 +17,7 @@ package io.bitsquare.gui.main.portfolio.pendingtrades.steps; +import io.bitsquare.app.BitsquareApp; import io.bitsquare.gui.components.InfoDisplay; import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesViewModel; @@ -131,8 +132,8 @@ public class CompletedView extends TradeStepDetailsView { withdrawAddressTextField = getAndAddLabelInputTextFieldPair(gridPane, gridRow++, "Withdraw to address:").inputTextField; withdrawButton = getAndAddButton(gridPane, gridRow++, "Withdraw to external wallet", this::onWithdrawRequest); - //TODO just temp for testing - withdrawAddressTextField.setText("mxmKZruv9x9JLcEj6rZx6Hnm4LLAcQHtcr"); + if (BitsquareApp.DEV_MODE) + withdrawAddressTextField.setText("mkNW1omJFA7RD3AZ94mfKqubRff2gx21KE"); } public void setBtcTradeAmountLabelText(String text) { diff --git a/gui/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java b/gui/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java index a5e5080011..d8ffd3c5be 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java @@ -42,7 +42,7 @@ public class PreferencesView extends ActivatableViewAndModelCFBundleIconFile package/mac/Bitsquare.icns CFBundleIdentifier - io.bitsquare + io.bitsquare.Bitsquare CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -21,17 +21,23 @@ CFBundlePackageType APPL CFBundleShortVersionString - 19 + 1 + + CFBundleSignature ???? - + LSApplicationCategoryType - Unknown + public.app-category.finance CFBundleVersion - 100 + 1 NSHumanReadableCopyright Copyright (C) 2015 + + NSHighResolutionCapable + true + JVMRuntime .. JVMMainClassName @@ -44,13 +50,10 @@ bitsquare JVMOptions - JVMUserOptions - - NSHighResolutionCapable - true + diff --git a/package/mac/Info.template.plist b/package/mac/Info.template.plist index 04712d32d5..c7ec039f21 100644 --- a/package/mac/Info.template.plist +++ b/package/mac/Info.template.plist @@ -13,7 +13,7 @@ CFBundleIconFile package/mac/Bitsquare.icns CFBundleIdentifier - io.bitsquare + io.bitsquare.Bitsquare CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -21,17 +21,23 @@ CFBundlePackageType APPL CFBundleShortVersionString - 19 + 1 + + CFBundleSignature ???? - + LSApplicationCategoryType - Unknown + public.app-category.finance CFBundleVersion - 100 + 1 NSHumanReadableCopyright Copyright (C) 2015 + + NSHighResolutionCapable + true + JVMRuntime .. JVMMainClassName @@ -44,13 +50,10 @@ bitsquare JVMOptions - JVMUserOptions - - NSHighResolutionCapable - true + diff --git a/package/mac/create_app.sh b/package/mac/create_app.sh index 91287e181d..f68b9f4062 100644 --- a/package/mac/create_app.sh +++ b/package/mac/create_app.sh @@ -31,7 +31,9 @@ sed "s|JAR_NAME_STRING_GOES_HERE|$patchVersion.jar|" package/mac/Info.template.p mvn clean package -DskipTests -Dmaven.javadoc.skip=true cp gui/target/shaded.jar gui/updatefx/builds/$patchVersion.jar -java -jar ./updatefx/updatefx-app-1.2.jar --url=http://bitsquare.io/updateFX/ gui/updatefx +java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx +# using trezor +#java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx --trezor $JAVA_HOME/bin/javapackager \ -deploy \ diff --git a/package/mac/setup.sh b/package/mac/setup.sh index 9a852cfa91..4970f6018c 100644 --- a/package/mac/setup.sh +++ b/package/mac/setup.sh @@ -9,7 +9,7 @@ mkdir gui/updatefx/site mkdir gui/deploy # create key/wallet. Copy wallet key to UpdateProcess and use wallet for other OS builds -java -jar ./updatefx/updatefx-app-1.2.jar --url=http://bitsquare.io/updateFX/ gui/updatefx +java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx cd package/mac diff --git a/package/mac/update.sh b/package/mac/update.sh index 4c68517ce6..43489bd0f4 100644 --- a/package/mac/update.sh +++ b/package/mac/update.sh @@ -13,6 +13,6 @@ echo patchVersion = $patchVersion mvn clean package -DskipTests -Dmaven.javadoc.skip=true cp gui/target/shaded.jar gui/updatefx/builds/$patchVersion.jar -java -jar ./updatefx/updatefx-app-1.2.jar --url=http://bitsquare.io/updateFX/ gui/updatefx +java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx cd package/mac \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1cae858766..cab92e5ce5 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.bitsquare parent pom - 0.2.1-SNAPSHOT + 0.2.1 The decentralized bitcoin exchange https://bitsquare.io diff --git a/updatefx/updatefx-app-1.2.jar b/updatefx/updatefx-app-1.2.jar deleted file mode 100644 index 7a07da2fac..0000000000 Binary files a/updatefx/updatefx-app-1.2.jar and /dev/null differ