mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +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) {
|
if (Constants.enableExchange) {
|
||||||
unawaited(ExchangeDataLoadingService().loadAll(ref));
|
unawaited(ExchangeDataLoadingService().loadAll(ref));
|
||||||
}
|
}
|
||||||
if (Constants.enableBuy) {
|
// if (Constants.enableBuy) {
|
||||||
unawaited(BuyDataLoadingService().loadAll(ref));
|
// unawaited(BuyDataLoadingService().loadAll(ref));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref.read(prefsChangeNotifierProvider).isAutoBackupEnabled) {
|
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_crypto_toggle.dart';
|
||||||
import 'package:stackwallet/pages/buy_view/sub_widgets/fiat_selection_view.dart';
|
import 'package:stackwallet/pages/buy_view/sub_widgets/fiat_selection_view.dart';
|
||||||
import 'package:stackwallet/providers/providers.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/address_utils.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
|
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
|
||||||
|
@ -247,10 +246,10 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
coins = ref.read(supportedSimplexCurrenciesProvider).supportedCryptos;
|
coins = ref.read(supportedSimplexCurrenciesProvider).supportedCryptos;
|
||||||
fiats = ref.read(supportedSimplexCurrenciesProvider).supportedFiats;
|
fiats = ref.read(supportedSimplexCurrenciesProvider).supportedFiats;
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
BuyDataLoadingService().loadAll(
|
// BuyDataLoadingService().loadAll(
|
||||||
ref); // Why does this need to be called here? Shouldn't it already be called by main.dart?
|
// 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
|
// 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/global/prefs_provider.dart';
|
||||||
import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
|
import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
|
||||||
import 'package:stackwallet/providers/ui/unread_notifications_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/services/exchange/exchange_data_loading_service.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
@ -47,7 +46,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
bool _exitEnabled = false;
|
bool _exitEnabled = false;
|
||||||
|
|
||||||
final _exchangeDataLoadingService = ExchangeDataLoadingService();
|
final _exchangeDataLoadingService = ExchangeDataLoadingService();
|
||||||
final _buyDataLoadingService = BuyDataLoadingService();
|
// final _buyDataLoadingService = BuyDataLoadingService();
|
||||||
|
|
||||||
Future<bool> _onWillPop() async {
|
Future<bool> _onWillPop() async {
|
||||||
// go to home view when tapping back on the main exchange view
|
// go to home view when tapping back on the main exchange view
|
||||||
|
@ -95,15 +94,15 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadSimplexData() {
|
// void _loadSimplexData() {
|
||||||
// unawaited future
|
// // unawaited future
|
||||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
// if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
_buyDataLoadingService.loadAll(ref);
|
// _buyDataLoadingService.loadAll(ref);
|
||||||
} else {
|
// } else {
|
||||||
Logging.instance.log("User does not want to use external calls",
|
// Logging.instance.log("User does not want to use external calls",
|
||||||
level: LogLevel.Info);
|
// level: LogLevel.Info);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
@ -320,9 +319,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
if (next == 1) {
|
if (next == 1) {
|
||||||
_exchangeDataLoadingService.loadAll(ref);
|
_exchangeDataLoadingService.loadAll(ref);
|
||||||
}
|
}
|
||||||
if (next == 2) {
|
// if (next == 2) {
|
||||||
_buyDataLoadingService.loadAll(ref);
|
// _buyDataLoadingService.loadAll(ref);
|
||||||
}
|
// }
|
||||||
if (next >= 0 && next <= 2) {
|
if (next >= 0 && next <= 2) {
|
||||||
_pageController.animateToPage(
|
_pageController.animateToPage(
|
||||||
next,
|
next,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/providers/providers.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/services/exchange/exchange_data_loading_service.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
@ -149,7 +148,7 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
if (selectedIndex != 2) {
|
if (selectedIndex != 2) {
|
||||||
ref.read(homeViewPageIndexStateProvider.state).state = 2;
|
ref.read(homeViewPageIndexStateProvider.state).state = 2;
|
||||||
}
|
}
|
||||||
await BuyDataLoadingService().loadAll(ref);
|
// await BuyDataLoadingService().loadAll(ref);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
"Buy",
|
"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/pages_desktop_specific/password/create_password_view.dart';
|
||||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||||
import 'package:stackwallet/providers/global/price_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/services/exchange/exchange_data_loading_service.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
@ -233,8 +232,8 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
||||||
if (isEasy) {
|
if (isEasy) {
|
||||||
unawaited(ExchangeDataLoadingService()
|
unawaited(ExchangeDataLoadingService()
|
||||||
.loadAll(ref));
|
.loadAll(ref));
|
||||||
unawaited(
|
// unawaited(
|
||||||
BuyDataLoadingService().loadAll(ref));
|
// BuyDataLoadingService().loadAll(ref));
|
||||||
ref
|
ref
|
||||||
.read(priceAnd24hChangeNotifierProvider)
|
.read(priceAnd24hChangeNotifierProvider)
|
||||||
.start(true);
|
.start(true);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart';
|
import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart';
|
||||||
import 'package:stackwallet/providers/desktop/current_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/assets.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
@ -44,7 +43,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
|
|
||||||
double _width = expandedWidth;
|
double _width = expandedWidth;
|
||||||
|
|
||||||
final _buyDataLoadingService = BuyDataLoadingService();
|
// final _buyDataLoadingService = BuyDataLoadingService();
|
||||||
|
|
||||||
void updateSelectedMenuItem(DesktopMenuItemId idKey) {
|
void updateSelectedMenuItem(DesktopMenuItemId idKey) {
|
||||||
widget.onSelectionWillChange?.call(idKey);
|
widget.onSelectionWillChange?.call(idKey);
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
// import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
// import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/buy/simplex/simplex_api.dart';
|
// import 'package:stackwallet/services/buy/simplex/simplex_api.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
// import 'package:stackwallet/utilities/logger.dart';
|
||||||
|
//
|
||||||
class BuyDataLoadingService {
|
// class BuyDataLoadingService {
|
||||||
Future<void> loadAll(WidgetRef ref) async {
|
// Future<void> loadAll(WidgetRef ref) async {
|
||||||
try {
|
// try {
|
||||||
await Future.wait([
|
// await Future.wait([
|
||||||
_loadSimplexCurrencies(ref),
|
// _loadSimplexCurrencies(ref),
|
||||||
]);
|
// ]);
|
||||||
} catch (e, s) {
|
// } catch (e, s) {
|
||||||
Logging.instance.log("BuyDataLoadingService.loadAll failed: $e\n$s",
|
// Logging.instance.log("BuyDataLoadingService.loadAll failed: $e\n$s",
|
||||||
level: LogLevel.Error);
|
// level: LogLevel.Error);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Future<void> _loadSimplexCurrencies(WidgetRef ref) async {
|
// Future<void> _loadSimplexCurrencies(WidgetRef ref) async {
|
||||||
bool error = false;
|
// bool error = false;
|
||||||
// if (ref.read(simplexLoadStatusStateProvider.state).state ==
|
// // if (ref.read(simplexLoadStatusStateProvider.state).state ==
|
||||||
// SimplexLoadStatus.loading) {
|
// // SimplexLoadStatus.loading) {
|
||||||
// // already in progress so just
|
// // // already in progress so just
|
||||||
// return;
|
// // return;
|
||||||
// }
|
// // }
|
||||||
|
//
|
||||||
ref.read(simplexLoadStatusStateProvider.state).state =
|
// ref.read(simplexLoadStatusStateProvider.state).state =
|
||||||
SimplexLoadStatus.loading;
|
// SimplexLoadStatus.loading;
|
||||||
|
//
|
||||||
final response = await SimplexAPI.instance.getSupported();
|
// final response = await SimplexAPI.instance.getSupported();
|
||||||
|
//
|
||||||
if (response.value != null) {
|
// if (response.value != null) {
|
||||||
ref
|
// ref
|
||||||
.read(supportedSimplexCurrenciesProvider)
|
// .read(supportedSimplexCurrenciesProvider)
|
||||||
.updateSupportedCryptos(response.value!.item1);
|
// .updateSupportedCryptos(response.value!.item1);
|
||||||
} else {
|
// } else {
|
||||||
error = true;
|
// error = true;
|
||||||
Logging.instance.log(
|
// Logging.instance.log(
|
||||||
"_loadSimplexCurrencies: $response",
|
// "_loadSimplexCurrencies: $response",
|
||||||
level: LogLevel.Warning,
|
// level: LogLevel.Warning,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (response.value != null) {
|
// if (response.value != null) {
|
||||||
ref
|
// ref
|
||||||
.read(supportedSimplexCurrenciesProvider)
|
// .read(supportedSimplexCurrenciesProvider)
|
||||||
.updateSupportedFiats(response.value!.item2);
|
// .updateSupportedFiats(response.value!.item2);
|
||||||
} else {
|
// } else {
|
||||||
error = true;
|
// error = true;
|
||||||
Logging.instance.log(
|
// Logging.instance.log(
|
||||||
"_loadSimplexCurrencies: $response",
|
// "_loadSimplexCurrencies: $response",
|
||||||
level: LogLevel.Warning,
|
// level: LogLevel.Warning,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (error) {
|
// if (error) {
|
||||||
// _loadSimplexCurrencies() again?
|
// // _loadSimplexCurrencies() again?
|
||||||
} else {
|
// } else {
|
||||||
ref.read(simplexLoadStatusStateProvider.state).state =
|
// ref.read(simplexLoadStatusStateProvider.state).state =
|
||||||
SimplexLoadStatus.success;
|
// SimplexLoadStatus.success;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
Loading…
Reference in a new issue