Skip to content

Commit

Permalink
Merge pull request #3771 from ripcurlx/fix-dark-mode-switch-plus-cleanup
Browse files Browse the repository at this point in the history
Fixes dark mode switch after restart
  • Loading branch information
freimair authored Dec 9, 2019
2 parents a29ba3d + b2c006d commit 30f9664
Showing 1 changed file with 5 additions and 29 deletions.
34 changes: 5 additions & 29 deletions core/src/main/java/bisq/core/user/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.LongProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleLongProperty;

import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
Expand Down Expand Up @@ -126,10 +124,6 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
private final BooleanProperty useAnimationsProperty = new SimpleBooleanProperty(prefPayload.isUseAnimations());
@Getter
private final IntegerProperty cssThemeProperty = new SimpleIntegerProperty(prefPayload.getCssTheme());
@Getter
private final BooleanProperty useCustomWithdrawalTxFeeProperty = new SimpleBooleanProperty(prefPayload.isUseCustomWithdrawalTxFee());
@Getter
private final LongProperty withdrawalTxFeeInBytesProperty = new SimpleLongProperty(prefPayload.getWithdrawalTxFeeInBytes());

private final ObservableList<FiatCurrency> fiatCurrenciesAsObservable = FXCollections.observableArrayList();
private final ObservableList<CryptoCurrency> cryptoCurrenciesAsObservable = FXCollections.observableArrayList();
Expand Down Expand Up @@ -202,16 +196,6 @@ public Preferences(Storage<PreferencesPayload> storage,
persist();
});

useCustomWithdrawalTxFeeProperty.addListener((ov) -> {
prefPayload.setUseCustomWithdrawalTxFee(useCustomWithdrawalTxFeeProperty.get());
persist();
});

withdrawalTxFeeInBytesProperty.addListener((ov) -> {
prefPayload.setWithdrawalTxFeeInBytes(withdrawalTxFeeInBytesProperty.get());
persist();
});

fiatCurrenciesAsObservable.addListener(this::updateTradeCurrencies);
cryptoCurrenciesAsObservable.addListener(this::updateTradeCurrencies);
}
Expand Down Expand Up @@ -270,8 +254,7 @@ public void readPersisted() {
// set all properties
useAnimationsProperty.set(prefPayload.isUseAnimations());
useStandbyModeProperty.set(prefPayload.isUseStandbyMode());
useCustomWithdrawalTxFeeProperty.set(prefPayload.isUseCustomWithdrawalTxFee());
withdrawalTxFeeInBytesProperty.set(prefPayload.getWithdrawalTxFeeInBytes());
cssThemeProperty.set(prefPayload.getCssTheme());

tradeCurrenciesAsObservable.addAll(prefPayload.getFiatCurrencies());
tradeCurrenciesAsObservable.addAll(prefPayload.getCryptoCurrencies());
Expand Down Expand Up @@ -508,11 +491,13 @@ public void setBitcoinNodes(String bitcoinNodes) {
}

public void setUseCustomWithdrawalTxFee(boolean useCustomWithdrawalTxFee) {
useCustomWithdrawalTxFeeProperty.set(useCustomWithdrawalTxFee);
prefPayload.setUseCustomWithdrawalTxFee(useCustomWithdrawalTxFee);
persist();
}

public void setWithdrawalTxFeeInBytes(long withdrawalTxFeeInBytes) {
withdrawalTxFeeInBytesProperty.set(withdrawalTxFeeInBytes);
prefPayload.setWithdrawalTxFeeInBytes(withdrawalTxFeeInBytes);
persist();
}

public void setBuyerSecurityDepositAsPercent(double buyerSecurityDepositAsPercent, PaymentAccount paymentAccount) {
Expand Down Expand Up @@ -751,15 +736,6 @@ public boolean getUseTorForBitcoinJ() {
return prefPayload.isUseTorForBitcoinJ();
}


public BooleanProperty useCustomWithdrawalTxFeeProperty() {
return useCustomWithdrawalTxFeeProperty;
}

public LongProperty withdrawalTxFeeInBytesProperty() {
return withdrawalTxFeeInBytesProperty;
}

public double getBuyerSecurityDepositAsPercent(PaymentAccount paymentAccount) {
double value = PaymentAccountUtil.isCryptoCurrencyAccount(paymentAccount) ?
prefPayload.getBuyerSecurityDepositAsPercentForCrypto() : prefPayload.getBuyerSecurityDepositAsPercent();
Expand Down

0 comments on commit 30f9664

Please sign in to comment.