From 8732a803ea4b0ff9c20baab64444d279d3afb460 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:38:56 +0200 Subject: [PATCH 1/9] Use personal bundle identifier --- package/osx/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/osx/Info.plist b/package/osx/Info.plist index f983c0ce37..17cd194e48 100644 --- a/package/osx/Info.plist +++ b/package/osx/Info.plist @@ -15,7 +15,7 @@ CFBundleName Bisq CFBundleIdentifier - io.bisq.Bisq + io.bisq.CAT CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType From 0ada18fa4e1c6db7f1a5284fb84ea54b7c87a4a9 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:39:30 +0200 Subject: [PATCH 2/9] Use key for Christoph Atteneder --- package/signingkey.asc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/signingkey.asc b/package/signingkey.asc index 49c9449491..0e9920d475 100644 --- a/package/signingkey.asc +++ b/package/signingkey.asc @@ -1 +1 @@ -F379A1C6 \ No newline at end of file +29CDFD3B \ No newline at end of file From 66a7a19aa9b1e54b4afd2e6bcac2023ed1571851 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:41:05 +0200 Subject: [PATCH 3/9] Use version variable --- package/osx/create_app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/osx/create_app.sh b/package/osx/create_app.sh index 4bf926a52e..2637722e31 100755 --- a/package/osx/create_app.sh +++ b/package/osx/create_app.sh @@ -10,7 +10,7 @@ version="0.7.0" ./gradlew --include-build ../common --include-build ../assets --include-build ../p2p --include-build ../core build -x test shadowJar -EXE_JAR=build/libs/bisq-desktop-0.7.0-all.jar +EXE_JAR=build/libs/bisq-desktop-$version-all.jar echo SHA 256 before stripping jar file: shasum -a256 $EXE_JAR | awk '{print $1}' From 3e124c561b7a093f2ec759cfa83355dabcd133c0 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:42:05 +0200 Subject: [PATCH 4/9] Not copy unnecessary BC jar files --- package/osx/create_app.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package/osx/create_app.sh b/package/osx/create_app.sh index 2637722e31..24b2e05d79 100755 --- a/package/osx/create_app.sh +++ b/package/osx/create_app.sh @@ -40,17 +40,17 @@ cp $EXE_JAR "$win32/Bisq.jar" cp $EXE_JAR "$win64/Bisq.jar" # copy bouncycastle jars to VM shared folders -bc_lib1=bcpg-jdk15on-1.56.jar -cp build/app/lib/$bc_lib1 "$linux32/$bc_lib1" -cp build/app/lib/$bc_lib1 "$linux64/$bc_lib1" -cp build/app/lib/$bc_lib1 "$win32/$bc_lib1" -cp build/app/lib/$bc_lib1 "$win64/$bc_lib1" +# bc_lib1=bcpg-jdk15on-1.56.jar +# cp build/app/lib/$bc_lib1 "$linux32/$bc_lib1" +# cp build/app/lib/$bc_lib1 "$linux64/$bc_lib1" +# cp build/app/lib/$bc_lib1 "$win32/$bc_lib1" +# cp build/app/lib/$bc_lib1 "$win64/$bc_lib1" -bc_lib2=bcprov-jdk15on-1.56.jar -cp build/app/lib/$bc_lib2 "$linux32/$bc_lib2" -cp build/app/lib/$bc_lib2 "$linux64/$bc_lib2" -cp build/app/lib/$bc_lib2 "$win32/$bc_lib2" -cp build/app/lib/$bc_lib2 "$win64/$bc_lib2" +# bc_lib2=bcprov-jdk15on-1.56.jar +# cp build/app/lib/$bc_lib2 "$linux32/$bc_lib2" +# cp build/app/lib/$bc_lib2 "$linux64/$bc_lib2" +# cp build/app/lib/$bc_lib2 "$win32/$bc_lib2" +# cp build/app/lib/$bc_lib2 "$win64/$bc_lib2" # Copy packager scripts to VM. No need to checkout the source as we only are interested in the build scripts. rm -rf "$linux32/package" From 12fcce02de63434ee1fc64c66c39cd7a4a24b5ff Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:42:41 +0200 Subject: [PATCH 5/9] Use personal bundle identifier --- package/osx/create_app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/osx/create_app.sh b/package/osx/create_app.sh index 24b2e05d79..fb50d245be 100755 --- a/package/osx/create_app.sh +++ b/package/osx/create_app.sh @@ -77,7 +77,7 @@ echo "Using JAVA_HOME: $JAVA_HOME" $JAVA_HOME/bin/javapackager \ -deploy \ -BappVersion=$version \ - -Bmac.CFBundleIdentifier=io.bisq \ + -Bmac.CFBundleIdentifier=io.bisq.CAT \ -Bmac.CFBundleName=Bisq \ -Bicon=package/osx/Bisq.icns \ -Bruntime="$JAVA_HOME/jre" \ From e465428b4b2509aa08f9bdf1013c3b41d814b228 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:44:44 +0200 Subject: [PATCH 6/9] Use version 0.7.1 instead of -SNAPSHOT and bump version number where required --- build.gradle | 8 ++++---- package/linux/32bitBuild.sh | 2 +- package/linux/64bitBuild.sh | 2 +- package/linux/Dockerfile | 2 +- package/linux/rpm.sh | 2 +- package/osx/Info.plist | 2 +- package/osx/create_app.sh | 2 +- package/osx/finalize.sh | 2 +- package/windows/32bitBuild.bat | 2 +- package/windows/64bitBuild.bat | 2 +- package/windows/Bisq.iss | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 1505817c5e..3e3e7a3389 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'witness' apply plugin: 'com.github.johnrengelman.shadow' group = 'network.bisq' -version = '0.7.0-SNAPSHOT' +version = '0.7.1' sourceCompatibility = 1.8 @@ -40,9 +40,9 @@ repositories { } dependencies { - compile 'network.bisq:bisq-core:-SNAPSHOT' - compile 'network.bisq:bisq-p2p:-SNAPSHOT' - compile 'network.bisq:bisq-common:-SNAPSHOT' + compile 'network.bisq:bisq-core:0.7.1' + compile 'network.bisq:bisq-p2p:0.7.1' + compile 'network.bisq:bisq-common:0.7.1' compile 'org.controlsfx:controlsfx:8.0.6_20' compile 'org.reactfx:reactfx:2.0-M3' compile 'net.glxn:qrgen:1.3' diff --git a/package/linux/32bitBuild.sh b/package/linux/32bitBuild.sh index 4fd962c6ac..5ccbd8b53f 100644 --- a/package/linux/32bitBuild.sh +++ b/package/linux/32bitBuild.sh @@ -6,7 +6,7 @@ mkdir -p deploy set -e # Edit version -version=0.7.0 +version=0.7.1 dir="/media/sf_vm_shared_ubuntu14_32bit" diff --git a/package/linux/64bitBuild.sh b/package/linux/64bitBuild.sh index d987527e74..43b260ddcd 100644 --- a/package/linux/64bitBuild.sh +++ b/package/linux/64bitBuild.sh @@ -6,7 +6,7 @@ mkdir -p deploy set -e # Edit version -version=0.7.0 +version=0.7.1 dir="/media/sf_vm_shared_ubuntu" diff --git a/package/linux/Dockerfile b/package/linux/Dockerfile index be101aeed8..cf80e3c12c 100644 --- a/package/linux/Dockerfile +++ b/package/linux/Dockerfile @@ -8,7 +8,7 @@ # pull base image FROM openjdk:8-jdk -ENV version 0.7.0 +ENV version 0.7.1 RUN apt-get update && apt-get install -y --no-install-recommends openjfx && rm -rf /var/lib/apt/lists/* && apt-get install -y vim fakeroot diff --git a/package/linux/rpm.sh b/package/linux/rpm.sh index e311d1dcf6..4260517a6e 100644 --- a/package/linux/rpm.sh +++ b/package/linux/rpm.sh @@ -2,7 +2,7 @@ ## From https://github.com/bisq-network/bisq-desktop/issues/401#issuecomment-372091261 -version=0.7.0 +version=0.7.1 alien -r -g /home/$USER/Desktop/Bisq-64bit-$version.deb find bisq-$version -type f | while read LIB; do LDDOUT=$(ldd $LIB 2>&1); LDDRETVAL=$?;if [ \( -z "${LDDOUT%%*you do not have execution permission for*}" \) -a \( $LDDRETVAL -eq 0 \) ]; then chmod -v +x $LIB;fi;done diff --git a/package/osx/Info.plist b/package/osx/Info.plist index 17cd194e48..45dfa4ca1b 100644 --- a/package/osx/Info.plist +++ b/package/osx/Info.plist @@ -40,7 +40,7 @@ JVMAppClasspath JVMMainJarName - Bisq-0.7.0.jar + Bisq-0.7.1.jar JVMPreferencesID bisq JVMOptions diff --git a/package/osx/create_app.sh b/package/osx/create_app.sh index fb50d245be..0d1c6c1bbb 100755 --- a/package/osx/create_app.sh +++ b/package/osx/create_app.sh @@ -6,7 +6,7 @@ mkdir -p deploy set -e -version="0.7.0" +version="0.7.1" ./gradlew --include-build ../common --include-build ../assets --include-build ../p2p --include-build ../core build -x test shadowJar diff --git a/package/osx/finalize.sh b/package/osx/finalize.sh index 98c0fe9a27..60ff6ca268 100755 --- a/package/osx/finalize.sh +++ b/package/osx/finalize.sh @@ -2,7 +2,7 @@ cd ../../ -version="0.7.0" +version="0.7.1" target_dir="releases/$version" diff --git a/package/windows/32bitBuild.bat b/package/windows/32bitBuild.bat index 0b56ac0d42..87636dbc7c 100644 --- a/package/windows/32bitBuild.bat +++ b/package/windows/32bitBuild.bat @@ -5,7 +5,7 @@ :: 32 bit build :: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) -SET version=0.7.0 +SET version=0.7.1 :: Private setup SET outdir=\\VBOXSVR\vm_shared_windows_32bit diff --git a/package/windows/64bitBuild.bat b/package/windows/64bitBuild.bat index 986d3a1ed5..3d6e2afa97 100644 --- a/package/windows/64bitBuild.bat +++ b/package/windows/64bitBuild.bat @@ -5,7 +5,7 @@ :: 64 bit build :: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) -SET version=0.7.0 +SET version=0.7.1 :: Private setup SET outdir=\\VBOXSVR\vm_shared_windows diff --git a/package/windows/Bisq.iss b/package/windows/Bisq.iss index 9f09e408df..6bf8474604 100755 --- a/package/windows/Bisq.iss +++ b/package/windows/Bisq.iss @@ -3,7 +3,7 @@ [Setup] AppId={{bisq}} AppName=Bisq -AppVersion=0.7.0 +AppVersion=0.7.1 AppVerName=Bisq AppPublisher=Bisq AppComments=Bisq From 2b85d84bded80fd8cd0d361d9bbb007e65316326 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 4 Jul 2018 13:46:35 +0200 Subject: [PATCH 7/9] Revert version to -SNAPSHOT --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 3e3e7a3389..2fef01637d 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'witness' apply plugin: 'com.github.johnrengelman.shadow' group = 'network.bisq' -version = '0.7.1' +version = '0.7.1-SNAPSHOT' sourceCompatibility = 1.8 @@ -40,9 +40,9 @@ repositories { } dependencies { - compile 'network.bisq:bisq-core:0.7.1' - compile 'network.bisq:bisq-p2p:0.7.1' - compile 'network.bisq:bisq-common:0.7.1' + compile 'network.bisq:bisq-core:-SNAPSHOT' + compile 'network.bisq:bisq-p2p:-SNAPSHOT' + compile 'network.bisq:bisq-common:-SNAPSHOT' compile 'org.controlsfx:controlsfx:8.0.6_20' compile 'org.reactfx:reactfx:2.0-M3' compile 'net.glxn:qrgen:1.3' From 20414bcc2464031c49e42b7885839f3dc25186d2 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 8 Jul 2018 13:42:38 +0200 Subject: [PATCH 8/9] Sync up with changes vrom voting branch - Add onUiReadyHandler to BisqApp and MainView - Add startApplication and onApplicationStarted to BisqAppMain - Improve MenuItem component - Use TxBroadcaster.Callback() instead of FutureCallback() - Apply startup changes to MainViewModel - Apply changes of data storage --- src/main/java/bisq/desktop/app/BisqApp.java | 3 +- .../java/bisq/desktop/app/BisqAppMain.java | 10 +- .../java/bisq/desktop/app/BisqAppModule.java | 2 +- .../bisq/desktop/components/MenuItem.java | 28 ++- .../paymentmethods/MoneyGramForm.java | 4 +- src/main/java/bisq/desktop/main/MainView.java | 5 +- .../java/bisq/desktop/main/MainViewModel.java | 190 +++++++++--------- .../java/bisq/desktop/main/dao/DaoView.java | 2 +- .../main/dao/proposal/ProposalView.java | 17 +- .../main/dao/wallet/send/BsqSendView.java | 11 +- .../main/funds/withdrawal/WithdrawalView.java | 2 +- .../bisq/desktop/main/market/MarketView.java | 7 +- .../main/offer/MutableOfferDataModel.java | 2 - .../desktop/main/offer/MutableOfferView.java | 2 +- .../offer/offerbook/OfferBookViewModel.java | 7 +- .../main/offer/takeoffer/TakeOfferView.java | 2 +- .../windows/ManualPayoutTxWindow.java | 15 +- .../editoffer/EditOfferDataModel.java | 1 - .../portfolio/openoffer/OpenOffersView.java | 6 +- .../pendingtrades/PendingTradesViewModel.java | 2 +- .../steps/buyer/BuyerStep4View.java | 2 +- .../setup/DesktopPersistedDataHost.java | 2 +- src/main/java/bisq/desktop/util/GUIUtil.java | 19 ++ .../desktop/util/validation/BsqValidator.java | 2 +- .../util/validation/BtcAddressValidator.java | 53 ----- 25 files changed, 195 insertions(+), 201 deletions(-) delete mode 100644 src/main/java/bisq/desktop/util/validation/BtcAddressValidator.java diff --git a/src/main/java/bisq/desktop/app/BisqApp.java b/src/main/java/bisq/desktop/app/BisqApp.java index df5d6e79f2..3eca300e7d 100644 --- a/src/main/java/bisq/desktop/app/BisqApp.java +++ b/src/main/java/bisq/desktop/app/BisqApp.java @@ -117,9 +117,10 @@ public class BisqApp extends Application implements UncaughtExceptionHandler { appLaunchedHandler.accept(this); } - public void startApplication() { + public void startApplication(Runnable onUiReadyHandler) { try { MainView mainView = loadMainView(injector); + mainView.setOnUiReadyHandler(onUiReadyHandler); scene = createAndConfigScene(mainView, injector); setupStage(scene); diff --git a/src/main/java/bisq/desktop/app/BisqAppMain.java b/src/main/java/bisq/desktop/app/BisqAppMain.java index 04770ca5a0..348e8f560c 100644 --- a/src/main/java/bisq/desktop/app/BisqAppMain.java +++ b/src/main/java/bisq/desktop/app/BisqAppMain.java @@ -64,6 +64,7 @@ public class BisqAppMain extends BisqExecutable { protected void launchApplication() { BisqApp.setAppLaunchedHandler(application -> { BisqAppMain.this.application = (BisqApp) application; + // Necessary to do the setup at this point to prevent Bouncy Castle errors CommonSetup.setup(BisqAppMain.this.application); // Map to user thread! @@ -110,6 +111,13 @@ public class BisqAppMain extends BisqExecutable { @Override protected void startApplication() { // We need to be in user thread! We mapped at launchApplication already... - application.startApplication(); + + // Once the UI is ready we get onApplicationStarted called and start the setup there + application.startApplication(this::onApplicationStarted); + } + + @Override + protected void onApplicationStarted() { + super.onApplicationStarted(); } } diff --git a/src/main/java/bisq/desktop/app/BisqAppModule.java b/src/main/java/bisq/desktop/app/BisqAppModule.java index 942c49a718..75c389288e 100644 --- a/src/main/java/bisq/desktop/app/BisqAppModule.java +++ b/src/main/java/bisq/desktop/app/BisqAppModule.java @@ -19,7 +19,7 @@ package bisq.desktop.app; import bisq.desktop.DesktopModule; -import bisq.core.app.CoreModule; +import bisq.core.CoreModule; import bisq.common.app.AppModule; diff --git a/src/main/java/bisq/desktop/components/MenuItem.java b/src/main/java/bisq/desktop/components/MenuItem.java index ef860e6e04..7a48cb40a2 100644 --- a/src/main/java/bisq/desktop/components/MenuItem.java +++ b/src/main/java/bisq/desktop/components/MenuItem.java @@ -19,9 +19,6 @@ package bisq.desktop.components; import bisq.desktop.Navigation; import bisq.desktop.common.view.View; -import bisq.desktop.main.MainView; -import bisq.desktop.main.dao.DaoView; -import bisq.desktop.main.dao.proposal.ProposalView; import bisq.desktop.util.Colors; import de.jensd.fx.fontawesome.AwesomeDude; @@ -36,16 +33,28 @@ import javafx.geometry.Pos; import javafx.beans.value.ChangeListener; +import java.util.ArrayList; +import java.util.List; + +import org.jetbrains.annotations.NotNull; + public class MenuItem extends AutoTooltipToggleButton { private final ChangeListener selectedPropertyChangeListener; private final ChangeListener disablePropertyChangeListener; private final Navigation navigation; private final Class viewClass; + private final List> baseNavPath; - public MenuItem(Navigation navigation, ToggleGroup toggleGroup, String title, Class viewClass, AwesomeIcon awesomeIcon) { + public MenuItem(Navigation navigation, + ToggleGroup toggleGroup, + String title, + Class viewClass, + AwesomeIcon awesomeIcon, + List> baseNavPath) { this.navigation = navigation; this.viewClass = viewClass; + this.baseNavPath = baseNavPath; setToggleGroup(toggleGroup); setText(title); @@ -86,11 +95,20 @@ public class MenuItem extends AutoTooltipToggleButton { public void activate() { //noinspection unchecked - setOnAction((event) -> navigation.navigateTo(MainView.class, DaoView.class, ProposalView.class, viewClass)); + setOnAction((event) -> navigation.navigateTo(getNavPathClasses())); selectedProperty().addListener(selectedPropertyChangeListener); disableProperty().addListener(disablePropertyChangeListener); } + + @NotNull + private Class[] getNavPathClasses() { + List> list = new ArrayList<>(baseNavPath); + list.add(viewClass); + Class[] array = new Class[list.size()]; + list.toArray(array); + return array; + } public void deactivate() { setOnAction(null); selectedProperty().removeListener(selectedPropertyChangeListener); diff --git a/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java b/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java index 43ff83121c..f145182084 100644 --- a/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java +++ b/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java @@ -69,8 +69,8 @@ public class MoneyGramForm extends PaymentMethodForm { addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName"), payload.getHolderName()); FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, - Res.getWithCol("payment.bank.country"), - CountryUtil.getNameAndCode(((MoneyGramAccountPayload) paymentAccountPayload).getCountryCode())); + Res.getWithCol("payment.bank.country"), + CountryUtil.getNameAndCode(((MoneyGramAccountPayload) paymentAccountPayload).getCountryCode())); if (BankUtil.isStateRequired(payload.getCountryCode())) addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.state"), payload.getState()); diff --git a/src/main/java/bisq/desktop/main/MainView.java b/src/main/java/bisq/desktop/main/MainView.java index 57323c87c9..d19b76ee3a 100644 --- a/src/main/java/bisq/desktop/main/MainView.java +++ b/src/main/java/bisq/desktop/main/MainView.java @@ -82,6 +82,7 @@ import javafx.geometry.Pos; import javafx.beans.value.ChangeListener; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; import static javafx.scene.layout.AnchorPane.setBottomAnchor; @@ -95,6 +96,8 @@ public class MainView extends InitializableView { // If after 30 sec we have not got connected we show "open network settings" button private final static int SHOW_TOR_SETTINGS_DELAY_SEC = 90; private Label versionLabel; + @Setter + private Runnable onUiReadyHandler; public static StackPane getRootContainer() { return MainView.rootContainer; @@ -309,7 +312,7 @@ public class MainView extends InitializableView { }); // Delay a bit to give time for rendering the splash screen - UserThread.execute(model::start); + UserThread.execute(() -> onUiReadyHandler.run()); } private Tuple2 getBalanceBox(String text) { diff --git a/src/main/java/bisq/desktop/main/MainViewModel.java b/src/main/java/bisq/desktop/main/MainViewModel.java index b042825bba..bb5f03032e 100644 --- a/src/main/java/bisq/desktop/main/MainViewModel.java +++ b/src/main/java/bisq/desktop/main/MainViewModel.java @@ -81,7 +81,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; @Slf4j -public class MainViewModel implements ViewModel { +public class MainViewModel implements ViewModel, BisqSetup.BisqSetupCompleteListener { private final BisqSetup bisqSetup; private final WalletsSetup walletsSetup; private final User user; @@ -169,105 +169,18 @@ public class MainViewModel implements ViewModel { BalanceWithConfirmationTextField.setWalletService(btcWalletService); GUIUtil.setFeeService(feeService); - } - - /////////////////////////////////////////////////////////////////////////////////////////// - // API - /////////////////////////////////////////////////////////////////////////////////////////// - - public void start() { setupHandlers(); - - bisqSetup.start(this::onSetupComplete); + bisqSetup.addBisqSetupCompleteListener(this); } - private void setupHandlers() { - bisqSetup.setDisplayTacHandler(acceptedHandler -> UserThread.runAfter(() -> { - //noinspection FunctionalExpressionCanBeFolded - tacWindow.onAction(acceptedHandler::run).show(); - }, 1)); - bisqSetup.setCryptoSetupFailedHandler(msg -> { - UserThread.execute(() -> new Popup<>().warning(msg) - .useShutDownButton() - .useReportBugButton() - .show()); - }); - bisqSetup.setDisplayTorNetworkSettingsHandler(show -> { - if (show) - torNetworkSettingsWindow.show(); - else - torNetworkSettingsWindow.hide(); - }); - bisqSetup.setSpvFileCorruptedHandler(msg -> { - new Popup<>().warning(msg) - .actionButtonText(Res.get("settings.net.reSyncSPVChainButton")) - .onAction(() -> GUIUtil.reSyncSPVChain(walletsSetup, preferences)) - .show(); - }); + /////////////////////////////////////////////////////////////////////////////////////////// + // BisqSetupCompleteListener + /////////////////////////////////////////////////////////////////////////////////////////// - bisqSetup.setChainFileLockedExceptionHandler(msg -> { - new Popup<>().warning(msg) - .useShutDownButton() - .show(); - }); - bisqSetup.setLockedUpFundsHandler(msg -> new Popup<>().warning(msg).show()); - bisqSetup.setShowFirstPopupIfResyncSPVRequestedHandler(this::showFirstPopupIfResyncSPVRequested); - bisqSetup.setRequestWalletPasswordHandler(aesKeyHandler -> walletPasswordWindow - .onAesKey(aesKeyHandler::accept) - .hideCloseButton() - .show()); - - bisqSetup.setDisplayUpdateHandler((alert, key) -> new DisplayUpdateDownloadWindow(alert) - .actionButtonText(Res.get("displayUpdateDownloadWindow.button.downloadLater")) - .onAction(() -> { - preferences.dontShowAgain(key, false); // update later - }) - .closeButtonText(Res.get("shared.cancel")) - .onClose(() -> { - preferences.dontShowAgain(key, true); // ignore update - }) - .show()); - bisqSetup.setDisplayAlertHandler(alert -> new DisplayAlertMessageWindow() - .alertMessage(alert) - .onClose(() -> { - user.setDisplayedAlert(alert); - }) - .show()); - bisqSetup.setDisplayPrivateNotificationHandler(privateNotification -> - new Popup<>().headLine(Res.get("popup.privateNotification.headline")) - .attention(privateNotification.getMessage()) - .setHeadlineStyle("-fx-text-fill: -bs-error-red; -fx-font-weight: bold; -fx-font-size: 16;") - .onClose(privateNotificationManager::removePrivateNotification) - .useIUnderstandButton() - .show()); - bisqSetup.setDaoSetupErrorHandler(errorMessage -> new Popup<>().error(errorMessage).show()); - bisqSetup.setDisplaySecurityRecommendationHandler(key -> - new Popup<>().headLine(Res.get("popup.securityRecommendation.headline")) - .information(Res.get("popup.securityRecommendation.msg")) - .dontShowAgainId(key) - .show()); - bisqSetup.setDisplayLocalhostHandler(key -> - new Popup<>().backgroundInfo(Res.get("popup.bitcoinLocalhostNode.msg")) - .dontShowAgainId(key) - .show()); - bisqSetup.setWrongOSArchitectureHandler(msg -> new Popup<>().warning(msg).show()); - - corruptedDatabaseFilesHandler.getCorruptedDatabaseFiles().ifPresent(files -> { - new Popup<>() - .warning(Res.get("popup.warning.incompatibleDB", files.toString(), - bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY))) - .useShutDownButton() - .show(); - }); - - tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> new Popup<>() - .warning(Res.get("popup.error.takeOfferRequestFailed", errorMessage)) - .show()); - } - - private void onSetupComplete() { + @Override + public void onSetupComplete() { // We handle the trade period here as we display a global popup if we reached dispute time tradesAndUIReady = EasyBind.combine(isSplashScreenRemoved, tradeManager.pendingTradesInitializedProperty(), (a, b) -> a && b); tradesAndUIReady.subscribe((observable, oldValue, newValue) -> { @@ -345,6 +258,95 @@ public class MainViewModel implements ViewModel { // Private /////////////////////////////////////////////////////////////////////////////////////////// + private void setupHandlers() { + bisqSetup.setDisplayTacHandler(acceptedHandler -> UserThread.runAfter(() -> { + //noinspection FunctionalExpressionCanBeFolded + tacWindow.onAction(acceptedHandler::run).show(); + }, 1)); + + bisqSetup.setCryptoSetupFailedHandler(msg -> { + UserThread.execute(() -> new Popup<>().warning(msg) + .useShutDownButton() + .useReportBugButton() + .show()); + }); + bisqSetup.setDisplayTorNetworkSettingsHandler(show -> { + if (show) + torNetworkSettingsWindow.show(); + else + torNetworkSettingsWindow.hide(); + }); + bisqSetup.setSpvFileCorruptedHandler(msg -> { + new Popup<>().warning(msg) + .actionButtonText(Res.get("settings.net.reSyncSPVChainButton")) + .onAction(() -> GUIUtil.reSyncSPVChain(walletsSetup, preferences)) + .show(); + }); + + bisqSetup.setChainFileLockedExceptionHandler(msg -> { + new Popup<>().warning(msg) + .useShutDownButton() + .show(); + }); + bisqSetup.setLockedUpFundsHandler(msg -> new Popup<>().warning(msg).show()); + bisqSetup.setShowFirstPopupIfResyncSPVRequestedHandler(this::showFirstPopupIfResyncSPVRequested); + bisqSetup.setRequestWalletPasswordHandler(aesKeyHandler -> walletPasswordWindow + .onAesKey(aesKeyHandler::accept) + .hideCloseButton() + .show()); + + bisqSetup.setDisplayUpdateHandler((alert, key) -> new DisplayUpdateDownloadWindow(alert) + .actionButtonText(Res.get("displayUpdateDownloadWindow.button.downloadLater")) + .onAction(() -> { + preferences.dontShowAgain(key, false); // update later + }) + .closeButtonText(Res.get("shared.cancel")) + .onClose(() -> { + preferences.dontShowAgain(key, true); // ignore update + }) + .show()); + bisqSetup.setDisplayAlertHandler(alert -> new DisplayAlertMessageWindow() + .alertMessage(alert) + .onClose(() -> { + user.setDisplayedAlert(alert); + }) + .show()); + bisqSetup.setDisplayPrivateNotificationHandler(privateNotification -> + new Popup<>().headLine(Res.get("popup.privateNotification.headline")) + .attention(privateNotification.getMessage()) + .setHeadlineStyle("-fx-text-fill: -bs-error-red; -fx-font-weight: bold; -fx-font-size: 16;") + .onClose(privateNotificationManager::removePrivateNotification) + .useIUnderstandButton() + .show()); + bisqSetup.setDaoSetupErrorHandler(errorMessage -> new Popup<>().error(errorMessage).show()); + bisqSetup.setDisplaySecurityRecommendationHandler(key -> + new Popup<>().headLine(Res.get("popup.securityRecommendation.headline")) + .information(Res.get("popup.securityRecommendation.msg")) + .dontShowAgainId(key) + .show()); + bisqSetup.setDisplayLocalhostHandler(key -> { + if (!DevEnv.isDevMode()) { + new Popup<>().backgroundInfo(Res.get("popup.bitcoinLocalhostNode.msg")) + .dontShowAgainId(key) + .show(); + } + }); + + bisqSetup.setWrongOSArchitectureHandler(msg -> new Popup<>().warning(msg).show()); + + corruptedDatabaseFilesHandler.getCorruptedDatabaseFiles().ifPresent(files -> { + new Popup<>() + .warning(Res.get("popup.warning.incompatibleDB", files.toString(), + bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY))) + .useShutDownButton() + .show(); + }); + + tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> new Popup<>() + .warning(Res.get("popup.error.takeOfferRequestFailed", errorMessage)) + .show()); + } + private void setupP2PNumPeersWatcher() { p2PService.getNumConnectedPeers().addListener((observable, oldValue, newValue) -> { int numPeers = (int) newValue; diff --git a/src/main/java/bisq/desktop/main/dao/DaoView.java b/src/main/java/bisq/desktop/main/dao/DaoView.java index ab8ae989b6..e86494d8c7 100644 --- a/src/main/java/bisq/desktop/main/dao/DaoView.java +++ b/src/main/java/bisq/desktop/main/dao/DaoView.java @@ -73,7 +73,7 @@ public class DaoView extends ActivatableViewAndModel { votingTab.setClosable(false); root.getTabs().addAll(compensationTab, votingTab); - if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq() || !DevEnv.DAO_PHASE2_ACTIVATED) { + if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq() || !DevEnv.isDaoPhase2Activated()) { votingTab.setDisable(true); compensationTab.setDisable(true); } diff --git a/src/main/java/bisq/desktop/main/dao/proposal/ProposalView.java b/src/main/java/bisq/desktop/main/dao/proposal/ProposalView.java index ffd087f007..9c3a4a67a7 100644 --- a/src/main/java/bisq/desktop/main/dao/proposal/ProposalView.java +++ b/src/main/java/bisq/desktop/main/dao/proposal/ProposalView.java @@ -25,6 +25,7 @@ import bisq.desktop.common.view.View; import bisq.desktop.common.view.ViewLoader; import bisq.desktop.common.view.ViewPath; import bisq.desktop.components.MenuItem; +import bisq.desktop.main.MainView; import bisq.desktop.main.dao.DaoView; import bisq.desktop.main.dao.proposal.active.ActiveProposalsView; import bisq.desktop.main.dao.proposal.closed.ClosedProposalsView; @@ -45,6 +46,9 @@ import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; +import java.util.Arrays; +import java.util.List; + @FxmlView public class ProposalView extends ActivatableViewAndModel { @@ -78,18 +82,19 @@ public class ProposalView extends ActivatableViewAndModel { }; ToggleGroup toggleGroup = new ToggleGroup(); + final List> baseNavPath = Arrays.asList(MainView.class, DaoView.class, ProposalView.class); dashboard = new MenuItem(navigation, toggleGroup, Res.get("shared.dashboard"), - ProposalDashboardView.class, AwesomeIcon.DASHBOARD); + ProposalDashboardView.class, AwesomeIcon.DASHBOARD, baseNavPath); make = new MenuItem(navigation, toggleGroup, Res.get("dao.proposal.menuItem.make"), - MakeProposalView.class, AwesomeIcon.EDIT); + MakeProposalView.class, AwesomeIcon.EDIT, baseNavPath); active = new MenuItem(navigation, toggleGroup, Res.get("dao.proposal.menuItem.active"), - ActiveProposalsView.class, AwesomeIcon.LIST_UL); + ActiveProposalsView.class, AwesomeIcon.LIST_UL, baseNavPath); myVotes = new MenuItem(navigation, toggleGroup, Res.get("dao.proposal.menuItem.myVotes"), - MyVotesView.class, AwesomeIcon.THUMBS_UP); + MyVotesView.class, AwesomeIcon.THUMBS_UP, baseNavPath); votes = new MenuItem(navigation, toggleGroup, Res.get("dao.proposal.menuItem.votes"), - VotesView.class, AwesomeIcon.THUMBS_UP_ALT); + VotesView.class, AwesomeIcon.THUMBS_UP_ALT, baseNavPath); closed = new MenuItem(navigation, toggleGroup, Res.get("dao.proposal.menuItem.closed"), - ClosedProposalsView.class, AwesomeIcon.LIST_ALT); + ClosedProposalsView.class, AwesomeIcon.LIST_ALT, baseNavPath); leftVBox.getChildren().addAll(dashboard, make, active, myVotes, votes, closed); } diff --git a/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java b/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java index 202fb17736..a20e52e380 100644 --- a/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java +++ b/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java @@ -50,17 +50,11 @@ import org.bitcoinj.core.Transaction; import javax.inject.Inject; -import com.google.common.util.concurrent.FutureCallback; - import javafx.scene.control.Button; import javafx.scene.layout.GridPane; import javafx.beans.value.ChangeListener; -import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nullable; - import static bisq.desktop.util.FormBuilder.addButtonAfterGroup; import static bisq.desktop.util.FormBuilder.addLabelInputTextField; import static bisq.desktop.util.FormBuilder.addTitledGroupBg; @@ -159,7 +153,8 @@ public class BsqSendView extends ActivatableView implements BsqB bsqFormatter.formatCoinWithCode(receiverAmount))) .actionButtonText(Res.get("shared.yes")) .onAction(() -> { - walletsManager.publishAndCommitBsqTx(txWithBtcFee, new FutureCallback() { + // TODO not updated to TxBroadcaster changes because not in sync with voting branch anyway + /* walletsManager.publishAndCommitBsqTx(txWithBtcFee, new FutureCallback() { @Override public void onSuccess(@Nullable Transaction transaction) { if (transaction != null) { @@ -172,7 +167,7 @@ public class BsqSendView extends ActivatableView implements BsqB log.error(t.toString()); new Popup<>().warning(t.toString()); } - }); + });*/ receiversAddressInputTextField.setText(""); amountInputTextField.setText(""); diff --git a/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java b/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java index 8b0d9b48ac..441879124a 100644 --- a/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java +++ b/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java @@ -25,7 +25,6 @@ import bisq.desktop.components.HyperlinkWithIcon; import bisq.desktop.main.overlays.popups.Popup; import bisq.desktop.main.overlays.windows.WalletPasswordWindow; import bisq.desktop.util.GUIUtil; -import bisq.desktop.util.validation.BtcAddressValidator; import bisq.core.btc.AddressEntry; import bisq.core.btc.AddressEntryException; @@ -43,6 +42,7 @@ import bisq.core.trade.failed.FailedTradesManager; import bisq.core.user.Preferences; import bisq.core.util.BSFormatter; import bisq.core.util.CoinUtil; +import bisq.core.util.validation.BtcAddressValidator; import bisq.network.p2p.P2PService; diff --git a/src/main/java/bisq/desktop/main/market/MarketView.java b/src/main/java/bisq/desktop/main/market/MarketView.java index 68b1cccd25..9009f194e7 100644 --- a/src/main/java/bisq/desktop/main/market/MarketView.java +++ b/src/main/java/bisq/desktop/main/market/MarketView.java @@ -29,6 +29,7 @@ import bisq.desktop.main.market.offerbook.OfferBookChartView; import bisq.desktop.main.market.spread.SpreadView; import bisq.desktop.main.market.trades.TradesChartsView; import bisq.desktop.main.offer.offerbook.OfferBook; +import bisq.desktop.main.offer.offerbook.OfferBookListItem; import bisq.desktop.main.overlays.popups.Popup; import bisq.core.locale.Res; @@ -179,8 +180,8 @@ public class MarketView extends ActivatableViewAndModel { // We don't use the list from the tradeStatisticsManager as that has filtered the duplicates but we want to get // all items of both traders in case the referral ID was only set by one trader. // If both traders had set it the tradeStatistics is only delivered once. - // If both traders used a differnet refferral ID then we would get 2 objects. - List list = p2PService.getP2PDataStorage().getPersistableNetworkPayloadList().getMap().values().stream() + // If both traders used a different referral ID then we would get 2 objects. + List list = p2PService.getP2PDataStorage().getAppendOnlyDataStoreMap().values().stream() .filter(e -> e instanceof TradeStatistics2) .map(e -> (TradeStatistics2) e) .filter(tradeStatistics2 -> tradeStatistics2.getExtraDataMap() != null) @@ -203,7 +204,7 @@ public class MarketView extends ActivatableViewAndModel { private String getAllOffersWithReferralId() { List list = offerBook.getOfferBookListItems().stream() - .map(offerBookListItem -> offerBookListItem.getOffer()) + .map(OfferBookListItem::getOffer) .filter(offer -> offer.getOfferPayload().getExtraDataMap() != null) .filter(offer -> offer.getOfferPayload().getExtraDataMap().get(OfferPayload.REFERRAL_ID) != null) .map(offer -> { diff --git a/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java b/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java index 3d7e5600e6..22c7e8760e 100644 --- a/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java +++ b/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java @@ -90,8 +90,6 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; -import javax.annotation.Nullable; - import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index 0653b59a31..a5990ad505 100644 --- a/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -958,7 +958,7 @@ public abstract class MutableOfferView extends GridPane.setMargin(nextButton, new Insets(-35, 0, 0, 0)); nextButton.setOnAction(e -> { if (model.isPriceInRange()) { - if (DevEnv.DAO_TRADING_ACTIVATED) + if (DevEnv.isDaoTradingActivated()) showFeeOption(); else onShowPayFundsScreen(); diff --git a/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java b/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java index 43c15cc09f..4aa7f1bdeb 100644 --- a/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java +++ b/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java @@ -534,7 +534,8 @@ class OfferBookViewModel extends ActivatableViewModel { } boolean isIgnored(Offer offer) { - return preferences.getIgnoreTradersList().stream().anyMatch(i -> i.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix())); + return preferences.getIgnoreTradersList().stream() + .anyMatch(i -> i.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix())); } boolean isOfferBanned(Offer offer) { @@ -555,7 +556,9 @@ class OfferBookViewModel extends ActivatableViewModel { boolean isInsufficientTradeLimit(Offer offer) { Optional accountOptional = getMostMaturePaymentAccountForOffer(offer); - final long myTradeLimit = accountOptional.map(paymentAccount -> accountAgeWitnessService.getMyTradeLimit(paymentAccount, offer.getCurrencyCode())).orElse(0L); + final long myTradeLimit = accountOptional + .map(paymentAccount -> accountAgeWitnessService.getMyTradeLimit(paymentAccount, offer.getCurrencyCode())) + .orElse(0L); final long offerMinAmount = offer.getMinAmount().value; log.debug("isInsufficientTradeLimit accountOptional={}, myTradeLimit={}, offerMinAmount={}, ", accountOptional.isPresent() ? accountOptional.get().getAccountName() : "null", diff --git a/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java b/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java index bb52129735..7cc385b73f 100644 --- a/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java @@ -763,7 +763,7 @@ public class TakeOfferView extends ActivatableViewAndModel { actionButtonText("Sign and publish transaction"); - FutureCallback callback = new FutureCallback() { + TxBroadcaster.Callback callback = new TxBroadcaster.Callback() { @Override public void onSuccess(@Nullable Transaction result) { log.error("onSuccess"); @@ -167,10 +165,9 @@ public class ManualPayoutTxWindow extends Overlay { } @Override - public void onFailure(@NotNull Throwable t) { - log.error(t.toString()); - log.error("onFailure"); - UserThread.execute(() -> new Popup<>().warning(t.toString()).show()); + public void onFailure(TxBroadcastException exception) { + log.error(exception.toString()); + UserThread.execute(() -> new Popup<>().warning(exception.toString()).show()); } }; onAction(() -> { diff --git a/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java index 56b85f6fec..49b58a629f 100644 --- a/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -45,7 +45,6 @@ import bisq.network.p2p.P2PService; import bisq.common.crypto.KeyRing; import bisq.common.handlers.ErrorMessageHandler; import bisq.common.handlers.ResultHandler; -import bisq.common.proto.persistable.PersistenceProtoResolver; import com.google.inject.Inject; diff --git a/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java b/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java index 49ccbcb266..ef002c9565 100644 --- a/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java +++ b/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java @@ -38,6 +38,8 @@ import bisq.core.user.DontShowAgainLookup; import javax.inject.Inject; +import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; + import javafx.fxml.FXML; import javafx.scene.control.Button; @@ -59,10 +61,6 @@ import org.jetbrains.annotations.NotNull; import static bisq.desktop.util.FormBuilder.getIconButton; - - -import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; - @FxmlView public class OpenOffersView extends ActivatableViewAndModel { diff --git a/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index 2e6f9dbc80..b75ceeb2fb 100644 --- a/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -20,7 +20,6 @@ package bisq.desktop.main.portfolio.pendingtrades; import bisq.desktop.common.model.ActivatableWithDataModel; import bisq.desktop.common.model.ViewModel; import bisq.desktop.util.GUIUtil; -import bisq.desktop.util.validation.BtcAddressValidator; import bisq.core.locale.Res; import bisq.core.network.MessageState; @@ -32,6 +31,7 @@ import bisq.core.trade.Trade; import bisq.core.trade.closed.ClosedTradableManager; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.validation.BtcAddressValidator; import bisq.network.p2p.P2PService; diff --git a/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java b/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java index ffe8f672fc..713a4f9767 100644 --- a/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java +++ b/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java @@ -31,7 +31,6 @@ import bisq.desktop.main.portfolio.pendingtrades.PendingTradesViewModel; import bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.Layout; -import bisq.desktop.util.validation.BtcAddressValidator; import bisq.core.btc.AddressEntry; import bisq.core.btc.AddressEntryException; @@ -42,6 +41,7 @@ import bisq.core.locale.Res; import bisq.core.user.DontShowAgainLookup; import bisq.core.util.BSFormatter; import bisq.core.util.CoinUtil; +import bisq.core.util.validation.BtcAddressValidator; import bisq.common.UserThread; import bisq.common.app.DevEnv; diff --git a/src/main/java/bisq/desktop/setup/DesktopPersistedDataHost.java b/src/main/java/bisq/desktop/setup/DesktopPersistedDataHost.java index 190faf7403..2e2c0d823f 100644 --- a/src/main/java/bisq/desktop/setup/DesktopPersistedDataHost.java +++ b/src/main/java/bisq/desktop/setup/DesktopPersistedDataHost.java @@ -30,7 +30,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class DesktopPersistedDataHost { - + // All classes which are persisting objects need to be added here public static List getPersistedDataHosts(Injector injector) { List persistedDataHosts = new ArrayList<>(); diff --git a/src/main/java/bisq/desktop/util/GUIUtil.java b/src/main/java/bisq/desktop/util/GUIUtil.java index d05924a643..a040730c63 100644 --- a/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/src/main/java/bisq/desktop/util/GUIUtil.java @@ -34,6 +34,8 @@ import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.user.User; import bisq.core.util.BSFormatter; +import bisq.core.util.BsqFormatter; +import bisq.core.util.CoinUtil; import bisq.network.p2p.P2PService; @@ -543,4 +545,21 @@ public class GUIUtil { childByRowMap.get(i).forEach(child -> gridPane.getChildren().remove(child)); } } + + public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txSize, BsqFormatter bsqFormatter, + BSFormatter btcFormatter, String type, + Runnable actionHandler) { + new Popup<>().headLine(Res.get("dao.feeTx.confirm", type)) + .confirmation(Res.get("dao.feeTx.confirm.details", + type, + bsqFormatter.formatCoinWithCode(fee), + btcFormatter.formatCoinWithCode(miningFee), + CoinUtil.getFeePerByte(miningFee, txSize), + txSize / 1000d, + type)) + .actionButtonText(Res.get("shared.yes")) + .onAction(actionHandler::run) + .closeButtonText(Res.get("shared.cancel")) + .show(); + } } diff --git a/src/main/java/bisq/desktop/util/validation/BsqValidator.java b/src/main/java/bisq/desktop/util/validation/BsqValidator.java index b9c4c0ade0..0bca05d284 100644 --- a/src/main/java/bisq/desktop/util/validation/BsqValidator.java +++ b/src/main/java/bisq/desktop/util/validation/BsqValidator.java @@ -42,7 +42,7 @@ public class BsqValidator extends AltcoinValidator { private Coin maxValue; @Nullable private Coin availableBalance; - private Coin minValue = Coin.valueOf(2730); // dust + private Coin minValue = Coin.valueOf(546); // dust @Override protected double getMinValue() { diff --git a/src/main/java/bisq/desktop/util/validation/BtcAddressValidator.java b/src/main/java/bisq/desktop/util/validation/BtcAddressValidator.java deleted file mode 100644 index d08d77636b..0000000000 --- a/src/main/java/bisq/desktop/util/validation/BtcAddressValidator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of Bisq. - * - * Bisq is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bisq is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bisq. If not, see . - */ - -package bisq.desktop.util.validation; - -import bisq.core.app.BisqEnvironment; -import bisq.core.locale.Res; -import bisq.core.util.validation.InputValidator; - -import org.bitcoinj.core.Address; -import org.bitcoinj.core.AddressFormatException; - -import javax.inject.Inject; - -public final class BtcAddressValidator extends InputValidator { - - @Inject - public BtcAddressValidator() { - } - - @Override - public ValidationResult validate(String input) { - - ValidationResult result = validateIfNotEmpty(input); - if (result.isValid) - return validateBtcAddress(input); - else - return result; - } - - private ValidationResult validateBtcAddress(String input) { - try { - Address.fromBase58(BisqEnvironment.getParameters(), input); - return new ValidationResult(true); - } catch (AddressFormatException e) { - return new ValidationResult(false, Res.get("validation.btc.invalidFormat")); - } - } -} From eef0c74487cdbd645913026367dc6e344b6f4ff7 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Tue, 10 Jul 2018 13:13:38 +0200 Subject: [PATCH 9/9] Reflect new repository structure --- README.md | 2 +- .../java/bisq/desktop/main/offer/offerbook/OfferBookView.java | 2 +- src/main/java/bisq/desktop/main/overlays/Overlay.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 81ae481ce7..1f59c24aeb 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Staying in Touch Contact the team and keep up to date using any of the following: - The [Bisq website](https://bisq.network) - - GitHub [Issues](https://github.com/bisq-network/exchange/issues) + - GitHub [Issues](https://github.com/bisq-network/bisq-desktop/issues) - The [Bisq forum]( https://bisq.community) - The [#bisq](https://webchat.freenode.net/?channels=bisq) IRC channel on Freenode - Our [contributor mailing list](https://lists.bisq.network/listinfo/bisq-contrib) diff --git a/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java b/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java index 2a34821d03..d6800db42d 100644 --- a/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java +++ b/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java @@ -255,7 +255,7 @@ public class OfferBookView extends ActivatableViewAndModel nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size())); // Fixes incorrect ordering of Available offers: - // https://github.com/bisq-network/exchange/issues/588 + // https://github.com/bisq-network/bisq-desktop/issues/588 priceFeedUpdateCounterListener = (observable, oldValue, newValue) -> tableView.sort(); } diff --git a/src/main/java/bisq/desktop/main/overlays/Overlay.java b/src/main/java/bisq/desktop/main/overlays/Overlay.java index 67b63308e1..1b7fcd35f6 100644 --- a/src/main/java/bisq/desktop/main/overlays/Overlay.java +++ b/src/main/java/bisq/desktop/main/overlays/Overlay.java @@ -360,7 +360,7 @@ public abstract class Overlay { public T useReportBugButton() { this.closeButtonText = Res.get("shared.reportBug"); - this.closeHandlerOptional = Optional.of(() -> GUIUtil.openWebPage("https://github.com/bisq-network/exchange/issues")); + this.closeHandlerOptional = Optional.of(() -> GUIUtil.openWebPage("https://github.com/bisq-network/bisq-desktop/issues")); //noinspection unchecked return (T) this; } @@ -779,7 +779,7 @@ public abstract class Overlay { gitHubButton.setOnAction(event -> { if (message != null) Utilities.copyToClipboard(message); - GUIUtil.openWebPage("https://github.com/bisq-network/exchange/issues"); + GUIUtil.openWebPage("https://github.com/bisq-network/bisq-desktop/issues"); hide(); }); }