Skip to content
Snippets Groups Projects
Commit c8933fd5 authored by guenoel's avatar guenoel Committed by poka
Browse files

fix: parse double to int in initCurrencyParameters for iPhone

parent 532a004f
Branches
Tags
1 merge request!56Fix/build ios
Pipeline #18837 waiting for manual action
...@@ -96,10 +96,19 @@ class SubstrateSdk with ChangeNotifier { ...@@ -96,10 +96,19 @@ class SubstrateSdk with ChangeNotifier {
} }
} }
Future _getStorageConst(String call) async { Future<int> _getStorageConst(String call) async {
return (await sdk.webView! final result = (await sdk.webView!
.evalJavascript('api.consts.$call', wrapPromise: false) ?? .evalJavascript('api.consts.$call', wrapPromise: false) ??
[null])[0]; [null])[0];
return checkInt(result) ?? 0;
}
int? checkInt(dynamic value) {
if (value is int) return value;
if (value is double) return value.toInt();
if (value is String) return int.tryParse(value);
return null;
} }
Future<TxSenderData> _setSender(String address) async { Future<TxSenderData> _setSender(String address) async {
...@@ -396,7 +405,7 @@ class SubstrateSdk with ChangeNotifier { ...@@ -396,7 +405,7 @@ class SubstrateSdk with ChangeNotifier {
currencyParameters['certValidityPeriod'] = currencyParameters['certValidityPeriod'] =
await _getStorageConst('cert.validityPeriod.words'); await _getStorageConst('cert.validityPeriod.words');
} catch (e) { } catch (e) {
log.i('error while getting storageVals (network?)'); log.i('error while getting storageVals (network?) :: $e');
} }
log.i('currencyParameters: $currencyParameters'); log.i('currencyParameters: $currencyParameters');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment