Skip to content

Commit

Permalink
Remove hide user messages option
Browse files Browse the repository at this point in the history
  • Loading branch information
axpoems committed Jun 4, 2024
1 parent f70356c commit a21ad7d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public final class BisqEasyOfferbookController extends ChatController<BisqEasyOf
private final FavouriteMarketsService favouriteMarketsService;
private final BisqEasyOfferbookModel bisqEasyOfferbookModel;
private final SetChangeListener<Market> favouriteMarketsListener;
private Pin offerOnlySettingsPin, bisqEasyPrivateTradeChatChannelsPin, selectedChannelPin,
marketPriceByCurrencyMapPin, favouriteMarketsPin, offerMessagesPin, showBuyOffersPin,
showOfferListExpandedSettingsPin, showMarketSelectionListCollapsedSettingsPin;
private Pin bisqEasyPrivateTradeChatChannelsPin, selectedChannelPin, marketPriceByCurrencyMapPin,
favouriteMarketsPin, offerMessagesPin, showBuyOffersPin, showOfferListExpandedSettingsPin,
showMarketSelectionListCollapsedSettingsPin;
private Subscription marketSelectorSearchPin, selectedMarketFilterPin, selectedMarketSortTypePin,
showBuyOffersFromModelPin;

Expand Down Expand Up @@ -127,7 +127,6 @@ public void onActivate() {

model.getMarketSelectorSearchText().set("");

offerOnlySettingsPin = FxBindings.bindBiDir(model.getOfferOnly()).to(settingsService.getOffersOnly());
showBuyOffersPin = FxBindings.bindBiDir(model.getShowBuyOffers()).to(settingsService.getShowBuyOffers());
showOfferListExpandedSettingsPin = FxBindings.bindBiDir(model.getShowOfferListExpanded()).to(settingsService.getShowOfferListExpanded());
showMarketSelectionListCollapsedSettingsPin = FxBindings.bindBiDir(model.getShowMarketSelectionListCollapsed())
Expand Down Expand Up @@ -231,7 +230,6 @@ public void onDeactivate() {
offerMessagesPin.unbind();
}

offerOnlySettingsPin.unbind();
showBuyOffersPin.unbind();
showOfferListExpandedSettingsPin.unbind();
showMarketSelectionListCollapsedSettingsPin.unbind();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
@Slf4j
@Getter
public final class BisqEasyOfferbookModel extends ChatModel {
private final BooleanProperty offerOnly = new SimpleBooleanProperty();
private final BooleanProperty isTradeChannelVisible = new SimpleBooleanProperty();
private final BooleanProperty shouldShowAppliedFilters = new SimpleBooleanProperty();
private final ObservableList<MarketChannelItem> marketChannelItems = FXCollections.observableArrayList(p -> new Observable[]{p.getNumOffers()});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public final class BisqEasyOfferbookView extends ChatView<BisqEasyOfferbookView,
private SortAndFilterMarketsDropdownMenuItem<MarketSortType> sortByMostOffers, sortByNameAZ, sortByNameZA;
private SortAndFilterMarketsDropdownMenuItem<MarketFilter> filterShowAll, filterWithOffers, filterFavourites;
private DropdownMenuItem buyFromOffers, sellToOffers;
private CheckBox hideUserMessagesCheckbox;
private Label channelHeaderIcon, marketPrice, removeWithOffersFilter, removeFavouritesFilter,
offerListByDirectionFilter, collapsedOfferListTitle, offerListTitle, collapsedMarketSelectionListTitle,
marketSelectionListTitle;
Expand Down Expand Up @@ -137,7 +136,6 @@ protected void onViewAttached() {
favouritesTableView.initialize();
marketsTableView.initialize();

hideUserMessagesCheckbox.selectedProperty().bindBidirectional(getModel().getOfferOnly());
marketSelectorSearchBox.textProperty().bindBidirectional(getModel().getMarketSelectorSearchText());
marketPrice.textProperty().bind(getModel().getMarketPrice());
withOffersDisplayHint.visibleProperty().bind(getModel().getSelectedMarketsFilter().isEqualTo(MarketFilter.WITH_OFFERS));
Expand Down Expand Up @@ -247,7 +245,6 @@ protected void onViewDetached() {
marketsTableView.dispose();
favouritesTableView.dispose();

hideUserMessagesCheckbox.selectedProperty().unbindBidirectional(getModel().getOfferOnly());
marketSelectorSearchBox.textProperty().unbindBidirectional(getModel().getMarketSelectorSearchText());
marketPrice.textProperty().unbind();
withOffersDisplayHint.visibleProperty().unbind();
Expand Down Expand Up @@ -517,14 +514,8 @@ private void addChatBox() {
centerVBox.setSpacing(0);
centerVBox.setFillWidth(true);

Label label = new Label(Res.get("bisqEasy.topPane.filter.hideUserMessages"));
hideUserMessagesCheckbox = new CheckBox();
HBox hideUserMessagesHBox = new HBox(5, label, hideUserMessagesCheckbox);
hideUserMessagesHBox.getStyleClass().add("offerbook-subheader-checkbox");
hideUserMessagesHBox.setAlignment(Pos.CENTER);

searchBox.getStyleClass().add("offerbook-search-box");
HBox subheaderContent = new HBox(30, searchBox, Spacer.fillHBox(), hideUserMessagesHBox);
HBox subheaderContent = new HBox(30, searchBox, Spacer.fillHBox());
subheaderContent.getStyleClass().add("offerbook-subheader-content");
HBox.setHgrow(subheaderContent, Priority.ALWAYS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,6 @@ private void doSendMessage(String text) {
}

if (chatChannel instanceof BisqEasyOfferbookChannel) {
String dontShowAgainId = "sendMsgOfferOnlyWarn";
if (settingsService.getOffersOnly().get()) {
new Popup().information(Res.get("chat.message.send.offerOnly.warn"))
.actionButtonText(Res.get("confirmation.yes"))
.onAction(() -> settingsService.getOffersOnly().set(false))
.closeButtonText(Res.get("confirmation.no"))
.dontShowAgainId(dontShowAgainId)
.show();
}
chatService.getBisqEasyOfferbookChannelService().publishChatMessage(text, citation, (BisqEasyOfferbookChannel) chatChannel, userIdentity);
} else if (chatChannel instanceof BisqEasyOpenTradeChannel) {
if (settingsService.getTradeRulesConfirmed().get() || ((BisqEasyOpenTradeChannel) chatChannel).isMediator()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class ChatMessagesListController implements bisq.desktop.common.view.Cont
private final Optional<ResendMessageService> resendMessageService;
private final BisqEasyService bisqEasyService;
private final MarketPriceService marketPriceService;
private Pin selectedChannelPin, chatMessagesPin, offerOnlySettingsPin;
private Pin selectedChannelPin, chatMessagesPin;
private Subscription selectedChannelSubscription, focusSubscription, scrollValuePin, scrollBarVisiblePin,
layoutChildrenDonePin;

Expand Down Expand Up @@ -125,8 +125,6 @@ public ChatMessagesListController(ServiceProvider serviceProvider,
public void onActivate() {
model.getSortedChatMessages().setComparator(ChatMessageListItem::compareTo);

offerOnlySettingsPin = FxBindings.subscribe(settingsService.getOffersOnly(), offerOnly -> UIThread.run(this::applyPredicate));

if (selectedChannelPin != null) {
selectedChannelPin.unbind();
}
Expand Down Expand Up @@ -156,9 +154,6 @@ public void onActivate() {

@Override
public void onDeactivate() {
if (offerOnlySettingsPin != null) {
offerOnlySettingsPin.unbind();
}
if (selectedChannelPin != null) {
selectedChannelPin.unbind();
selectedChannelPin = null;
Expand Down Expand Up @@ -547,7 +542,6 @@ private void createAndSelectTwoPartyPrivateChatChannel(UserProfile peer) {
}

private void applyPredicate() {
boolean offerOnly = settingsService.getOffersOnly().get();
Predicate<ChatMessageListItem<? extends ChatMessage, ? extends ChatChannel<? extends ChatMessage>>> predicate = item -> {
Optional<UserProfile> senderUserProfile = item.getSenderUserProfile();
if (senderUserProfile.isEmpty()) {
Expand All @@ -557,20 +551,13 @@ private void applyPredicate() {
bannedUserService.isUserProfileBanned(senderUserProfile.get())) {
return false;
}

boolean offerOnlyPredicate = true;
if (item.getChatMessage() instanceof BisqEasyOfferbookMessage) {
BisqEasyOfferbookMessage bisqEasyOfferbookMessage = (BisqEasyOfferbookMessage) item.getChatMessage();
offerOnlyPredicate = !offerOnly || 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()) &&
return !userProfileService.getIgnoredUserProfileIds().contains(senderUserProfile.get().getId()) &&
userProfileService.findUserProfile(senderUserProfile.get().getId()).isPresent();
};
model.getFilteredChatMessages().setPredicate(item -> model.getSearchPredicate().test(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class PreferencesController implements Controller {
private final MinRequiredReputationScoreService minRequiredReputationScoreService;
private final DontShowAgainService dontShowAgainService;

private Pin chatNotificationTypePin, useAnimationsPin, preventStandbyModePin, offerOnlyPin, closeMyOfferWhenTakenPin,
private Pin chatNotificationTypePin, useAnimationsPin, preventStandbyModePin, closeMyOfferWhenTakenPin,
supportedLanguageCodesPin, minRequiredReputationScorePin, ignoreDiffAdjustmentFromSecManagerPin,
mostRecentDifficultyAdjustmentFactorOrDefaultPin, difficultyAdjustmentFactorPin, ignoreMinRequiredReputationScoreFromSecManagerPin,
mostRecentMinRequiredReputationScoreOrDefaultPin, maxTradePriceDeviationPin;
Expand Down Expand Up @@ -103,8 +103,6 @@ public void onActivate() {
}
});

offerOnlyPin = FxBindings.bindBiDir(model.getOfferOnly())
.to(settingsService.getOffersOnly());
closeMyOfferWhenTakenPin = FxBindings.bindBiDir(model.getCloseMyOfferWhenTaken())
.to(settingsService.getCloseMyOfferWhenTaken());
supportedLanguageCodesPin = FxBindings.<String, String>bind(model.getSelectedSupportedLanguageCodes())
Expand Down Expand Up @@ -156,7 +154,6 @@ public void onActivate() {
public void onDeactivate() {
chatNotificationTypePin.unbind();
useAnimationsPin.unbind();
offerOnlyPin.unbind();
closeMyOfferWhenTakenPin.unbind();
preventStandbyModePin.unbind();
supportedLanguageCodesPin.unbind();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@

import bisq.desktop.common.view.Model;
import bisq.settings.ChatNotificationType;
import javafx.beans.property.*;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.LongProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleLongProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
Expand All @@ -41,7 +50,6 @@ public class PreferencesModel implements Model {
private final BooleanProperty minRequiredReputationScoreEditable = new SimpleBooleanProperty();
private final StringProperty minRequiredReputationScoreDescriptionText = new SimpleStringProperty();
private final BooleanProperty ignoreMinRequiredReputationScoreFromSecManager = new SimpleBooleanProperty();
private final BooleanProperty offerOnly = new SimpleBooleanProperty();
private final BooleanProperty closeMyOfferWhenTaken = new SimpleBooleanProperty();
private final DoubleProperty difficultyAdjustmentFactor = new SimpleDoubleProperty();
private final BooleanProperty difficultyAdjustmentFactorEditable = new SimpleBooleanProperty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class PreferencesView extends View<VBox, PreferencesModel, PreferencesCon
private static final double TEXT_FIELD_WIDTH = 500;

private final Button resetDontShowAgain, clearNotifications, addLanguageButton;
private final Switch useAnimations, preventStandbyMode, offersOnlySwitch, closeMyOfferWhenTaken, notifyForPreRelease,
private final Switch useAnimations, preventStandbyMode, closeMyOfferWhenTaken, notifyForPreRelease,
useTransientNotifications, ignoreDiffAdjustFromSecManagerSwitch,
ignoreMinRequiredReputationScoreFromSecManagerSwitch;
private final ToggleGroup notificationsToggleGroup = new ToggleGroup();
Expand Down Expand Up @@ -197,7 +197,6 @@ public String fromString(String string) {
Label tradeHeadline = new Label(Res.get("settings.preferences.trade.headline"));
tradeHeadline.getStyleClass().add("large-thin-headline");

offersOnlySwitch = new Switch(Res.get("bisqEasy.topPane.filter.offersOnly"));
closeMyOfferWhenTaken = new Switch(Res.get("settings.preferences.trade.closeMyOfferWhenTaken"));

maxTradePriceDeviation = new MaterialTextField(Res.get("settings.preferences.trade.maxTradePriceDeviation"),
Expand All @@ -215,7 +214,6 @@ public String fromString(String string) {

VBox tradeVBox = new VBox(10,
closeMyOfferWhenTaken,
offersOnlySwitch,
maxTradePriceDeviation,
minRequiredReputationScore, ignoreMinRequiredReputationScoreFromSecManagerSwitch
);
Expand Down Expand Up @@ -261,7 +259,6 @@ protected void onViewAttached() {
useTransientNotifications.setManaged(model.isUseTransientNotificationsVisible());
useAnimations.selectedProperty().bindBidirectional(model.getUseAnimations());
preventStandbyMode.selectedProperty().bindBidirectional(model.getPreventStandbyMode());
offersOnlySwitch.selectedProperty().bindBidirectional(model.getOfferOnly());
ignoreDiffAdjustFromSecManagerSwitch.selectedProperty().bindBidirectional(model.getIgnoreDiffAdjustmentFromSecManager());
ignoreMinRequiredReputationScoreFromSecManagerSwitch.selectedProperty().bindBidirectional(model.getIgnoreMinRequiredReputationScoreFromSecManager());
closeMyOfferWhenTaken.selectedProperty().bindBidirectional(model.getCloseMyOfferWhenTaken());
Expand Down Expand Up @@ -322,7 +319,6 @@ protected void onViewDetached() {
useTransientNotifications.selectedProperty().unbindBidirectional(model.getUseTransientNotifications());
useAnimations.selectedProperty().unbindBidirectional(model.getUseAnimations());
preventStandbyMode.selectedProperty().unbindBidirectional(model.getPreventStandbyMode());
offersOnlySwitch.selectedProperty().unbindBidirectional(model.getOfferOnly());
ignoreDiffAdjustFromSecManagerSwitch.selectedProperty().unbindBidirectional(model.getIgnoreDiffAdjustmentFromSecManager());
ignoreMinRequiredReputationScoreFromSecManagerSwitch.selectedProperty().unbindBidirectional(model.getIgnoreMinRequiredReputationScoreFromSecManager());
closeMyOfferWhenTaken.selectedProperty().unbindBidirectional(model.getCloseMyOfferWhenTaken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import bisq.chat.*;
import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookChannel;
import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookChannelService;
import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookMessage;
import bisq.chat.bisqeasy.open_trades.BisqEasyOpenTradeChannel;
import bisq.chat.bisqeasy.open_trades.BisqEasyOpenTradeChannelService;
import bisq.chat.bisqeasy.open_trades.BisqEasyOpenTradeMessage;
Expand Down Expand Up @@ -317,15 +316,6 @@ private <M extends ChatMessage> void onMessageAdded(ChatChannel<M> chatChannel,
return;
}

// If user has set "Show offers only" in settings we mark messages as consumed
if (chatMessage instanceof BisqEasyOfferbookMessage) {
BisqEasyOfferbookMessage bisqEasyOfferbookMessage = (BisqEasyOfferbookMessage) chatMessage;
if (settingsService.getOffersOnly().get() && !bisqEasyOfferbookMessage.hasBisqEasyOffer()) {
consumeNotification(chatNotification);
return;
}
}

ChatChannelNotificationType notificationType = chatChannel.getChatChannelNotificationType().get();
if (notificationType == ChatChannelNotificationType.GLOBAL_DEFAULT) {
notificationType = ChatChannelNotificationType.fromChatNotificationType(settingsService.getChatNotificationType().get());
Expand Down
2 changes: 0 additions & 2 deletions i18n/src/main/resources/bisq_easy.properties
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,6 @@ bisqEasy.topPane.filter=Filter offerbook
# Commented out in code
# suppress inspection "UnusedProperty"
bisqEasy.topPane.closeFilter=Close filter
bisqEasy.topPane.filter.offersOnly=Show offers only
bisqEasy.topPane.filter.hideUserMessages=Hide user messages


################################################################################
Expand Down
3 changes: 0 additions & 3 deletions i18n/src/main/resources/chat.properties
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ 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. \
Normal text messages will not be displayed in that mode.\n\n\
Do you want to change the mode to see all messages?

chat.message.citation.headline=Replying to:
chat.listView.scrollDown=Scroll down
Expand Down

0 comments on commit a21ad7d

Please sign in to comment.