add walletconfig

This commit is contained in:
Craig Raw 2022-11-14 10:59:33 +02:00
parent 7c34ec7c3b
commit fa18ec9d45
2 changed files with 63 additions and 0 deletions

View file

@ -38,6 +38,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
private final TreeSet<WalletNode> purposeNodes = new TreeSet<>();
private final Map<Sha256Hash, BlockTransaction> transactions = new HashMap<>();
private final Map<String, String> detachedLabels = new HashMap<>();
private WalletConfig walletConfig;
private MixConfig mixConfig;
private final Map<Sha256Hash, UtxoMixData> utxoMixes = new HashMap<>();
private Integer storedBlockHeight;
@ -441,6 +442,26 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
return detachedLabels;
}
public WalletConfig getWalletConfig() {
return walletConfig;
}
public WalletConfig getMasterWalletConfig() {
if(!isMasterWallet()) {
return getMasterWallet().getMasterWalletConfig();
}
if(walletConfig == null) {
walletConfig = new WalletConfig();
}
return walletConfig;
}
public void setWalletConfig(WalletConfig walletConfig) {
this.walletConfig = walletConfig;
}
public MixConfig getMixConfig() {
return mixConfig;
}
@ -1805,6 +1826,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
for(String entry : detachedLabels.keySet()) {
copy.detachedLabels.put(entry, detachedLabels.get(entry));
}
copy.setWalletConfig(walletConfig == null ? null : walletConfig.copy());
copy.setMixConfig(mixConfig == null ? null : mixConfig.copy());
for(Sha256Hash hash : utxoMixes.keySet()) {
copy.utxoMixes.put(hash, utxoMixes.get(hash));

View file

@ -0,0 +1,41 @@
package com.sparrowwallet.drongo.wallet;
public class WalletConfig extends Persistable {
private byte[] iconData;
private boolean userIcon;
private boolean usePayNym;
public WalletConfig() {
}
public WalletConfig(byte[] iconData, boolean userIcon, boolean usePayNym) {
this.iconData = iconData;
this.userIcon = userIcon;
this.usePayNym = usePayNym;
}
public byte[] getIconData() {
return iconData;
}
public boolean isUserIcon() {
return userIcon;
}
public void setIconData(byte[] iconData, boolean userIcon) {
this.iconData = iconData;
this.userIcon = userIcon;
}
public boolean isUsePayNym() {
return usePayNym;
}
public void setUsePayNym(boolean usePayNym) {
this.usePayNym = usePayNym;
}
public WalletConfig copy() {
return new WalletConfig(iconData, userIcon, usePayNym);
}
}