Skip to content

Commit 31f2871

Browse files
committed
delay show password dialog until initial app window open has completed
1 parent e131f64 commit 31f2871

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/main/java/com/sparrowwallet/sparrow/SparrowDesktop.java

+20-17
Original file line numberDiff line numberDiff line change
@@ -89,28 +89,31 @@ public void start(Stage stage) throws Exception {
8989

9090
AppController appController = AppServices.newAppWindow(stage);
9191

92-
if(createNewWallet) {
93-
appController.newWallet(null);
94-
}
92+
final boolean showNewWallet = createNewWallet;
93+
javafx.application.Platform.runLater(() -> {
94+
if(showNewWallet) {
95+
appController.newWallet(null);
96+
}
9597

96-
List<File> recentWalletFiles = Config.get().getRecentWalletFiles();
97-
if(recentWalletFiles != null) {
98-
//Preserve wallet order as far as possible. Unencrypted wallets will still be opened first.
99-
List<File> encryptedWalletFiles = recentWalletFiles.stream().filter(Storage::isEncrypted).collect(Collectors.toList());
100-
List<File> sortedWalletFiles = new ArrayList<>(recentWalletFiles);
101-
sortedWalletFiles.removeAll(encryptedWalletFiles);
102-
sortedWalletFiles.addAll(encryptedWalletFiles);
103-
104-
for(File walletFile : sortedWalletFiles) {
105-
if(walletFile.exists()) {
106-
appController.openWalletFile(walletFile, false);
98+
List<File> recentWalletFiles = Config.get().getRecentWalletFiles();
99+
if(recentWalletFiles != null) {
100+
//Preserve wallet order as far as possible. Unencrypted wallets will still be opened first.
101+
List<File> encryptedWalletFiles = recentWalletFiles.stream().filter(Storage::isEncrypted).collect(Collectors.toList());
102+
List<File> sortedWalletFiles = new ArrayList<>(recentWalletFiles);
103+
sortedWalletFiles.removeAll(encryptedWalletFiles);
104+
sortedWalletFiles.addAll(encryptedWalletFiles);
105+
106+
for(File walletFile : sortedWalletFiles) {
107+
if(walletFile.exists()) {
108+
appController.openWalletFile(walletFile, false);
109+
}
107110
}
108111
}
109-
}
110112

111-
AppServices.openFileUriArgumentsAfterWalletLoading(stage);
113+
AppServices.openFileUriArgumentsAfterWalletLoading(stage);
112114

113-
AppServices.get().start();
115+
AppServices.get().start();
116+
});
114117
}
115118

116119
@Override

0 commit comments

Comments
 (0)