Skip to content

Commit

Permalink
Merge pull request #4817 from chimp1984/improve-filter
Browse files Browse the repository at this point in the history
Improve filter
  • Loading branch information
ripcurlx authored Nov 18, 2020
2 parents 61c8d55 + 6d7c3ad commit 71b6259
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/bisq/core/filter/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public String toString() {
return "Filter{" +
"\n bannedOfferIds=" + bannedOfferIds +
",\n bannedNodeAddress=" + bannedNodeAddress +
",\n bannedAutoConfExplorers=" + bannedAutoConfExplorers +
",\n bannedPaymentAccounts=" + bannedPaymentAccounts +
",\n bannedCurrencies=" + bannedCurrencies +
",\n bannedPaymentMethods=" + bannedPaymentMethods +
Expand All @@ -365,12 +366,12 @@ public String toString() {
",\n mediators=" + mediators +
",\n refundAgents=" + refundAgents +
",\n bannedAccountWitnessSignerPubKeys=" + bannedAccountWitnessSignerPubKeys +
",\n bannedPrivilegedDevPubKeys=" + bannedPrivilegedDevPubKeys +
",\n btcFeeReceiverAddresses=" + btcFeeReceiverAddresses +
",\n creationDate=" + creationDate +
",\n bannedPrivilegedDevPubKeys=" + bannedPrivilegedDevPubKeys +
",\n extraDataMap=" + extraDataMap +
",\n ownerPubKey=" + ownerPubKey +
",\n disableAutoConf=" + disableAutoConf +
",\n bannedAutoConfExplorers=" + bannedAutoConfExplorers +
"\n}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import bisq.core.filter.PaymentAccountFilter;
import bisq.core.locale.Res;

import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.config.Config;

Expand Down Expand Up @@ -223,12 +224,16 @@ private void addContent() {
);

// We remove first the old filter
// We delay a bit with adding as it seems that the instant add/remove calls lead to issues that the
// remove msg was rejected (P2P storage should handle it but seems there are edge cases where its not
// working as expected)
if (filterManager.canRemoveDevFilter(privKeyString)) {
filterManager.removeDevFilter(privKeyString);
UserThread.runAfter(() -> addDevFilter(removeFilterMessageButton, privKeyString, newFilter),
5);
} else {
addDevFilter(removeFilterMessageButton, privKeyString, newFilter);
}
filterManager.addDevFilter(newFilter, privKeyString);
removeFilterMessageButton.setDisable(filterManager.getDevFilter() == null);
hide();
} else {
new Popup().warning(Res.get("shared.invalidKey")).onClose(this::blurAgain).show();
}
Expand Down Expand Up @@ -258,6 +263,12 @@ private void addContent() {
GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}

private void addDevFilter(Button removeFilterMessageButton, String privKeyString, Filter newFilter) {
filterManager.addDevFilter(newFilter, privKeyString);
removeFilterMessageButton.setDisable(filterManager.getDevFilter() == null);
hide();
}

private void setupFieldFromList(InputTextField field, List<String> values) {
if (values != null)
field.setText(String.join(", ", values));
Expand Down

0 comments on commit 71b6259

Please sign in to comment.