mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
fix(cw_monero): prevent monero wallet from breaking during rename (#2214)
* fix(cw_monero): prevent monero wallet from breaking during rename * update to cleaned up monero.dart * fix: transaction screen not refreshing in monero * fix: wallets not opening until app restart after rename. * fix(cw_decred): wallet renaming throwing * fix: transaction not being shown after sending until 1st confirmation * fix(cw_monero): loop safeguard * fix: don't await wallet.fetchTransactions
This commit is contained in:
parent
dd8413bae2
commit
a2294c4a06
25 changed files with 577 additions and 714 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:cw_core/exceptions.dart';
|
||||
import 'package:cw_core/transaction_direction.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
|
@ -602,7 +603,25 @@ abstract class DecredWalletBase
|
|||
throw "wallet already exists at $newDirPath";
|
||||
}
|
||||
|
||||
await Directory(currentDirPath).rename(newDirPath);
|
||||
final sourceDir = Directory(currentDirPath);
|
||||
final targetDir = Directory(newDirPath);
|
||||
|
||||
if (!targetDir.existsSync()) {
|
||||
await targetDir.create(recursive: true);
|
||||
}
|
||||
|
||||
await for (final entity in sourceDir.list(recursive: true)) {
|
||||
final relativePath = entity.path.substring(sourceDir.path.length+1);
|
||||
final targetPath = p.join(targetDir.path, relativePath);
|
||||
|
||||
if (entity is File) {
|
||||
await entity.rename(targetPath);
|
||||
} else if (entity is Directory) {
|
||||
await Directory(targetPath).create(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
await sourceDir.delete(recursive: true);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -118,6 +118,10 @@ class DecredWalletService extends WalletService<
|
|||
currentWalletInfo.derivationInfo?.derivationPath == pubkeyRestorePathTestnet
|
||||
? testnet
|
||||
: mainnet;
|
||||
if (libwallet == null) {
|
||||
libwallet = await Libwallet.spawn();
|
||||
libwallet!.initLibdcrwallet("", "err");
|
||||
}
|
||||
final currentWallet = DecredWallet(
|
||||
currentWalletInfo, password, this.unspentCoinsInfoSource, libwallet!, closeLibwallet);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue