Skip to content

Commit faca463

Browse files
authored
Merge pull request #3266 from axpoems/handle-null-values-isNotificationPanelVisible
Add null check for isNotificationPanelVisible
2 parents e0cc71c + b85a17b commit faca463

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

apps/desktop/desktop/src/main/java/bisq/desktop/main/alert/AlertBannerController.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ public AlertBannerController(ServiceProvider serviceProvider) {
4949
@Override
5050
public void onActivate() {
5151
unconsumedAlertsPin = alertNotificationsService.getUnconsumedAlerts().addObserver(this::showAlertBanner);
52-
isBisqEasyNotificationVisiblePin = bisqEasyNotificationsService.getIsNotificationPanelVisible().addObserver(
53-
this::updateIsBisqEasyNotificationVisible);
52+
isBisqEasyNotificationVisiblePin = bisqEasyNotificationsService.getIsNotificationPanelVisible().addObserver(isVisible -> {
53+
if (isVisible != null) {
54+
updateIsBisqEasyNotificationVisible(isVisible);
55+
}
56+
});
5457
}
5558

5659
@Override

apps/desktop/desktop/src/main/java/bisq/desktop/main/alert/AlertBannerModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class AlertBannerModel implements Model {
3232
private final StringProperty headline = new SimpleStringProperty();
3333
private final StringProperty message = new SimpleStringProperty();
3434
private final ObjectProperty<AlertType> alertType = new SimpleObjectProperty<>();
35-
private final BooleanProperty isBisqEasyNotificationVisible = new SimpleBooleanProperty();
35+
private final BooleanProperty isBisqEasyNotificationVisible = new SimpleBooleanProperty(false);
3636

3737
public AlertBannerModel() {
3838
}

apps/desktop/desktop/src/main/java/bisq/desktop/main/content/ContentTabController.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import bisq.bonded_roles.security_manager.alert.AlertNotificationsService;
2323
import bisq.common.observable.Pin;
2424
import bisq.desktop.ServiceProvider;
25+
import bisq.desktop.common.threading.UIThread;
2526
import bisq.desktop.common.view.TabController;
2627
import lombok.extern.slf4j.Slf4j;
2728

@@ -57,8 +58,12 @@ public void onDeactivate() {
5758
}
5859

5960
private void updateIsNotificationVisible() {
60-
model.getIsNotificationVisible().set(
61-
bisqEasyNotificationsService.getIsNotificationPanelVisible().get()
62-
|| alertNotificationsService.getIsAlertBannerVisible().get());
61+
UIThread.run(() -> {
62+
boolean isNotificationPanelVisible = bisqEasyNotificationsService.getIsNotificationPanelVisible() != null
63+
&& bisqEasyNotificationsService.getIsNotificationPanelVisible().get();
64+
boolean isAlertBannerVisible = alertNotificationsService.getIsAlertBannerVisible() != null
65+
&& alertNotificationsService.getIsAlertBannerVisible().get();
66+
model.getIsNotificationVisible().set(isNotificationPanelVisible || isAlertBannerVisible);
67+
});
6368
}
6469
}

0 commit comments

Comments
 (0)