mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
[skip ci] just check if the wallets directory exists
This commit is contained in:
parent
f377fab278
commit
5bbf703a7d
2 changed files with 4 additions and 12 deletions
|
@ -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 =>
|
||||
|
|
10
lib/di.dart
10
lib/di.dart
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue