[skip ci] just check if the wallets directory exists

This commit is contained in:
fossephate 2024-11-04 13:04:38 -08:00
parent f377fab278
commit 5bbf703a7d
2 changed files with 4 additions and 12 deletions

View file

@ -16,12 +16,10 @@ Future<String> pathForWalletDir({required String name, required WalletType type
return walletDire.path;
}
Future<bool> walletTypeDirExists({required WalletType type}) async {
Future<bool> walletsDirExists() async {
final root = await getAppDir();
final prefix = walletTypeToString(type).toLowerCase();
final walletsDir = Directory('${root.path}/wallets');
final walletDire = Directory('${walletsDir.path}/$prefix');
return walletDire.existsSync();
return walletsDir.existsSync();
}
Future<String> pathForWallet({required String name, required WalletType type}) async =>

View file

@ -345,15 +345,9 @@ Future<void> setup({
getIt.registerSingleton<SeedSettingsStore>(SeedSettingsStore());
getIt.registerLazySingleton(() => LedgerViewModel());
bool noWalletsExist = true;
for (final type in WalletType.values) {
if (await walletTypeDirExists(type: type)) {
noWalletsExist = false;
}
}
// if no wallets exist, delete all the secure storage keys:
if (noWalletsExist) {
if (!(await walletsDirExists())) {
await secureStorage.deleteAll();
}