mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
pass config param to wallet deletion method
had to add param because existing rust wallet deletion method can't check for existence without it but I'd like to do this differently on the rust side and revert this change plus the type handling (`decoded is String`) is a hack vs making a model like it probably should be
This commit is contained in:
parent
47e63cca68
commit
a8e079bd84
2 changed files with 21 additions and 4 deletions
|
@ -1 +1 @@
|
|||
Subproject commit f017e01b574a77ad76b8b9c1837b333b777d7e92
|
||||
Subproject commit 2a83a84e3454108b454810e5f5740634719aad44
|
|
@ -219,8 +219,8 @@ Future<String> _cancelTransactionWrapper(Tuple2<String, String> data) async {
|
|||
return cancelTransaction(data.item1, data.item2);
|
||||
}
|
||||
|
||||
Future<String> _deleteWalletWrapper(String wallet) async {
|
||||
return deleteWallet(wallet);
|
||||
Future<String> _deleteWalletWrapper(Tuple2<String, String> data) async {
|
||||
return deleteWallet(data.item1, data.item2);
|
||||
}
|
||||
|
||||
Future<String> deleteEpicWallet({
|
||||
|
@ -248,6 +248,23 @@ Future<String> deleteEpicWallet({
|
|||
// editConfig["wallet_dir"] = walletDir;
|
||||
// config = jsonEncode(editConfig);
|
||||
// }
|
||||
String? storedConfig =
|
||||
await secureStore.read(key: '${walletId}_epicboxConfig');
|
||||
|
||||
if (storedConfig == null) {
|
||||
storedConfig = DefaultNodes.defaultEpicBoxConfig;
|
||||
} else {
|
||||
dynamic decoded = json.decode(storedConfig!);
|
||||
if (decoded is String) {
|
||||
decoded = json.decode(decoded);
|
||||
}
|
||||
final domain = decoded["domain"] ?? "empty";
|
||||
if (domain != "empty") {
|
||||
//If we have the old invalid config, use the new default one
|
||||
// new storage format stores domain under "epicbox_domain", old storage format used "domain"
|
||||
storedConfig = DefaultNodes.defaultEpicBoxConfig;
|
||||
}
|
||||
}
|
||||
|
||||
final wallet = await secureStore.read(key: '${walletId}_wallet');
|
||||
|
||||
|
@ -255,7 +272,7 @@ Future<String> deleteEpicWallet({
|
|||
return "Tried to delete non existent epic wallet file with walletId=$walletId";
|
||||
} else {
|
||||
try {
|
||||
return compute(_deleteWalletWrapper, wallet);
|
||||
return compute(_deleteWalletWrapper, Tuple2(wallet, storedConfig));
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("$e\n$s", level: LogLevel.Error);
|
||||
return "deleteEpicWallet($walletId) failed...";
|
||||
|
|
Loading…
Reference in a new issue