mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
disable BuyDataLoadingService
This commit is contained in:
parent
48346fa77f
commit
89778e6e63
7 changed files with 86 additions and 91 deletions
|
@ -293,9 +293,9 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
if (Constants.enableExchange) {
|
||||
unawaited(ExchangeDataLoadingService().loadAll(ref));
|
||||
}
|
||||
if (Constants.enableBuy) {
|
||||
unawaited(BuyDataLoadingService().loadAll(ref));
|
||||
}
|
||||
// if (Constants.enableBuy) {
|
||||
// unawaited(BuyDataLoadingService().loadAll(ref));
|
||||
// }
|
||||
}
|
||||
|
||||
if (ref.read(prefsChangeNotifierProvider).isAutoBackupEnabled) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:stackwallet/pages/buy_view/sub_widgets/crypto_selection_view.dar
|
|||
import 'package:stackwallet/pages/buy_view/sub_widgets/fiat_crypto_toggle.dart';
|
||||
import 'package:stackwallet/pages/buy_view/sub_widgets/fiat_selection_view.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/address_utils.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
|
||||
|
@ -247,10 +246,10 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
|||
coins = ref.read(supportedSimplexCurrenciesProvider).supportedCryptos;
|
||||
fiats = ref.read(supportedSimplexCurrenciesProvider).supportedFiats;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
BuyDataLoadingService().loadAll(
|
||||
ref); // Why does this need to be called here? Shouldn't it already be called by main.dart?
|
||||
});
|
||||
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
// BuyDataLoadingService().loadAll(
|
||||
// ref); // Why does this need to be called here? Shouldn't it already be called by main.dart?
|
||||
// });
|
||||
|
||||
// TODO set initial crypto to open wallet if a wallet is open
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import 'package:stackwallet/providers/global/notifications_provider.dart';
|
|||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
|
||||
import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
|
@ -47,7 +46,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
bool _exitEnabled = false;
|
||||
|
||||
final _exchangeDataLoadingService = ExchangeDataLoadingService();
|
||||
final _buyDataLoadingService = BuyDataLoadingService();
|
||||
// final _buyDataLoadingService = BuyDataLoadingService();
|
||||
|
||||
Future<bool> _onWillPop() async {
|
||||
// go to home view when tapping back on the main exchange view
|
||||
|
@ -95,15 +94,15 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
}
|
||||
}
|
||||
|
||||
void _loadSimplexData() {
|
||||
// unawaited future
|
||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||
_buyDataLoadingService.loadAll(ref);
|
||||
} else {
|
||||
Logging.instance.log("User does not want to use external calls",
|
||||
level: LogLevel.Info);
|
||||
}
|
||||
}
|
||||
// void _loadSimplexData() {
|
||||
// // unawaited future
|
||||
// if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||
// _buyDataLoadingService.loadAll(ref);
|
||||
// } else {
|
||||
// Logging.instance.log("User does not want to use external calls",
|
||||
// level: LogLevel.Info);
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -320,9 +319,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
if (next == 1) {
|
||||
_exchangeDataLoadingService.loadAll(ref);
|
||||
}
|
||||
if (next == 2) {
|
||||
_buyDataLoadingService.loadAll(ref);
|
||||
}
|
||||
// if (next == 2) {
|
||||
// _buyDataLoadingService.loadAll(ref);
|
||||
// }
|
||||
if (next >= 0 && next <= 2) {
|
||||
_pageController.animateToPage(
|
||||
next,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
@ -149,7 +148,7 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
|||
if (selectedIndex != 2) {
|
||||
ref.read(homeViewPageIndexStateProvider.state).state = 2;
|
||||
}
|
||||
await BuyDataLoadingService().loadAll(ref);
|
||||
// await BuyDataLoadingService().loadAll(ref);
|
||||
},
|
||||
child: Text(
|
||||
"Buy",
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
|||
import 'package:stackwallet/pages_desktop_specific/password/create_password_view.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/global/price_provider.dart';
|
||||
import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
|
@ -233,8 +232,8 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
if (isEasy) {
|
||||
unawaited(ExchangeDataLoadingService()
|
||||
.loadAll(ref));
|
||||
unawaited(
|
||||
BuyDataLoadingService().loadAll(ref));
|
||||
// unawaited(
|
||||
// BuyDataLoadingService().loadAll(ref));
|
||||
ref
|
||||
.read(priceAnd24hChangeNotifierProvider)
|
||||
.start(true);
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart';
|
||||
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
||||
import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
@ -44,7 +43,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
|||
|
||||
double _width = expandedWidth;
|
||||
|
||||
final _buyDataLoadingService = BuyDataLoadingService();
|
||||
// final _buyDataLoadingService = BuyDataLoadingService();
|
||||
|
||||
void updateSelectedMenuItem(DesktopMenuItemId idKey) {
|
||||
widget.onSelectionWillChange?.call(idKey);
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
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<void> 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<void> _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;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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<void> 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<void> _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;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue