diff --git a/crypto_plugins/flutter_libepiccash b/crypto_plugins/flutter_libepiccash index f017e01b5..93af71796 160000 --- a/crypto_plugins/flutter_libepiccash +++ b/crypto_plugins/flutter_libepiccash @@ -1 +1 @@ -Subproject commit f017e01b574a77ad76b8b9c1837b333b777d7e92 +Subproject commit 93af717966758ff07220150f6d9ed77275b29b87 diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index 2801e0e2b..d6a07c3f8 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -219,43 +219,34 @@ Future _cancelTransactionWrapper(Tuple2 data) async { return cancelTransaction(data.item1, data.item2); } -Future _deleteWalletWrapper(String wallet) async { - return deleteWallet(wallet); +Future _deleteWalletWrapper(Tuple2 data) async { + return deleteWallet(data.item1, data.item2); } Future deleteEpicWallet({ required String walletId, required SecureStorageInterface secureStore, }) async { - // is this even needed for anything? - // String? config = await secureStore.read(key: '${walletId}_config'); - // // TODO: why double check for iOS? - // if (Platform.isIOS) { - // Directory appDir = await StackFileSystem.applicationRootDirectory(); - // // todo why double check for ios? - // // if (Platform.isIOS) { - // // appDir = (await getLibraryDirectory()); - // // } - // // if (Platform.isLinux) { - // // appDir = Directory("${appDir.path}/.stackwallet"); - // // } - // final path = "${appDir.path}/epiccash"; - // final String name = walletId; - // - // final walletDir = '$path/$name'; - // var editConfig = jsonDecode(config as String); - // - // editConfig["wallet_dir"] = walletDir; - // config = jsonEncode(editConfig); - // } - final wallet = await secureStore.read(key: '${walletId}_wallet'); + String? config = await secureStore.read(key: '${walletId}_config'); + if (Platform.isIOS) { + Directory appDir = await StackFileSystem.applicationRootDirectory(); + + final path = "${appDir.path}/epiccash"; + final String name = walletId.trim(); + final walletDir = '$path/$name'; + + var editConfig = jsonDecode(config as String); + + editConfig["wallet_dir"] = walletDir; + config = jsonEncode(editConfig); + } if (wallet == null) { return "Tried to delete non existent epic wallet file with walletId=$walletId"; } else { try { - return compute(_deleteWalletWrapper, wallet); + return _deleteWalletWrapper(Tuple2(wallet, config!)); } catch (e, s) { Logging.instance.log("$e\n$s", level: LogLevel.Error); return "deleteEpicWallet($walletId) failed...";