/* * This file is part of Stack Wallet. * * Copyright (c) 2023 Cypher Stack * All Rights Reserved. * The code is distributed under GPLv3 license, see LICENSE file for details. * Generated by Cypher Stack on 2023-05-26 * */ // import 'package:flutter_riverpod/flutter_riverpod.dart'; // import 'package:stackwallet/providers/providers.dart'; // import 'package:stackwallet/services/buy/simplex/simplex_api.dart'; // import 'package:stackwallet/utilities/logger.dart'; // // class BuyDataLoadingService { // Future loadAll(WidgetRef ref) async { // try { // await Future.wait([ // _loadSimplexCurrencies(ref), // ]); // } catch (e, s) { // Logging.instance.log("BuyDataLoadingService.loadAll failed: $e\n$s", // level: LogLevel.Error); // } // } // // Future _loadSimplexCurrencies(WidgetRef ref) async { // bool error = false; // // if (ref.read(simplexLoadStatusStateProvider.state).state == // // SimplexLoadStatus.loading) { // // // already in progress so just // // return; // // } // // ref.read(simplexLoadStatusStateProvider.state).state = // SimplexLoadStatus.loading; // // final response = await SimplexAPI.instance.getSupported(); // // if (response.value != null) { // ref // .read(supportedSimplexCurrenciesProvider) // .updateSupportedCryptos(response.value!.item1); // } else { // error = true; // Logging.instance.log( // "_loadSimplexCurrencies: $response", // level: LogLevel.Warning, // ); // } // // if (response.value != null) { // ref // .read(supportedSimplexCurrenciesProvider) // .updateSupportedFiats(response.value!.item2); // } else { // error = true; // Logging.instance.log( // "_loadSimplexCurrencies: $response", // level: LogLevel.Warning, // ); // } // // if (error) { // // _loadSimplexCurrencies() again? // } else { // ref.read(simplexLoadStatusStateProvider.state).state = // SimplexLoadStatus.success; // } // } // }