Skip to content

Commit

Permalink
Merge remote-tracking branch 'ItoroD/Add-custom-errorLabel-to-Materia…
Browse files Browse the repository at this point in the history
…lTextField-and-not-reuse-helpLabel-as-it-would-cause-an-exception-when-binding-at-the-helpLabel-is-used-#1783' into Add-custom-errorLabel-to-MaterialTextField-and-not-reuse-helpLabel-as-it-would-cause-an-exception-when-binding-at-the-helpLabel-is-used-bisq-network#1783

# Conflicts:
#	apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/MaterialTextField.java
  • Loading branch information
HenrikJannsen committed Apr 4, 2024
2 parents 9a3a3d6 + e519935 commit 79f4754
Show file tree
Hide file tree
Showing 201 changed files with 4,583 additions and 2,378 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import bisq.bonded_roles.release.ReleaseNotification;
import bisq.bonded_roles.security_manager.alert.AuthorizedAlertData;
import bisq.bonded_roles.security_manager.difficulty_adjustment.AuthorizedDifficultyAdjustmentData;
import bisq.bonded_roles.security_manager.min_reputation_score.AuthorizedMinRequiredReputationScoreData;
import bisq.chat.ChatMessage;
import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookMessage;
import bisq.chat.bisqeasy.open_trades.BisqEasyOpenTradeMessage;
Expand Down Expand Up @@ -57,6 +58,7 @@ public static void config() {
DistributedDataResolver.addResolver("bonded_roles.AuthorizedBondedRole", AuthorizedBondedRole.getResolver());
DistributedDataResolver.addResolver("bonded_roles.AuthorizedAlertData", AuthorizedAlertData.getResolver());
DistributedDataResolver.addResolver("bonded_roles.AuthorizedDifficultyAdjustmentData", AuthorizedDifficultyAdjustmentData.getResolver());
DistributedDataResolver.addResolver("bonded_roles.AuthorizedMinRequiredReputationScoreData", AuthorizedMinRequiredReputationScoreData.getResolver());
DistributedDataResolver.addResolver("bonded_roles.ReleaseNotification", ReleaseNotification.getResolver());
DistributedDataResolver.addResolver("bonded_roles.AuthorizedMarketPriceData", AuthorizedMarketPriceData.getResolver());
DistributedDataResolver.addResolver("user.AuthorizedProofOfBurnData", AuthorizedProofOfBurnData.getResolver());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
*/
@Slf4j
public class DesktopAppLauncher {
private static final String VERSION = "2.0.1";
private static final String VERSION = "2.0.2";
private static final String APP_NAME = "Bisq2";
private static final String FINGER_PRINT_ALEJANDRO_GARCIA = "E222AA02"; // B493 3191 06CC 3D1F 252E 19CB F806 F422 E222 AA02
private static final String FINGER_PRINT_HENRIK_JANNSEN = "387C8307"; // B8A5 D214 ADFA A387 A14C 8BCF 02AA 2BAE 387C 8307
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/desktop-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ application {
mainClass.set("bisq.desktop_app.DesktopApp")
}

version = "2.0.1"
version = "2.0.2"

javafx {
version = "17.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import bisq.application.ShutDownHandler;
import bisq.bisq_easy.BisqEasyService;
import bisq.bonded_roles.BondedRolesService;
import bisq.bonded_roles.security_manager.alert.AlertNotificationsService;
import bisq.chat.ChatService;
import bisq.common.application.Service;
import bisq.common.observable.Observable;
Expand Down Expand Up @@ -92,6 +93,7 @@ public class DesktopApplicationService extends ApplicationService {
private final TradeService tradeService;
private final UpdaterService updaterService;
private final BisqEasyService bisqEasyService;
private final AlertNotificationsService alertNotificationsService;

public DesktopApplicationService(String[] args, ShutDownHandler shutDownHandler) {
super("desktop", args);
Expand Down Expand Up @@ -179,6 +181,8 @@ public DesktopApplicationService(String[] args, ShutDownHandler shutDownHandler)
sendNotificationService,
tradeService);

alertNotificationsService = new AlertNotificationsService(settingsService, bondedRolesService.getAlertService());

// TODO (refactor, low prio): Not sure if ServiceProvider is still needed as we added BisqEasyService which exposes most of the services.
serviceProvider = new ServiceProvider(shutDownHandler,
getConfig(),
Expand All @@ -198,7 +202,8 @@ public DesktopApplicationService(String[] args, ShutDownHandler shutDownHandler)
sendNotificationService,
tradeService,
updaterService,
bisqEasyService);
bisqEasyService,
alertNotificationsService);
}

@Override
Expand Down Expand Up @@ -238,11 +243,12 @@ public CompletableFuture<Boolean> initialize() {
.thenCompose(result -> settingsService.initialize())
.thenCompose(result -> offerService.initialize())
.thenCompose(result -> chatService.initialize())
.thenCompose(result -> sendNotificationService.initialize()) // We initialize after chatService to avoid flooding the notification center
.thenCompose(result -> sendNotificationService.initialize())
.thenCompose(result -> supportService.initialize())
.thenCompose(result -> tradeService.initialize())
.thenCompose(result -> updaterService.initialize())
.thenCompose(result -> bisqEasyService.initialize())
.thenCompose(result -> alertNotificationsService.initialize())
.orTimeout(STARTUP_TIMEOUT_SEC, TimeUnit.SECONDS)
.handle((result, throwable) -> {
if (throwable == null) {
Expand Down Expand Up @@ -274,6 +280,7 @@ public CompletableFuture<Boolean> shutdown() {
.thenCompose(result -> sendNotificationService.shutdown())
.thenCompose(result -> chatService.shutdown())
.thenCompose(result -> offerService.shutdown())
.thenCompose(result -> alertNotificationsService.shutdown())
.thenCompose(result -> settingsService.shutdown())
.thenCompose(result -> userService.shutdown())
.thenCompose(result -> contractService.shutdown())
Expand Down
11 changes: 9 additions & 2 deletions apps/desktop/desktop-app/src/main/resources/desktop.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
application {
appName = "Bisq2"
version = "2.0.1"
version = "2.0.2"
devMode = false
keyIds = "E222AA02,387C8307"
ignoreSigningKeyInResourcesCheck = false
Expand Down Expand Up @@ -33,6 +33,11 @@ application {
// Production node, bonded role
url = "http://runbtcpn7gmbj5rgqeyfyvepqokrijem6rbw7o5wgqbguimuoxrmcdyd.onion/"
operator = "runbtc",
},
{
// Production node, bonded role
url = "http://pn4o3iocd6wck4wrpj3j53hsknn5q4pqjmoircj4jzggmfuiszonxuid.onion/"
operator = "403State",
}
]
}
Expand Down Expand Up @@ -94,6 +99,7 @@ application {

peerGroup {
minNumConnectedPeers=8
minNumOutboundConnectedPeers=3
maxNumConnectedPeers=12
minNumReportedPeers=1
}
Expand All @@ -117,7 +123,8 @@ application {
]
"tor" : [
"hj2kj43oyq4mhd5gx4vokalnci3vlbwzclv7usocfwuj5f5iks3eivqd.onion:1000",
"plur5t7zhcf45bltdhtb4o43p726dqhibc6xo2lhjfxctjcoinlclaid.onion:1000"
"plur5t7zhcf45bltdhtb4o43p726dqhibc6xo2lhjfxctjcoinlclaid.onion:1000",
"b5jjgzuekdu7ys7yg2q6e27hybtufxfvdsxxvle7xpvqifyagdag5fid.onion:1000"
]
"i2p" : [
"kglZCQYj~nyK3YlXCD5FjxOY2ggH8yosII0rqc7oqFhFfjKWy-89WYw-~mtTUqzCaN6LGd17XzheKG44XJnKrM-WvP732V8lbJcoMBIKeeHPlcfwpsTNbMJyWeXIlJByYNlw1HPVRMpBtzfJ9IznyQdwQWDkzA72pLreqpzJrgIoVYzP9OTXVLdROXnTP9RdmnzZ0h1B8XhQM-8LjHB7cE9o9VT9IXIFScICM8VZ8I1sp02rn26McTM~~XO5Zs1Df3IMV0eqteAe6TvH~Rc-6Hh3YhPrjEcv-YvV6RUlsoj605mmSO0Sj5oeacH3Cec73BlNJEGfQkmbTrXVNLqt2S4smqmkAhMq~sdCJCRKP8CFeBk6r-qVREucTeW3AmwXuGS~-8s7pAm99SlpTSepp75a2WNTIsWw~rWiHlM6faTJrkjcO5wJM7~G0tdYgVGk4zrt4VJ02AakUdh8wG1Y5sAX-daTUum~0YTk-fIAVBJSEiNc93XgZkwuTcc4J2BqAAAA:5000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop;

import bisq.bisq_easy.NavigationTarget;
import bisq.chat.notifications.ChatNotificationService;
import bisq.common.observable.Observable;
import bisq.desktop.common.Browser;
import bisq.desktop.common.Transitions;
Expand All @@ -44,6 +45,7 @@
import javafx.stage.Screen;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.fxmisc.easybind.EasyBind;

import java.util.Optional;

Expand All @@ -67,6 +69,7 @@ public class DesktopController extends NavigationController {
protected final Runnable onActivatedHandler;
private SplashController splashController;
private final UserIdentityService userIdentityService;
private final ChatNotificationService chatNotificationService;
private final ServiceProvider serviceProvider;
private PreventStandbyModeService preventStandbyModeService;

Expand All @@ -85,6 +88,7 @@ public DesktopController(Observable<State> applicationServiceState,

settingsService = serviceProvider.getSettingsService();
userIdentityService = serviceProvider.getUserService().getUserIdentityService();
chatNotificationService = serviceProvider.getChatService().getChatNotificationService();
}

public void init() {
Expand All @@ -107,6 +111,8 @@ public void init() {
view.showStage();

new OverlayController(serviceProvider, viewRoot);

EasyBind.subscribe(viewRoot.getScene().getWindow().focusedProperty(), chatNotificationService::setApplicationFocussed);
}

private void setInitialScreenSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import bisq.application.ShutDownHandler;
import bisq.bisq_easy.BisqEasyService;
import bisq.bonded_roles.BondedRolesService;
import bisq.bonded_roles.security_manager.alert.AlertNotificationsService;
import bisq.chat.ChatService;
import bisq.contract.ContractService;
import bisq.identity.IdentityService;
Expand Down Expand Up @@ -67,6 +68,7 @@ public class ServiceProvider {
private final TradeService tradeService;
private final UpdaterService updaterService;
private final BisqEasyService bisqEasyService;
private final AlertNotificationsService alertNotificationsService;

public ServiceProvider(ShutDownHandler shutDownHandler,
ApplicationService.Config config,
Expand All @@ -86,7 +88,8 @@ public ServiceProvider(ShutDownHandler shutDownHandler,
SendNotificationService sendNotificationService,
TradeService tradeService,
UpdaterService updaterService,
BisqEasyService bisqEasyService) {
BisqEasyService bisqEasyService,
AlertNotificationsService alertNotificationsService) {
this.shutDownHandler = shutDownHandler;
this.config = config;
this.persistenceService = persistenceService;
Expand All @@ -106,5 +109,6 @@ public ServiceProvider(ShutDownHandler shutDownHandler,
this.tradeService = tradeService;
this.updaterService = updaterService;
this.bisqEasyService = bisqEasyService;
this.alertNotificationsService = alertNotificationsService;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop.common;

import bisq.common.util.OsUtils;
import bisq.desktop.common.threading.UIScheduler;
import bisq.desktop.common.utils.ClipboardUtil;
import bisq.desktop.components.overlay.Popup;
import bisq.i18n.Res;
Expand All @@ -33,6 +34,8 @@

@Slf4j
public class Browser {
public static final String HYPERLINKS_OPEN_IN_BROWSER = "hyperlinks.openInBrowser";

@Nullable
private static HostServices hostServices;
private static SettingsService settingsService;
Expand All @@ -43,9 +46,10 @@ public static void initialize(HostServices hostServices, SettingsService setting
}

public static void open(String url) {
String id = "hyperlinks.openInBrowser";
String id = HYPERLINKS_OPEN_IN_BROWSER;
if (DontShowAgainService.showAgain(id)) {
new Popup().feedback(Res.get("hyperlinks.openInBrowser.attention", url))
new Popup().headline(Res.get("hyperlinks.openInBrowser.attention.headline"))
.feedback(Res.get("hyperlinks.openInBrowser.attention", url))
.closeButtonText(Res.get("hyperlinks.openInBrowser.no"))
.onClose(() -> {
settingsService.setCookie(CookieKey.PERMIT_OPENING_BROWSER, false);
Expand All @@ -62,9 +66,20 @@ public static void open(String url) {
doOpen(url);
} else {
ClipboardUtil.copyToClipboard(url);

// TODO create custom popup style and animation similar like Bisq1 notifications
// See https://github.com/bisq-network/bisq2/issues/1883
Popup popup = new Popup().notify(Res.get("hyperlinks.copiedToClipboard"));
popup.show();
UIScheduler.run(popup::hide).after(3000);
}
}

public static boolean hyperLinksGetCopiesWithoutPopup() {
return !DontShowAgainService.showAgain(Browser.HYPERLINKS_OPEN_IN_BROWSER) &&
!settingsService.getCookie().asBoolean(CookieKey.PERMIT_OPENING_BROWSER).orElse(false);
}

private static void doOpen(String url) {
checkNotNull(hostServices, "hostServices must be set before doOpen is called");
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
import lombok.Setter;

public class BisqPopup extends PopupControl {
public enum Alignment {
LEFT, RIGHT
}

@Getter
private final StackPane root = new StackPane();

Expand All @@ -43,7 +47,7 @@ public BisqPopup() {
setAutoHide(true);
}

public final void show(Node owner) {
public void show(Node owner) {
Bounds bounds = owner.localToScreen(owner.getBoundsInLocal());
double anchorX = 0;
if (alignment == Alignment.RIGHT) {
Expand All @@ -56,10 +60,6 @@ public final void show(Node owner) {
super.show(owner, anchorX, bounds.getMinY());
}

public enum Alignment {
LEFT, RIGHT
}

@Override
protected Skin<?> createDefaultSkin() {
return new BisqPopupSkin(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public MaterialTextField(@Nullable String description, @Nullable String prompt,
}

errorLabel.setLayoutX(16);
errorLabel.getStyleClass().add("material-text-field-help");
errorLabel.setMouseTransparent(true);

getChildren().addAll(bg, line, selectionLine, descriptionLabel, textInputControl, iconButton, helpLabel, errorLabel);
Expand Down Expand Up @@ -508,6 +507,16 @@ void update() {
descriptionLabel.getStyleClass().remove("material-text-field-description-deselected");
descriptionLabel.getStyleClass().remove("material-text-field-description-read-only");

if (showErrorLabel()) {
if (!errorLabel.getStyleClass().contains("material-text-field-help"))
errorLabel.getStyleClass().add("material-text-field-help");
errorLabel.setVisible(true);
errorLabel.setManaged(true);
} else {
errorLabel.setVisible(false);
errorLabel.setManaged(false);
}

if (showInputTextField()) {
descriptionLabel.getStyleClass().add("material-text-field-description-small");
} else {
Expand Down Expand Up @@ -548,6 +557,10 @@ protected boolean showInputTextField() {
textInputControl.isFocused();
}

protected boolean showErrorLabel() {
return StringUtils.isNotEmpty(errorProperty().get());
}

protected double getBgHeight() {
return 56;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import bisq.desktop.common.utils.ClipboardUtil;
import bisq.desktop.components.containers.BisqGridPane;
import bisq.desktop.components.containers.Spacer;
import bisq.desktop.components.controls.BisqTooltip;
import bisq.desktop.components.controls.BusyAnimation;
import bisq.i18n.Res;
import bisq.settings.DontShowAgainService;
Expand Down Expand Up @@ -109,7 +110,9 @@ public enum AnimationType {
public enum Type {
UNDEFINED(AnimationType.ScaleFromCenter),

NOTIFICATION(AnimationType.SlideFromRightTop),
// NOTIFICATION(AnimationType.SlideFromRightTop),
// TODO https://github.com/bisq-network/bisq2/issues/1883
NOTIFICATION(AnimationType.SlideDownFromCenterTop, Transitions.Type.LIGHT_BLUR_LIGHT),

BACKGROUND_INFO(AnimationType.SlideDownFromCenterTop),
FEEDBACK(AnimationType.SlideDownFromCenterTop),
Expand Down Expand Up @@ -327,6 +330,12 @@ public T backgroundInfo(String message) {
return cast();
}

public T notify(String message) {
type = Type.NOTIFICATION;
processMessage(message);
return cast();
}

public T feedback(String message) {
type = Type.FEEDBACK;
if (headline == null)
Expand Down Expand Up @@ -798,12 +807,15 @@ protected void applyStyles() {
headlineIcon.setVisible(true);
headlineLabel.getStyleClass().add("overlay-headline");
switch (type) {
case NOTIFICATION:
headlineIcon.setManaged(false);
headlineIcon.setVisible(false);
break;
case INFORMATION:
case BACKGROUND_INFO:
case INSTRUCTION:
case CONFIRMATION:
case FEEDBACK:
case NOTIFICATION:
case ATTENTION:
Icons.getIconForLabel(AwesomeIcon.INFO_SIGN, headlineIcon, "1.8em");
headlineLabel.getStyleClass().add("overlay-headline-information");
Expand Down Expand Up @@ -899,6 +911,10 @@ protected void addFooter() {
Hyperlink link = new Hyperlink(messageHyperlinks.get(i));
link.getStyleClass().add("overlay-message");
link.setOnAction(event -> Browser.open(link.getText()));
String tooltipText = Browser.hyperLinksGetCopiesWithoutPopup()
? Res.get("popup.hyperlink.copy.tooltip", link.getText())
: Res.get("popup.hyperlink.openInBrowser.tooltip", link.getText());
link.setTooltip(new BisqTooltip(tooltipText));
HBox hBox = new HBox(5, enumeration, link);
hBox.setAlignment(Pos.CENTER_LEFT);
footerBox.getChildren().addAll(hBox);
Expand Down
Loading

0 comments on commit 79f4754

Please sign in to comment.