mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
fix no recent wallets issue
This commit is contained in:
parent
b2d85b6c78
commit
78afc5e4d5
1 changed files with 12 additions and 10 deletions
|
@ -27,17 +27,19 @@ public class MasterActionListBox extends ActionListBox {
|
||||||
addItem("Wallets", () -> {
|
addItem("Wallets", () -> {
|
||||||
ActionListDialogBuilder builder = new ActionListDialogBuilder();
|
ActionListDialogBuilder builder = new ActionListDialogBuilder();
|
||||||
builder.setTitle("Wallets");
|
builder.setTitle("Wallets");
|
||||||
for(int i = 0; i < Config.get().getRecentWalletFiles().size() && i < MAX_RECENT_WALLETS; i++) {
|
if(Config.get().getRecentWalletFiles() != null) {
|
||||||
File recentWalletFile = Config.get().getRecentWalletFiles().get(i);
|
for(int i = 0; i < Config.get().getRecentWalletFiles().size() && i < MAX_RECENT_WALLETS; i++) {
|
||||||
Storage storage = new Storage(recentWalletFile);
|
File recentWalletFile = Config.get().getRecentWalletFiles().get(i);
|
||||||
|
Storage storage = new Storage(recentWalletFile);
|
||||||
|
|
||||||
Optional<Wallet> optWallet = AppServices.get().getOpenWallets().entrySet().stream()
|
Optional<Wallet> optWallet = AppServices.get().getOpenWallets().entrySet().stream()
|
||||||
.filter(entry -> entry.getValue().getWalletFile().equals(recentWalletFile)).map(Map.Entry::getKey)
|
.filter(entry -> entry.getValue().getWalletFile().equals(recentWalletFile)).map(Map.Entry::getKey)
|
||||||
.map(wallet -> wallet.isMasterWallet() ? wallet : wallet.getMasterWallet()).findFirst();
|
.map(wallet -> wallet.isMasterWallet() ? wallet : wallet.getMasterWallet()).findFirst();
|
||||||
if(optWallet.isPresent()) {
|
if(optWallet.isPresent()) {
|
||||||
builder.addAction(storage.getWalletName(null) + "*", () -> LoadWallet.getOpeningDialog(optWallet.get()).showDialog(SparrowTerminal.get().getGui()));
|
builder.addAction(storage.getWalletName(null) + "*", () -> LoadWallet.getOpeningDialog(optWallet.get()).showDialog(SparrowTerminal.get().getGui()));
|
||||||
} else {
|
} else {
|
||||||
builder.addAction(storage.getWalletName(null), new LoadWallet(storage));
|
builder.addAction(storage.getWalletName(null), new LoadWallet(storage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.addAction("Open Wallet...", () -> {
|
builder.addAction("Open Wallet...", () -> {
|
||||||
|
|
Loading…
Reference in a new issue