Skip to content

Commit

Permalink
delay show password dialog until initial app window open has completed
Browse files Browse the repository at this point in the history
  • Loading branch information
craigraw committed Sep 6, 2024
1 parent e131f64 commit 31f2871
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/main/java/com/sparrowwallet/sparrow/SparrowDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,31 @@ public void start(Stage stage) throws Exception {

AppController appController = AppServices.newAppWindow(stage);

if(createNewWallet) {
appController.newWallet(null);
}
final boolean showNewWallet = createNewWallet;
javafx.application.Platform.runLater(() -> {
if(showNewWallet) {
appController.newWallet(null);
}

List<File> recentWalletFiles = Config.get().getRecentWalletFiles();
if(recentWalletFiles != null) {
//Preserve wallet order as far as possible. Unencrypted wallets will still be opened first.
List<File> encryptedWalletFiles = recentWalletFiles.stream().filter(Storage::isEncrypted).collect(Collectors.toList());
List<File> sortedWalletFiles = new ArrayList<>(recentWalletFiles);
sortedWalletFiles.removeAll(encryptedWalletFiles);
sortedWalletFiles.addAll(encryptedWalletFiles);

for(File walletFile : sortedWalletFiles) {
if(walletFile.exists()) {
appController.openWalletFile(walletFile, false);
List<File> recentWalletFiles = Config.get().getRecentWalletFiles();
if(recentWalletFiles != null) {
//Preserve wallet order as far as possible. Unencrypted wallets will still be opened first.
List<File> encryptedWalletFiles = recentWalletFiles.stream().filter(Storage::isEncrypted).collect(Collectors.toList());
List<File> sortedWalletFiles = new ArrayList<>(recentWalletFiles);
sortedWalletFiles.removeAll(encryptedWalletFiles);
sortedWalletFiles.addAll(encryptedWalletFiles);

for(File walletFile : sortedWalletFiles) {
if(walletFile.exists()) {
appController.openWalletFile(walletFile, false);
}
}
}
}

AppServices.openFileUriArgumentsAfterWalletLoading(stage);
AppServices.openFileUriArgumentsAfterWalletLoading(stage);

AppServices.get().start();
AppServices.get().start();
});
}

@Override
Expand Down

0 comments on commit 31f2871

Please sign in to comment.