From 5cc33413c2c489dbe2b3fba7f03646626853ab83 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:17:50 +0100 Subject: [PATCH 1/6] Add message type filter to offerbook --- .../java/bisq/settings/SettingsStore.java | 19 ++++++++++++++----- settings/src/main/proto/settings.proto | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/settings/src/main/java/bisq/settings/SettingsStore.java b/settings/src/main/java/bisq/settings/SettingsStore.java index 556ca632ee..4ab53b966c 100644 --- a/settings/src/main/java/bisq/settings/SettingsStore.java +++ b/settings/src/main/java/bisq/settings/SettingsStore.java @@ -43,6 +43,7 @@ public final class SettingsStore implements PersistableStore { final Observable selectedMarket = new Observable<>(); @Deprecated(since = "2.1.1") private final Observable minRequiredReputationScore = new Observable<>(); + @Deprecated(since = "2.1.2") final Observable offersOnly = new Observable<>(); final Observable tradeRulesConfirmed = new Observable<>(); final Observable chatNotificationType = new Observable<>(); @@ -64,6 +65,7 @@ public final class SettingsStore implements PersistableStore { final Observable backupLocation = new Observable<>(); final Observable showMyOffersOnly = new Observable<>(); final Observable totalMaxBackupSizeInMB = new Observable<>(); + final Observable bisqEasyOfferbookMessageTypeFilter = new Observable<>(); public SettingsStore() { this(new Cookie(), @@ -90,7 +92,8 @@ public SettingsStore() { false, PlatformUtils.getHomeDirectory(), false, - BackupService.TOTAL_MAX_BACKUP_SIZE_IN_MB); + BackupService.TOTAL_MAX_BACKUP_SIZE_IN_MB, + ""); } public SettingsStore(Cookie cookie, @@ -117,7 +120,8 @@ public SettingsStore(Cookie cookie, boolean showMarketSelectionListCollapsed, String backupLocation, boolean showMyOffersOnly, - double totalMaxBackupSizeInMB) { + double totalMaxBackupSizeInMB, + String bisqEasyOfferbookMessageTypeFilter) { this.cookie = cookie; this.dontShowAgainMap.putAll(dontShowAgainMap); this.useAnimations.set(useAnimations); @@ -143,6 +147,7 @@ public SettingsStore(Cookie cookie, this.backupLocation.set(backupLocation); this.showMyOffersOnly.set(showMyOffersOnly); this.totalMaxBackupSizeInMB.set(totalMaxBackupSizeInMB); + this.bisqEasyOfferbookMessageTypeFilter.set(bisqEasyOfferbookMessageTypeFilter); } @Override @@ -172,7 +177,8 @@ public bisq.settings.protobuf.SettingsStore.Builder getBuilder(boolean serialize .setShowMarketSelectionListCollapsed(showMarketSelectionListCollapsed.get()) .setBackupLocation(backupLocation.get()) .setShowMyOffersOnly(showMyOffersOnly.get()) - .setTotalMaxBackupSizeInMB(totalMaxBackupSizeInMB.get()); + .setTotalMaxBackupSizeInMB(totalMaxBackupSizeInMB.get()) + .setBisqEasyOfferbookMessageTypeFilter(bisqEasyOfferbookMessageTypeFilter.get()); } @Override @@ -218,7 +224,8 @@ public static SettingsStore fromProto(bisq.settings.protobuf.SettingsStore proto proto.getShowMarketSelectionListCollapsed(), proto.getBackupLocation(), proto.getShowMyOffersOnly(), - totalMaxBackupSizeInMB); + totalMaxBackupSizeInMB, + proto.getBisqEasyOfferbookMessageTypeFilter()); } @Override @@ -258,7 +265,8 @@ public SettingsStore getClone() { showMarketSelectionListCollapsed.get(), backupLocation.get(), showMyOffersOnly.get(), - totalMaxBackupSizeInMB.get()); + totalMaxBackupSizeInMB.get(), + bisqEasyOfferbookMessageTypeFilter.get()); } @Override @@ -289,6 +297,7 @@ public void applyPersisted(SettingsStore persisted) { backupLocation.set(persisted.backupLocation.get()); showMyOffersOnly.set(persisted.showMyOffersOnly.get()); totalMaxBackupSizeInMB.set(persisted.totalMaxBackupSizeInMB.get()); + bisqEasyOfferbookMessageTypeFilter.set(persisted.bisqEasyOfferbookMessageTypeFilter.get()); } catch (Exception e) { log.error("Exception at applyPersisted", e); } diff --git a/settings/src/main/proto/settings.proto b/settings/src/main/proto/settings.proto index b882df460e..b0831379da 100644 --- a/settings/src/main/proto/settings.proto +++ b/settings/src/main/proto/settings.proto @@ -44,7 +44,7 @@ message SettingsStore { bool useAnimations = 3; common.Market selectedMarket = 4; sint64 minRequiredReputationScore = 5 [deprecated = true]; // Not used anymore since 2.1.1 - bool offersOnly = 6; + bool offersOnly = 6 [deprecated = true]; // Not used anymore since 2.1.2 bool tradeRulesConfirmed = 7; ChatNotificationType chatNotificationType = 8; bool isTacAccepted = 9; @@ -64,4 +64,5 @@ message SettingsStore { string backupLocation = 23; bool showMyOffersOnly = 24; double totalMaxBackupSizeInMB = 25; + string bisqEasyOfferbookMessageTypeFilter = 26; } From 776fc234cb2bf50058ba1bb66e24597535009c18 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sun, 24 Nov 2024 12:00:02 +0100 Subject: [PATCH 2/6] Remove offersOnly from trade settings --- .../settings/trade/TradeSettingsController.java | 5 +---- .../content/settings/trade/TradeSettingsModel.java | 1 - .../content/settings/trade/TradeSettingsView.java | 11 ++--------- i18n/src/main/resources/bisq_easy.properties | 1 - 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsController.java index 26232bc375..7880ec2c4c 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsController.java @@ -32,7 +32,7 @@ public class TradeSettingsController implements Controller { private final TradeSettingsModel model; private final SettingsService settingsService; - private Pin offerOnlyPin, closeMyOfferWhenTakenPin,maxTradePriceDeviationPin; + private Pin closeMyOfferWhenTakenPin,maxTradePriceDeviationPin; public TradeSettingsController(ServiceProvider serviceProvider) { settingsService = serviceProvider.getSettingsService(); @@ -42,8 +42,6 @@ public TradeSettingsController(ServiceProvider serviceProvider) { @Override public void onActivate() { - offerOnlyPin = FxBindings.bindBiDir(model.getOfferOnly()) - .to(settingsService.getOffersOnly()); closeMyOfferWhenTakenPin = FxBindings.bindBiDir(model.getCloseMyOfferWhenTaken()) .to(settingsService.getCloseMyOfferWhenTaken()); maxTradePriceDeviationPin = FxBindings.bindBiDir(model.getMaxTradePriceDeviation()) @@ -52,7 +50,6 @@ public void onActivate() { @Override public void onDeactivate() { - offerOnlyPin.unbind(); closeMyOfferWhenTakenPin.unbind(); maxTradePriceDeviationPin.unbind(); } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsModel.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsModel.java index be74ec7948..d4f57620a8 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsModel.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsModel.java @@ -25,7 +25,6 @@ @Slf4j @Getter public class TradeSettingsModel implements Model { - private final BooleanProperty offerOnly = new SimpleBooleanProperty(); private final BooleanProperty closeMyOfferWhenTaken = new SimpleBooleanProperty(); private final DoubleProperty maxTradePriceDeviation = new SimpleDoubleProperty(); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsView.java index e673ae2a08..ae9d9b3dd4 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/settings/trade/TradeSettingsView.java @@ -46,7 +46,7 @@ public class TradeSettingsView extends View Date: Sun, 24 Nov 2024 13:18:49 +0100 Subject: [PATCH 3/6] Add message filter menu and use the new setting to filter --- .../offerbook/BisqEasyOfferbookView.java | 55 +++++++++++++------ .../ChatMessageContainerController.java | 6 +- .../list/ChatMessagesListController.java | 13 +++-- .../ChatNotificationService.java | 3 +- i18n/src/main/resources/bisq_easy.properties | 5 ++ .../java/bisq/settings/ChatMessageType.java | 36 ++++++++++++ .../java/bisq/settings/SettingsService.java | 10 ++-- .../java/bisq/settings/SettingsStore.java | 10 ++-- settings/src/main/proto/settings.proto | 9 ++- 9 files changed, 109 insertions(+), 38 deletions(-) create mode 100644 settings/src/main/java/bisq/settings/ChatMessageType.java diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index 62e5d57185..5f7b301459 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -28,6 +28,7 @@ import bisq.desktop.main.content.chat.ChatView; import bisq.desktop.main.content.components.MarketImageComposition; import bisq.i18n.Res; +import bisq.settings.ChatMessageType; import javafx.beans.binding.Bindings; import javafx.collections.ListChangeListener; import javafx.css.PseudoClass; @@ -63,9 +64,10 @@ public final class BisqEasyOfferbookView extends ChatView sortByMostOffers, sortByNameAZ, sortByNameZA; - private SortAndFilterMarketsDropdownMenuItem filterShowAll, filterWithOffers, filterFavourites; + private DropdownMenu sortAndFilterMarketsMenu, messageTypeFilterMenu; + private SortAndFilterDropdownMenuItem sortByMostOffers, sortByNameAZ, sortByNameZA; + private SortAndFilterDropdownMenuItem filterShowAll, filterWithOffers, filterFavourites; + private SortAndFilterDropdownMenuItem showAllMessages, showOnlyOfferMessages, showOnlyTextMessages; private Label channelHeaderIcon, marketPrice, removeWithOffersFilter, removeFavouritesFilter, collapsedMarketSelectionListTitle, marketSelectionListTitle; private HBox appliedFiltersSection, withOffersDisplayHint, onlyFavouritesDisplayHint; @@ -418,11 +420,11 @@ private DropdownMenu createAndGetSortAndFilterMarketsMenu() { // Sorting options DropdownTitleMenuItem sortTitle = new DropdownTitleMenuItem( Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.sortTitle")); - sortByMostOffers = new SortAndFilterMarketsDropdownMenuItem<>("check-white", "check-white", + sortByMostOffers = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.mostOffers"), MarketSortType.NUM_OFFERS); - sortByNameAZ = new SortAndFilterMarketsDropdownMenuItem<>("check-white", "check-white", + sortByNameAZ = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.nameAZ"), MarketSortType.ASC); - sortByNameZA = new SortAndFilterMarketsDropdownMenuItem<>("check-white", "check-white", + sortByNameZA = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.nameZA"), MarketSortType.DESC); // Separator @@ -431,11 +433,11 @@ private DropdownMenu createAndGetSortAndFilterMarketsMenu() { // Filter options DropdownTitleMenuItem filterTitle = new DropdownTitleMenuItem( Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.filterTitle")); - filterWithOffers = new SortAndFilterMarketsDropdownMenuItem<>("check-white", "check-white", + filterWithOffers = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.withOffers"), WITH_OFFERS); - filterFavourites = new SortAndFilterMarketsDropdownMenuItem<>("check-white", "check-white", + filterFavourites = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.favourites"), FAVOURITES); - filterShowAll = new SortAndFilterMarketsDropdownMenuItem<>("check-white", "check-white", + filterShowAll = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", Res.get("bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.all"), ALL); dropdownMenu.addMenuItems(sortTitle, sortByMostOffers, sortByNameAZ, sortByNameZA, separator, filterTitle, @@ -472,7 +474,8 @@ private void addChatBox() { centerVBox.setFillWidth(true); searchBox.getStyleClass().add("offerbook-search-box"); - HBox subheaderContent = new HBox(30, searchBox, Spacer.fillHBox()); + messageTypeFilterMenu = createAndGetMessageTypeFilterMenu(); + HBox subheaderContent = new HBox(30, searchBox, Spacer.fillHBox(), messageTypeFilterMenu); subheaderContent.getStyleClass().add("offerbook-subheader-content"); HBox.setHgrow(subheaderContent, Priority.ALWAYS); @@ -487,6 +490,22 @@ private void addChatBox() { centerVBox.setAlignment(Pos.CENTER); } + private DropdownMenu createAndGetMessageTypeFilterMenu() { + DropdownMenu dropdownMenu = new DropdownMenu("chevron-drop-menu-grey", "chevron-drop-menu-white", false); + dropdownMenu.setTooltip(Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.tooltip")); + dropdownMenu.getStyleClass().add("dropdown-offer-list-payment-filter-menu"); + + showAllMessages = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", + Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.all"), ChatMessageType.ALL); + showOnlyOfferMessages = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", + Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.offers"), ChatMessageType.OFFER); + showOnlyTextMessages = new SortAndFilterDropdownMenuItem<>("check-white", "check-white", + Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.text"), ChatMessageType.TEXT); + + dropdownMenu.addMenuItems(showAllMessages, showOnlyOfferMessages, showOnlyTextMessages); + return dropdownMenu; + } + private void updateSelectedMarketFilter(BisqEasyMarketFilter bisqEasyMarketFilter) { if (bisqEasyMarketFilter == null) { return; @@ -494,9 +513,9 @@ private void updateSelectedMarketFilter(BisqEasyMarketFilter bisqEasyMarketFilte //noinspection unchecked sortAndFilterMarketsMenu.getMenuItems().stream() - .filter(menuItem -> menuItem instanceof SortAndFilterMarketsDropdownMenuItem && - ((SortAndFilterMarketsDropdownMenuItem) menuItem).getMenuItem() instanceof BisqEasyMarketFilter) - .map(menuItem -> (SortAndFilterMarketsDropdownMenuItem) menuItem) + .filter(menuItem -> menuItem instanceof SortAndFilterDropdownMenuItem && + ((SortAndFilterDropdownMenuItem) menuItem).getMenuItem() instanceof BisqEasyMarketFilter) + .map(menuItem -> (SortAndFilterDropdownMenuItem) menuItem) .forEach(menuItem -> menuItem.updateSelection(bisqEasyMarketFilter == menuItem.getMenuItem())); marketsTableView.getSelectionModel().select(getModel().getSelectedMarketChannelItem().get()); @@ -509,9 +528,9 @@ private void updateMarketSortType(MarketSortType marketSortType) { //noinspection unchecked sortAndFilterMarketsMenu.getMenuItems().stream() - .filter(menuItem -> menuItem instanceof SortAndFilterMarketsDropdownMenuItem && - ((SortAndFilterMarketsDropdownMenuItem) menuItem).getMenuItem() instanceof MarketSortType) - .map(menuItem -> (SortAndFilterMarketsDropdownMenuItem) menuItem) + .filter(menuItem -> menuItem instanceof SortAndFilterDropdownMenuItem && + ((SortAndFilterDropdownMenuItem) menuItem).getMenuItem() instanceof MarketSortType) + .map(menuItem -> (SortAndFilterDropdownMenuItem) menuItem) .forEach(menuItem -> menuItem.updateSelection(marketSortType == menuItem.getMenuItem())); } @@ -523,12 +542,12 @@ private void updateAppliedFiltersSectionStyles(boolean shouldShowAppliedFilters) } @Getter - private static final class SortAndFilterMarketsDropdownMenuItem extends DropdownBisqMenuItem { + private static final class SortAndFilterDropdownMenuItem extends DropdownBisqMenuItem { private static final PseudoClass SELECTED_PSEUDO_CLASS = PseudoClass.getPseudoClass("selected"); private final T menuItem; - SortAndFilterMarketsDropdownMenuItem(String defaultIconId, String activeIconId, String text, T menuItem) { + SortAndFilterDropdownMenuItem(String defaultIconId, String activeIconId, String text, T menuItem) { super(defaultIconId, activeIconId, text); this.menuItem = menuItem; diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/ChatMessageContainerController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/ChatMessageContainerController.java index 65d834280e..e529c8da83 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/ChatMessageContainerController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/ChatMessageContainerController.java @@ -39,6 +39,7 @@ import bisq.desktop.main.content.chat.message_container.list.ChatMessagesListController; import bisq.desktop.main.content.components.UserProfileSelection; import bisq.i18n.Res; +import bisq.settings.ChatMessageType; import bisq.settings.SettingsService; import bisq.user.identity.UserIdentity; import bisq.user.identity.UserIdentityService; @@ -263,10 +264,11 @@ private void doSendMessage(String text) { if (chatChannel instanceof BisqEasyOfferbookChannel) { String dontShowAgainId = "sendMsgOfferOnlyWarn"; - if (settingsService.getOffersOnly().get()) { + boolean hasShowOnlyOffersFilter = settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == ChatMessageType.OFFER; + if (hasShowOnlyOffersFilter) { new Popup().information(Res.get("chat.message.send.offerOnly.warn")) .actionButtonText(Res.get("confirmation.yes")) - .onAction(() -> settingsService.getOffersOnly().set(false)) + .onAction(() -> settingsService.getBisqEasyOfferbookMessageTypeFilter().set(ChatMessageType.ALL)) .closeButtonText(Res.get("confirmation.no")) .dontShowAgainId(dontShowAgainId) .show(); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java index 7ebfd58ce5..4b6da72062 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java @@ -91,7 +91,7 @@ public class ChatMessagesListController implements bisq.desktop.common.view.Cont private final BisqEasyService bisqEasyService; private final MarketPriceService marketPriceService; private final LeavePrivateChatManager leavePrivateChatManager; - private Pin selectedChannelPin, chatMessagesPin, offerOnlySettingsPin; + private Pin selectedChannelPin, chatMessagesPin, bisqEasyOfferbookMessageTypeFilterPin; private Subscription selectedChannelSubscription, focusSubscription, scrollValuePin, scrollBarVisiblePin, layoutChildrenDonePin; @@ -125,7 +125,8 @@ public ChatMessagesListController(ServiceProvider serviceProvider, public void onActivate() { model.getSortedChatMessages().setComparator(ChatMessageListItem::compareTo); - offerOnlySettingsPin = FxBindings.subscribe(settingsService.getOffersOnly(), offerOnly -> UIThread.run(this::applyPredicate)); + bisqEasyOfferbookMessageTypeFilterPin = FxBindings.subscribe(settingsService.getBisqEasyOfferbookMessageTypeFilter(), + filter -> UIThread.run(this::applyPredicate)); if (selectedChannelPin != null) { selectedChannelPin.unbind(); @@ -154,8 +155,8 @@ public void onActivate() { @Override public void onDeactivate() { - if (offerOnlySettingsPin != null) { - offerOnlySettingsPin.unbind(); + if (bisqEasyOfferbookMessageTypeFilterPin != null) { + bisqEasyOfferbookMessageTypeFilterPin.unbind(); } if (selectedChannelPin != null) { selectedChannelPin.unbind(); @@ -599,7 +600,7 @@ private void createAndSelectTwoPartyPrivateChatChannel(UserProfile peer) { } private void applyPredicate() { - boolean offerOnly = settingsService.getOffersOnly().get(); + boolean showOnlyOffersFilter = settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == bisq.settings.ChatMessageType.OFFER; Predicate>> predicate = item -> { Optional senderUserProfile = item.getSenderUserProfile(); if (senderUserProfile.isEmpty()) { @@ -612,7 +613,7 @@ private void applyPredicate() { boolean offerOnlyPredicate = true; if (item.getChatMessage() instanceof BisqEasyOfferbookMessage bisqEasyOfferbookMessage) { - offerOnlyPredicate = !offerOnly || bisqEasyOfferbookMessage.hasBisqEasyOffer(); + offerOnlyPredicate = !showOnlyOffersFilter || bisqEasyOfferbookMessage.hasBisqEasyOffer(); } // We do not display the take offer message as it has no text and is used only for sending the offer // to the peer and signalling the take offer event. diff --git a/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java b/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java index 2f917dc476..983b860016 100644 --- a/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java +++ b/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java @@ -416,7 +416,8 @@ private void onMessageAdded(ChatChannel chatChannel, // If user has set "Show offers only" in settings we mark messages as consumed if (chatMessage instanceof BisqEasyOfferbookMessage bisqEasyOfferbookMessage) { - if (settingsService.getOffersOnly().get() && !bisqEasyOfferbookMessage.hasBisqEasyOffer()) { + if (settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == bisq.settings.ChatMessageType.OFFER + && !bisqEasyOfferbookMessage.hasBisqEasyOffer()) { consumeNotification(chatNotification); return; } diff --git a/i18n/src/main/resources/bisq_easy.properties b/i18n/src/main/resources/bisq_easy.properties index 4aadde0bb7..5940a15239 100644 --- a/i18n/src/main/resources/bisq_easy.properties +++ b/i18n/src/main/resources/bisq_easy.properties @@ -541,6 +541,11 @@ bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.withOffers=With offers bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.favourites=Only favourites bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.all=All +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.tooltip=Filter by message type +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.all=All messages +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.offers=Only offers +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.text=Only text + bisqEasy.offerbook.chatMessage.deleteOffer.confirmation=Are you sure you want to delete this offer? bisqEasy.offerbook.chatMessage.deleteMessage.confirmation=Are you sure you want to delete this message? diff --git a/settings/src/main/java/bisq/settings/ChatMessageType.java b/settings/src/main/java/bisq/settings/ChatMessageType.java new file mode 100644 index 0000000000..28632b0e7d --- /dev/null +++ b/settings/src/main/java/bisq/settings/ChatMessageType.java @@ -0,0 +1,36 @@ +/* + * 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.settings; + +import bisq.common.proto.ProtoEnum; +import bisq.common.proto.ProtobufUtils; + +public enum ChatMessageType implements ProtoEnum { + ALL, + OFFER, + TEXT; + + @Override + public bisq.settings.protobuf.ChatMessageType toProtoEnum() { + return bisq.settings.protobuf.ChatMessageType.valueOf(getProtobufEnumPrefix() + name()); + } + + public static ChatMessageType fromProto(bisq.settings.protobuf.ChatMessageType proto) { + return ProtobufUtils.enumFromProto(ChatMessageType.class, proto.name(), ALL); + } +} diff --git a/settings/src/main/java/bisq/settings/SettingsService.java b/settings/src/main/java/bisq/settings/SettingsService.java index cdf5792619..c337447145 100644 --- a/settings/src/main/java/bisq/settings/SettingsService.java +++ b/settings/src/main/java/bisq/settings/SettingsService.java @@ -73,7 +73,6 @@ public CompletableFuture initialize() { log.info("initialize"); // If used with FxBindings.bindBiDir we need to trigger persist call getIsTacAccepted().addObserver(value -> persist()); - getOffersOnly().addObserver(value -> persist()); getChatNotificationType().addObserver(value -> persist()); getUseAnimations().addObserver(value -> persist()); getPreventStandbyMode().addObserver(value -> persist()); @@ -96,6 +95,7 @@ public CompletableFuture initialize() { BackupService.setTotalMaxBackupSize(ByteUnit.MB.toBytes(value)); persist(); }); + getBisqEasyOfferbookMessageTypeFilter().addObserver(value -> persist()); isInitialized = true; @@ -147,10 +147,6 @@ public Observable getUseAnimations() { return persistableStore.useAnimations; } - public Observable getOffersOnly() { - return persistableStore.offersOnly; - } - public Observable getTradeRulesConfirmed() { return persistableStore.tradeRulesConfirmed; } @@ -223,6 +219,10 @@ public Observable getTotalMaxBackupSizeInMB() { return persistableStore.totalMaxBackupSizeInMB; } + public Observable getBisqEasyOfferbookMessageTypeFilter() { + return persistableStore.bisqEasyOfferbookMessageTypeFilter; + } + /////////////////////////////////////////////////////////////////////////////////////////////////// // DontShowAgainMap diff --git a/settings/src/main/java/bisq/settings/SettingsStore.java b/settings/src/main/java/bisq/settings/SettingsStore.java index 4ab53b966c..152edcd07d 100644 --- a/settings/src/main/java/bisq/settings/SettingsStore.java +++ b/settings/src/main/java/bisq/settings/SettingsStore.java @@ -65,7 +65,7 @@ public final class SettingsStore implements PersistableStore { final Observable backupLocation = new Observable<>(); final Observable showMyOffersOnly = new Observable<>(); final Observable totalMaxBackupSizeInMB = new Observable<>(); - final Observable bisqEasyOfferbookMessageTypeFilter = new Observable<>(); + final Observable bisqEasyOfferbookMessageTypeFilter = new Observable<>(); public SettingsStore() { this(new Cookie(), @@ -93,7 +93,7 @@ public SettingsStore() { PlatformUtils.getHomeDirectory(), false, BackupService.TOTAL_MAX_BACKUP_SIZE_IN_MB, - ""); + ChatMessageType.ALL); } public SettingsStore(Cookie cookie, @@ -121,7 +121,7 @@ public SettingsStore(Cookie cookie, String backupLocation, boolean showMyOffersOnly, double totalMaxBackupSizeInMB, - String bisqEasyOfferbookMessageTypeFilter) { + ChatMessageType bisqEasyOfferbookMessageTypeFilter) { this.cookie = cookie; this.dontShowAgainMap.putAll(dontShowAgainMap); this.useAnimations.set(useAnimations); @@ -178,7 +178,7 @@ public bisq.settings.protobuf.SettingsStore.Builder getBuilder(boolean serialize .setBackupLocation(backupLocation.get()) .setShowMyOffersOnly(showMyOffersOnly.get()) .setTotalMaxBackupSizeInMB(totalMaxBackupSizeInMB.get()) - .setBisqEasyOfferbookMessageTypeFilter(bisqEasyOfferbookMessageTypeFilter.get()); + .setBisqEasyOfferbookMessageTypeFilter(bisqEasyOfferbookMessageTypeFilter.get().toProtoEnum()); } @Override @@ -225,7 +225,7 @@ public static SettingsStore fromProto(bisq.settings.protobuf.SettingsStore proto proto.getBackupLocation(), proto.getShowMyOffersOnly(), totalMaxBackupSizeInMB, - proto.getBisqEasyOfferbookMessageTypeFilter()); + ChatMessageType.fromProto(proto.getBisqEasyOfferbookMessageTypeFilter())); } @Override diff --git a/settings/src/main/proto/settings.proto b/settings/src/main/proto/settings.proto index b0831379da..ee74b96afb 100644 --- a/settings/src/main/proto/settings.proto +++ b/settings/src/main/proto/settings.proto @@ -38,6 +38,13 @@ enum ChatNotificationType { CHATNOTIFICATIONTYPE_OFF = 3; } +enum ChatMessageType { + CHATMESSAGETYPE_UNSPECIFIED = 0; + CHATMESSAGETYPE_ALL = 1; + CHATMESSAGETYPE_OFFER = 2; + CHATMESSAGETYPE_TEXT = 3; +} + message SettingsStore { Cookie cookie = 1; map dontShowAgainMap = 2; @@ -64,5 +71,5 @@ message SettingsStore { string backupLocation = 23; bool showMyOffersOnly = 24; double totalMaxBackupSizeInMB = 25; - string bisqEasyOfferbookMessageTypeFilter = 26; + ChatMessageType bisqEasyOfferbookMessageTypeFilter = 26; } From a0f6e65b75ff5ef213c9755f7655bc8411e4518a Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sun, 24 Nov 2024 16:02:46 +0100 Subject: [PATCH 4/6] Add functionality to offerbook filter --- .../BisqEasyOfferbookController.java | 11 ++++++- .../offerbook/BisqEasyOfferbookModel.java | 2 ++ .../offerbook/BisqEasyOfferbookView.java | 33 ++++++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookController.java index 2fb04b2c80..f518addad7 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookController.java @@ -42,6 +42,7 @@ import bisq.desktop.main.content.chat.ChatController; import bisq.i18n.Res; import bisq.presentation.formatters.PriceFormatter; +import bisq.settings.ChatMessageType; import bisq.settings.CookieKey; import bisq.settings.FavouriteMarketsService; import bisq.settings.SettingsService; @@ -73,7 +74,7 @@ public final class BisqEasyOfferbookController extends ChatController marketChannelItemListener = c -> updateFilteredMarketChannelItems(); private final Map> marketNumOffersListeners = new HashMap<>(); @@ -221,6 +222,9 @@ public void clear() { } }); + bisqEasyOfferbookMessageTypeFilterPin = FxBindings.bindBiDir(model.getMessageTypeFilter()) + .to(settingsService.getBisqEasyOfferbookMessageTypeFilter()); + model.getMarketChannelItems().forEach(item -> { ChangeListener numberChangeListener = (obs, oldValue, newValue) -> updateFilteredMarketChannelItems(); item.getNumOffers().addListener(numberChangeListener); @@ -241,6 +245,7 @@ public void onDeactivate() { selectedMarketSortTypePin.unsubscribe(); favouriteMarketsPin.unbind(); changedNotificationPin.unbind(); + bisqEasyOfferbookMessageTypeFilterPin.unbind(); model.getMarketChannelItems().removeListener(marketChannelItemListener); marketNumOffersListeners.forEach((item, changeListener) -> item.getNumOffers().removeListener(changeListener)); @@ -309,6 +314,10 @@ void toggleMarketSelectionList() { model.getShowMarketSelectionListCollapsed().set(!model.getShowMarketSelectionListCollapsed().get()); } + void setMessageTypeFilter(ChatMessageType messageType) { + model.getMessageTypeFilter().set(messageType); + } + private void createMarketChannels() { List marketChannelItems = bisqEasyOfferbookChannelService.getChannels().stream() .map(channel -> new MarketChannelItem(channel, favouriteMarketsService, chatNotificationService)) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookModel.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookModel.java index 2d089a0d96..357065f6a8 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookModel.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookModel.java @@ -20,6 +20,7 @@ import bisq.bisq_easy.BisqEasyMarketFilter; import bisq.chat.ChatChannelDomain; import bisq.desktop.main.content.chat.ChatModel; +import bisq.settings.ChatMessageType; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyBooleanProperty; @@ -53,6 +54,7 @@ public final class BisqEasyOfferbookModel extends ChatModel { private final StringProperty marketPrice = new SimpleStringProperty(); private final StringProperty fiatAmountTitle = new SimpleStringProperty(); private final BooleanProperty showMarketSelectionListCollapsed = new SimpleBooleanProperty(); + private final ObjectProperty messageTypeFilter = new SimpleObjectProperty<>(ChatMessageType.ALL); @Setter private ReadOnlyBooleanProperty showOfferListExpanded; diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index 5f7b301459..a97bef06bd 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -62,7 +62,7 @@ public final class BisqEasyOfferbookView extends ChatView sortByMostOffers, sortByNameAZ, sortByNameZA; @@ -179,6 +179,8 @@ protected void onViewAttached() { } }); + messageTypeFilterPin = EasyBind.subscribe(getModel().getMessageTypeFilter(), this::updateMessageTypeFilter); + sortByMostOffers.setOnAction(e -> getController().onSortMarkets(MarketSortType.NUM_OFFERS)); sortByNameAZ.setOnAction(e -> getController().onSortMarkets(MarketSortType.ASC)); sortByNameZA.setOnAction(e -> getController().onSortMarkets(MarketSortType.DESC)); @@ -187,6 +189,10 @@ protected void onViewAttached() { filterShowAll.setOnAction(e -> getModel().getSelectedMarketsFilter().set(ALL)); filterFavourites.setOnAction(e -> getModel().getSelectedMarketsFilter().set(FAVOURITES)); + showAllMessages.setOnAction(e -> getController().setMessageTypeFilter(showAllMessages.getMenuItem())); + showOnlyOfferMessages.setOnAction(e -> getController().setMessageTypeFilter(showOnlyOfferMessages.getMenuItem())); + showOnlyTextMessages.setOnAction(e -> getController().setMessageTypeFilter(showOnlyTextMessages.getMenuItem())); + createOfferButton.setOnAction(e -> getController().onCreateOffer()); removeWithOffersFilter.setOnMouseClicked(e -> getModel().getSelectedMarketsFilter().set(ALL)); @@ -238,6 +244,7 @@ protected void onViewDetached() { selectedMarketFilterPin.unsubscribe(); selectedMarketSortTypePin.unsubscribe(); favouritesTableViewHeightChangedPin.unsubscribe(); + messageTypeFilterPin.unsubscribe(); shouldShowAppliedFiltersPin.unsubscribe(); showOfferListExpandedPin.unsubscribe(); showMarketSelectionListCollapsedPin.unsubscribe(); @@ -248,6 +255,9 @@ protected void onViewDetached() { filterWithOffers.setOnAction(null); filterShowAll.setOnAction(null); filterFavourites.setOnAction(null); + showAllMessages.setOnAction(null); + showOnlyOfferMessages.setOnAction(null); + showOnlyTextMessages.setOnAction(null); createOfferButton.setOnAction(null); removeWithOffersFilter.setOnMouseClicked(null); @@ -541,6 +551,27 @@ private void updateAppliedFiltersSectionStyles(boolean shouldShowAppliedFilters) : "market-selection-no-filters"); } + void updateMessageTypeFilter(ChatMessageType messageType) { + messageTypeFilterMenu.setLabelAsContent(getMessageTypeAsString(messageType)); + + //noinspection unchecked + messageTypeFilterMenu.getMenuItems().stream() + .filter(menuItem -> menuItem instanceof SortAndFilterDropdownMenuItem && + ((SortAndFilterDropdownMenuItem) menuItem).getMenuItem() instanceof ChatMessageType) + .map(menuItem -> (SortAndFilterDropdownMenuItem) menuItem) + .forEach(menuItem -> menuItem.updateSelection(messageType == menuItem.getMenuItem())); + } + + private String getMessageTypeAsString(ChatMessageType messageType) { + if (messageType == ChatMessageType.OFFER) { + return Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.offers"); + } + if (messageType == ChatMessageType.TEXT) { + return Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.text"); + } + return Res.get("bisqEasy.offerbook.dropdownMenu.messageTypeFilter.all"); + } + @Getter private static final class SortAndFilterDropdownMenuItem extends DropdownBisqMenuItem { private static final PseudoClass SELECTED_PSEUDO_CLASS = PseudoClass.getPseudoClass("selected"); From bbcd5646a962f511d33778e815f230fdb2cb1050 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sun, 24 Nov 2024 16:03:57 +0100 Subject: [PATCH 5/6] Change strings --- i18n/src/main/resources/bisq_easy.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i18n/src/main/resources/bisq_easy.properties b/i18n/src/main/resources/bisq_easy.properties index 5940a15239..756797ab57 100644 --- a/i18n/src/main/resources/bisq_easy.properties +++ b/i18n/src/main/resources/bisq_easy.properties @@ -541,10 +541,10 @@ bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.withOffers=With offers bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.favourites=Only favourites bisqEasy.offerbook.dropdownMenu.sortAndFilterMarkets.all=All -bisqEasy.offerbook.dropdownMenu.messageTypeFilter.tooltip=Filter by message type -bisqEasy.offerbook.dropdownMenu.messageTypeFilter.all=All messages +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.tooltip=Filter by chat activity +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.all=All activity bisqEasy.offerbook.dropdownMenu.messageTypeFilter.offers=Only offers -bisqEasy.offerbook.dropdownMenu.messageTypeFilter.text=Only text +bisqEasy.offerbook.dropdownMenu.messageTypeFilter.text=Only messages bisqEasy.offerbook.chatMessage.deleteOffer.confirmation=Are you sure you want to delete this offer? bisqEasy.offerbook.chatMessage.deleteMessage.confirmation=Are you sure you want to delete this message? From 99cf4cca8e0f73f07d0a51d2389cf928472ed2b9 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sun, 24 Nov 2024 16:43:03 +0100 Subject: [PATCH 6/6] Add new 'only text messages' functionality --- .../review/TradeWizardReviewController.java | 12 ++++++++++++ .../list/ChatMessagesListController.java | 17 +++++++++++------ .../notifications/ChatNotificationService.java | 11 ++++++++--- i18n/src/main/resources/chat.properties | 7 +++++-- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/review/TradeWizardReviewController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/review/TradeWizardReviewController.java index e49dd17efb..548e872e44 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/review/TradeWizardReviewController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/review/TradeWizardReviewController.java @@ -64,6 +64,7 @@ import bisq.presentation.formatters.AmountFormatter; import bisq.presentation.formatters.PercentageFormatter; import bisq.presentation.formatters.PriceFormatter; +import bisq.settings.ChatMessageType; import bisq.settings.SettingsService; import bisq.support.mediation.MediationRequestService; import bisq.trade.bisq_easy.BisqEasyTrade; @@ -393,6 +394,17 @@ public void reset() { public void publishOffer() { UserIdentity userIdentity = userIdentityService.getSelectedUserIdentity(); + + String dontShowAgainId = "sendOfferMsgTextOnlyWarn"; + boolean hasShowOnlyTextFilter = settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == ChatMessageType.TEXT; + if (hasShowOnlyTextFilter) { + new Popup().information(Res.get("chat.message.send.textMsgOnly.warn")) + .actionButtonText(Res.get("confirmation.yes")) + .onAction(() -> settingsService.getBisqEasyOfferbookMessageTypeFilter().set(ChatMessageType.ALL)) + .closeButtonText(Res.get("confirmation.no")) + .dontShowAgainId(dontShowAgainId) + .show(); + } bisqEasyOfferbookChannelService.publishChatMessage(model.getMyOfferMessage(), userIdentity) .thenAccept(result -> UIThread.run(() -> { model.getShowCreateOfferSuccess().set(true); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java index 4b6da72062..9e5087e9d8 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/ChatMessagesListController.java @@ -600,7 +600,6 @@ private void createAndSelectTwoPartyPrivateChatChannel(UserProfile peer) { } private void applyPredicate() { - boolean showOnlyOffersFilter = settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == bisq.settings.ChatMessageType.OFFER; Predicate>> predicate = item -> { Optional senderUserProfile = item.getSenderUserProfile(); if (senderUserProfile.isEmpty()) { @@ -611,19 +610,25 @@ private void applyPredicate() { return false; } - boolean offerOnlyPredicate = true; + boolean messageTypePredicate = true; // messageTypeFilter == bisq.settings.ChatMessageType.ALL if (item.getChatMessage() instanceof BisqEasyOfferbookMessage bisqEasyOfferbookMessage) { - offerOnlyPredicate = !showOnlyOffersFilter || bisqEasyOfferbookMessage.hasBisqEasyOffer(); + bisq.settings.ChatMessageType messageTypeFilter = settingsService.getBisqEasyOfferbookMessageTypeFilter().get(); + if (messageTypeFilter == bisq.settings.ChatMessageType.TEXT) { + messageTypePredicate = !bisqEasyOfferbookMessage.hasBisqEasyOffer(); + } else if (messageTypeFilter == bisq.settings.ChatMessageType.OFFER) { + messageTypePredicate = bisqEasyOfferbookMessage.hasBisqEasyOffer(); + } } + // We do not display the take offer message as it has no text and is used only for sending the offer // to the peer and signalling the take offer event. if (item.getChatMessage().getChatMessageType() == ChatMessageType.TAKE_BISQ_EASY_OFFER) { return false; } - return offerOnlyPredicate && - !userProfileService.getIgnoredUserProfileIds().contains(senderUserProfile.get().getId()) && - userProfileService.findUserProfile(senderUserProfile.get().getId()).isPresent(); + return messageTypePredicate + && !userProfileService.getIgnoredUserProfileIds().contains(senderUserProfile.get().getId()) + && userProfileService.findUserProfile(senderUserProfile.get().getId()).isPresent(); }; model.getFilteredChatMessages().setPredicate(item -> model.getSearchPredicate().test(item) && predicate.test(item)); diff --git a/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java b/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java index 983b860016..9e42ca06cf 100644 --- a/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java +++ b/chat/src/main/java/bisq/chat/notifications/ChatNotificationService.java @@ -414,10 +414,15 @@ private void onMessageAdded(ChatChannel chatChannel, return; }*/ - // If user has set "Show offers only" in settings we mark messages as consumed + // If user has set "only offers" or "only text messages" filter we mark messages as consumed accordingly if (chatMessage instanceof BisqEasyOfferbookMessage bisqEasyOfferbookMessage) { - if (settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == bisq.settings.ChatMessageType.OFFER - && !bisqEasyOfferbookMessage.hasBisqEasyOffer()) { + boolean shouldConsumeOfferNotification = + settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == bisq.settings.ChatMessageType.TEXT + && bisqEasyOfferbookMessage.hasBisqEasyOffer(); + boolean shouldConsumeTextMsgNotification = + settingsService.getBisqEasyOfferbookMessageTypeFilter().get() == bisq.settings.ChatMessageType.OFFER + && !bisqEasyOfferbookMessage.hasBisqEasyOffer(); + if (shouldConsumeOfferNotification || shouldConsumeTextMsgNotification) { consumeNotification(chatNotification); return; } diff --git a/i18n/src/main/resources/chat.properties b/i18n/src/main/resources/chat.properties index 2421af7bf0..f437455298 100644 --- a/i18n/src/main/resources/chat.properties +++ b/i18n/src/main/resources/chat.properties @@ -251,9 +251,12 @@ chat.message.send.differentUserProfile.warn=You have used another user profile i Are you sure you want to send that message with the currently selected user profile? chat.privateChannel.changeUserProfile.warn=You are in a private chat channel which was created with user profile ''{0}''.\n\n\ You cannot change the user profile while being in that chat channel. -chat.message.send.offerOnly.warn=You have the 'Offers only' option selected. \ +chat.message.send.offerOnly.warn=You have the 'Only offers' option selected. \ Normal text messages will not be displayed in that mode.\n\n\ - Do you want to change the mode to see all messages? + Do you want to change the mode to see all activity? +chat.message.send.textMsgOnly.warn=You have the 'Only messages' option selected. \ + Offer messages will not be displayed in that mode.\n\n\ + Do you want to change the mode to see all activity? chat.message.citation.headline=Replying to: chat.message.reactionPopup=reacted with