Remove DevEnv.isDaoActivated() from combined if statements with && as isDaoActivated is always true

In case of a `||` the statement gets removed as it always is true.
At getUserPaymentAccounts we refactor further the steam to a HashSet constructor operation as the filter method gets removed.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2022-11-03 11:04:36 -05:00
parent e8a9132d30
commit 114bda22cd
No known key found for this signature in database
GPG Key ID: 02AA2BAE387C8307
3 changed files with 4 additions and 10 deletions

View File

@ -41,15 +41,13 @@ import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.app.DevEnv;
import com.google.inject.Inject;
import javax.inject.Named;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Domain for that UI element.
@ -91,8 +89,6 @@ class CreateOfferDataModel extends MutableOfferDataModel {
@Override
protected Set<PaymentAccount> getUserPaymentAccounts() {
return Objects.requireNonNull(user.getPaymentAccounts()).stream()
.filter(account -> !account.getPaymentMethod().isBsqSwap() || DevEnv.isDaoActivated())
.collect(Collectors.toSet());
return new HashSet<>(Objects.requireNonNull(user.getPaymentAccounts()));
}
}

View File

@ -12,8 +12,6 @@ import bisq.core.dao.state.model.blockchain.Block;
import bisq.core.locale.Res;
import bisq.core.user.Preferences;
import bisq.common.app.DevEnv;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -64,7 +62,7 @@ public class DaoPresentation implements DaoStateListener {
this.daoStateService = daoStateService;
preferences.getDontShowAgainMapAsObservable().addListener((MapChangeListener<? super String, ? super Boolean>) change -> {
if (change.getKey().equals(DAO_NEWS) && DevEnv.isDaoActivated()) {
if (change.getKey().equals(DAO_NEWS)) {
// devs enable this when a news badge is required
// showNotification.set(!change.wasAdded());
showNotification.set(false);

View File

@ -1047,7 +1047,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
}
private void activateDaoPreferences() {
daoActivatedToggleButton.setSelected(DevEnv.isDaoActivated());
daoActivatedToggleButton.setSelected(true);
daoActivatedToggleButton.setOnAction(e -> {
// We do not use preferences as we need to handle the value at startup before preferences are loaded,
// so we write the option to the properties file. If the program argument is set it has higher priority