mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
init prefs before doing any network calls
This commit is contained in:
parent
e1e9cb7126
commit
cd0fdad1f6
3 changed files with 3 additions and 6 deletions
|
@ -207,6 +207,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
didLoad = true;
|
didLoad = true;
|
||||||
|
|
||||||
await DB.instance.init();
|
await DB.instance.init();
|
||||||
|
await _prefs.init();
|
||||||
|
|
||||||
_notificationsService = ref.read(notificationsProvider);
|
_notificationsService = ref.read(notificationsProvider);
|
||||||
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
||||||
|
@ -223,7 +224,6 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
tradesService: _tradesService,
|
tradesService: _tradesService,
|
||||||
prefs: _prefs,
|
prefs: _prefs,
|
||||||
);
|
);
|
||||||
await _prefs.init();
|
|
||||||
ref.read(priceAnd24hChangeNotifierProvider).start(true);
|
ref.read(priceAnd24hChangeNotifierProvider).start(true);
|
||||||
await _wallets.load(_prefs);
|
await _wallets.load(_prefs);
|
||||||
loadingCompleter.complete();
|
loadingCompleter.complete();
|
||||||
|
|
|
@ -7,9 +7,8 @@ import 'package:http/http.dart';
|
||||||
import 'package:stackwallet/hive/db.dart';
|
import 'package:stackwallet/hive/db.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
|
||||||
|
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
class PriceAPI {
|
class PriceAPI {
|
||||||
static const refreshInterval = 60;
|
static const refreshInterval = 60;
|
||||||
|
|
|
@ -19,9 +19,7 @@ class PriceService extends ChangeNotifier {
|
||||||
|
|
||||||
Tuple2<Decimal, double> getPrice(Coin coin) => _cachedPrices[coin]!;
|
Tuple2<Decimal, double> getPrice(Coin coin) => _cachedPrices[coin]!;
|
||||||
|
|
||||||
PriceService(this.baseTicker) {
|
PriceService(this.baseTicker);
|
||||||
start(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updatePrice() async {
|
Future<void> updatePrice() async {
|
||||||
final priceMap =
|
final priceMap =
|
||||||
|
|
Loading…
Reference in a new issue