mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
fix long specter desktop keystore labels
This commit is contained in:
parent
22b7b659f3
commit
4c817d243d
1 changed files with 10 additions and 2 deletions
|
@ -62,11 +62,11 @@ public class SpecterDesktop implements WalletImport, WalletExport {
|
||||||
wallet.setName(specterWallet.label);
|
wallet.setName(specterWallet.label);
|
||||||
|
|
||||||
if(specterWallet.devices != null && specterWallet.devices.size() == wallet.getKeystores().size()) {
|
if(specterWallet.devices != null && specterWallet.devices.size() == wallet.getKeystores().size()) {
|
||||||
boolean uniqueLabels = specterWallet.devices.stream().map(d -> d.label).distinct().count() == specterWallet.devices.size();
|
boolean uniqueLabels = specterWallet.devices.stream().map(SpecterWalletDevice::getLabel).distinct().count() == specterWallet.devices.size();
|
||||||
for(int i = 0; i < specterWallet.devices.size(); i++) {
|
for(int i = 0; i < specterWallet.devices.size(); i++) {
|
||||||
SpecterWalletDevice device = specterWallet.devices.get(i);
|
SpecterWalletDevice device = specterWallet.devices.get(i);
|
||||||
Keystore keystore = wallet.getKeystores().get(i);
|
Keystore keystore = wallet.getKeystores().get(i);
|
||||||
keystore.setLabel(device.label + (uniqueLabels ? "" : " " + i));
|
keystore.setLabel(device.getLabel() + (uniqueLabels ? "" : " " + i));
|
||||||
|
|
||||||
WalletModel walletModel = device.getWalletModel();
|
WalletModel walletModel = device.getWalletModel();
|
||||||
if(walletModel != null) {
|
if(walletModel != null) {
|
||||||
|
@ -161,5 +161,13 @@ public class SpecterDesktop implements WalletImport, WalletExport {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
if(label == null) {
|
||||||
|
label = "Keystore";
|
||||||
|
}
|
||||||
|
|
||||||
|
return label.length() > Keystore.MAX_LABEL_LENGTH - 3 ? label.substring(0, Keystore.MAX_LABEL_LENGTH - 3) : label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue