fix: empty endpoint text if node not connected
This commit is contained in:
parent
05b425c3d2
commit
8c390e511e
|
@ -84,6 +84,7 @@ Future<void> main() async {
|
|||
endPointGVA = 'https://g1.librelois.fr/gva';
|
||||
// endPointGVA = 'https://duniter-g1.p2p.legal/gva';
|
||||
await _homeProvider.getValidEndpoints();
|
||||
// log.d(await configBox.get('endpoint'));
|
||||
|
||||
// if (endPointGVA == 'HS') {
|
||||
// _homeProvider.playSound('faché', 0.8);
|
||||
|
|
|
@ -61,7 +61,9 @@ class HomeProvider with ChangeNotifier {
|
|||
configBox.delete('endpoint');
|
||||
|
||||
List _listEndpoints = [];
|
||||
if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == []) {
|
||||
if (!configBox.containsKey('endpoint') ||
|
||||
configBox.get('endpoint') == [] ||
|
||||
configBox.get('endpoint') == '') {
|
||||
_listEndpoints = await rootBundle
|
||||
.loadString('config/gdev_endpoints.json')
|
||||
.then((jsonStr) => jsonDecode(jsonStr));
|
||||
|
@ -69,6 +71,8 @@ class HomeProvider with ChangeNotifier {
|
|||
configBox.put('endpoint', _listEndpoints);
|
||||
}
|
||||
|
||||
log.i('ENDPOINT: ' + _listEndpoints.toString());
|
||||
|
||||
// int i = 0;
|
||||
// String? _endpoint;
|
||||
// int _statusCode = 0;
|
||||
|
@ -111,7 +115,6 @@ class HomeProvider with ChangeNotifier {
|
|||
// }
|
||||
// } while (_statusCode != 400);
|
||||
|
||||
log.i('ENDPOINT: ' + _listEndpoints.toString());
|
||||
return _listEndpoints;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,6 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
bool checkIfWalletExist() {
|
||||
// configBox.delete('endpoint');
|
||||
// if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == []) {
|
||||
// log.d('No endpoint, configure...');
|
||||
// configBox.put('endpoint', 'wss://gdev.librelois.fr/ws');
|
||||
// }
|
||||
|
||||
if (chestBox.isEmpty) {
|
||||
log.i('No wallets detected');
|
||||
return false;
|
||||
|
|
|
@ -48,6 +48,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
List<NetworkParams> node = [];
|
||||
|
||||
for (String _endpoint in configBox.get('endpoint')) {
|
||||
log.d(_endpoint);
|
||||
final n = NetworkParams();
|
||||
n.name = currencyName;
|
||||
n.endpoint = _endpoint;
|
||||
|
|
|
@ -30,13 +30,12 @@ class SettingsScreen extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
const double buttonHigh = 50;
|
||||
const double buttonWidth = 240;
|
||||
const double fontSize = 16;
|
||||
TextEditingController _endpointController =
|
||||
TextEditingController(text: _sub.getConnectedEndpoint());
|
||||
TextEditingController(text: configBox.get('endpoint').first);
|
||||
|
||||
// getAppDirectory();
|
||||
return Scaffold(
|
||||
|
|
Loading…
Reference in New Issue