mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
show info dialog when no new accounts are discovered
This commit is contained in:
parent
13a3ce23e7
commit
af23f063f2
1 changed files with 16 additions and 6 deletions
|
@ -484,6 +484,9 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
ElectrumServer.WalletDiscoveryService walletDiscoveryService = new ElectrumServer.WalletDiscoveryService(masterWallet, standardAccounts);
|
ElectrumServer.WalletDiscoveryService walletDiscoveryService = new ElectrumServer.WalletDiscoveryService(masterWallet, standardAccounts);
|
||||||
walletDiscoveryService.setOnSucceeded(event -> {
|
walletDiscoveryService.setOnSucceeded(event -> {
|
||||||
addAndEncryptAccounts(masterWallet, walletDiscoveryService.getValue(), key);
|
addAndEncryptAccounts(masterWallet, walletDiscoveryService.getValue(), key);
|
||||||
|
if(walletDiscoveryService.getValue().isEmpty()) {
|
||||||
|
AppServices.showAlertDialog("No Accounts Found", "No new accounts with existing transactions were found.", Alert.AlertType.INFORMATION, ButtonType.OK);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
walletDiscoveryService.setOnFailed(event -> {
|
walletDiscoveryService.setOnFailed(event -> {
|
||||||
log.error("Failed to discover accounts", event.getSource().getException());
|
log.error("Failed to discover accounts", event.getSource().getException());
|
||||||
|
@ -514,6 +517,9 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
ElectrumServer.WalletDiscoveryService walletDiscoveryService = new ElectrumServer.WalletDiscoveryService(masterWallet, standardAccounts);
|
ElectrumServer.WalletDiscoveryService walletDiscoveryService = new ElectrumServer.WalletDiscoveryService(masterWallet, standardAccounts);
|
||||||
walletDiscoveryService.setOnSucceeded(event -> {
|
walletDiscoveryService.setOnSucceeded(event -> {
|
||||||
addAndSaveAccounts(masterWallet, walletDiscoveryService.getValue());
|
addAndSaveAccounts(masterWallet, walletDiscoveryService.getValue());
|
||||||
|
if(walletDiscoveryService.getValue().isEmpty()) {
|
||||||
|
AppServices.showAlertDialog("No Accounts Found", "No new accounts with existing transactions were found.", Alert.AlertType.INFORMATION, ButtonType.OK);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
walletDiscoveryService.setOnFailed(event -> {
|
walletDiscoveryService.setOnFailed(event -> {
|
||||||
log.error("Failed to discover accounts", event.getSource().getException());
|
log.error("Failed to discover accounts", event.getSource().getException());
|
||||||
|
@ -531,6 +537,9 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
Optional<Map<StandardAccount, Keystore>> optDiscoveredKeystores = deviceKeystoreDiscoverDialog.showAndWait();
|
Optional<Map<StandardAccount, Keystore>> optDiscoveredKeystores = deviceKeystoreDiscoverDialog.showAndWait();
|
||||||
if(optDiscoveredKeystores.isPresent()) {
|
if(optDiscoveredKeystores.isPresent()) {
|
||||||
Map<StandardAccount, Keystore> discoveredKeystores = optDiscoveredKeystores.get();
|
Map<StandardAccount, Keystore> discoveredKeystores = optDiscoveredKeystores.get();
|
||||||
|
if(discoveredKeystores.isEmpty()) {
|
||||||
|
AppServices.showAlertDialog("No Accounts Found", "No new accounts with existing transactions were found.", Alert.AlertType.INFORMATION, ButtonType.OK);
|
||||||
|
} else {
|
||||||
for(Map.Entry<StandardAccount, Keystore> entry : discoveredKeystores.entrySet()) {
|
for(Map.Entry<StandardAccount, Keystore> entry : discoveredKeystores.entrySet()) {
|
||||||
Wallet childWallet = masterWallet.addChildWallet(entry.getKey());
|
Wallet childWallet = masterWallet.addChildWallet(entry.getKey());
|
||||||
childWallet.getKeystores().clear();
|
childWallet.getKeystores().clear();
|
||||||
|
@ -539,6 +548,7 @@ public class SettingsController extends WalletFormController implements Initiali
|
||||||
}
|
}
|
||||||
saveChildWallets(masterWallet);
|
saveChildWallets(masterWallet);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for(StandardAccount standardAccount : standardAccounts) {
|
for(StandardAccount standardAccount : standardAccounts) {
|
||||||
Wallet childWallet = masterWallet.addChildWallet(standardAccount);
|
Wallet childWallet = masterWallet.addChildWallet(standardAccount);
|
||||||
|
|
Loading…
Reference in a new issue