From 6768ad202878a3cda57cdc55429694cd42b8f702 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 11 Oct 2022 12:45:24 +0200 Subject: [PATCH] improve close timing of wallet loading dialog --- .../sparrow/terminal/wallet/LoadWallet.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/terminal/wallet/LoadWallet.java b/src/main/java/com/sparrowwallet/sparrow/terminal/wallet/LoadWallet.java index f4e7faf3..ce4e8d24 100644 --- a/src/main/java/com/sparrowwallet/sparrow/terminal/wallet/LoadWallet.java +++ b/src/main/java/com/sparrowwallet/sparrow/terminal/wallet/LoadWallet.java @@ -52,10 +52,7 @@ public class LoadWallet implements Runnable { loadWalletService.setExecutor(Storage.LoadWalletService.getSingleThreadedExecutor()); loadWalletService.setOnSucceeded(workerStateEvent -> { WalletAndKey walletAndKey = loadWalletService.getValue(); - SparrowTerminal.get().getGuiThread().invokeLater(() -> { - SparrowTerminal.get().getGui().removeWindow(loadingDialog); - Platform.runLater(() -> openWallet(storage, walletAndKey)); - }); + openWallet(storage, walletAndKey); }); loadWalletService.setOnFailed(workerStateEvent -> { Throwable exception = workerStateEvent.getSource().getException(); @@ -80,10 +77,7 @@ public class LoadWallet implements Runnable { loadWalletService.setOnSucceeded(workerStateEvent -> { EventManager.get().post(new StorageEvent(storage.getWalletId(null), TimedEvent.Action.END, "Done")); WalletAndKey walletAndKey = loadWalletService.getValue(); - SparrowTerminal.get().getGuiThread().invokeLater(() -> { - SparrowTerminal.get().getGui().removeWindow(loadingDialog); - Platform.runLater(() -> openWallet(storage, walletAndKey)); - }); + openWallet(storage, walletAndKey); }); loadWalletService.setOnFailed(workerStateEvent -> { EventManager.get().post(new StorageEvent(storage.getWalletId(null), TimedEvent.Action.END, "Failed")); @@ -124,7 +118,10 @@ public class LoadWallet implements Runnable { openWallet(entry.getValue(), entry.getKey()); } if(walletAndKey.getWallet().isMasterWallet()) { - SparrowTerminal.get().getGuiThread().invokeLater(() -> getOpeningDialog(walletAndKey.getWallet()).showDialog(SparrowTerminal.get().getGui())); + SparrowTerminal.get().getGuiThread().invokeLater(() -> { + SparrowTerminal.get().getGui().removeWindow(loadingDialog); + getOpeningDialog(walletAndKey.getWallet()).showDialog(SparrowTerminal.get().getGui()); + }); } } catch(Exception e) { log.error("Wallet Error", e);