mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 11:04:33 +00:00
Fix epicbox config issue when creating new wallet
This commit is contained in:
parent
f21e4727fa
commit
716dbe706b
1 changed files with 15 additions and 14 deletions
|
@ -1003,7 +1003,7 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
|
||||
/// Set this attribute to `true` if do not need any ping/pong
|
||||
/// messages and ping measurement. Default is `false`
|
||||
pingRestrictionForce: false,
|
||||
pingRestrictionForce: true,
|
||||
);
|
||||
|
||||
final IMessageProcessor<String, String> textSocketProcessor =
|
||||
|
@ -1038,8 +1038,9 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
Future<String> getEpicBoxConfig() async {
|
||||
String? storedConfig =
|
||||
await _secureStore.read(key: '${_walletId}_epicboxConfig');
|
||||
|
||||
if (storedConfig == null) {
|
||||
return json.encode(DefaultNodes.defaultEpicBoxConfig);
|
||||
storedConfig = DefaultNodes.defaultEpicBoxConfig;
|
||||
} else {
|
||||
dynamic decoded = json.decode(storedConfig!);
|
||||
final domain = decoded["domain"] ?? "empty";
|
||||
|
@ -1047,20 +1048,20 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
//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;
|
||||
decoded = json.decode(storedConfig);
|
||||
}
|
||||
//Check Epicbox is up before returning it
|
||||
bool isEpicboxConnected = await testEpicboxServer(
|
||||
decoded["epicbox_domain"] as String, decoded["epicbox_port"] as int);
|
||||
|
||||
if (!isEpicboxConnected) {
|
||||
//Default Epicbox is not connected, Defaulting to Europe
|
||||
storedConfig = json.encode(DefaultNodes.epicBoxConfigEUR);
|
||||
// TODO test this connection before returning it, iterating through the list of default Epic Box servers
|
||||
}
|
||||
|
||||
return storedConfig;
|
||||
}
|
||||
final decoded = json.decode(storedConfig);
|
||||
//Check Epicbox is up before returning it
|
||||
bool isEpicboxConnected = await testEpicboxServer(
|
||||
decoded["epicbox_domain"] as String, decoded["epicbox_port"] as int);
|
||||
|
||||
if (!isEpicboxConnected) {
|
||||
//Default Epicbox is not connected, Defaulting to Europe
|
||||
storedConfig = json.encode(DefaultNodes.epicBoxConfigEUR);
|
||||
// TODO test this connection before returning it, iterating through the list of default Epic Box servers
|
||||
}
|
||||
|
||||
return storedConfig;
|
||||
}
|
||||
|
||||
Future<String> getRealConfig() async {
|
||||
|
|
Loading…
Reference in a new issue