mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
Merge pull request #155 from cypherstack/ui-fixes
load exchange data on user opened exchange
This commit is contained in:
commit
3a034dfd86
3 changed files with 9 additions and 20 deletions
|
@ -287,7 +287,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
(previous, next) {
|
(previous, next) {
|
||||||
if (next is int) {
|
if (next is int) {
|
||||||
if (next == 1) {
|
if (next == 1) {
|
||||||
_loadCNData();
|
_exchangeDataLoadingService.loadAll(ref);
|
||||||
}
|
}
|
||||||
if (next >= 0 && next <= 1) {
|
if (next >= 0 && next <= 1) {
|
||||||
_pageController.animateToPage(
|
_pageController.animateToPage(
|
||||||
|
|
|
@ -101,10 +101,10 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
ref.read(homeViewPageIndexStateProvider.state).state = 1;
|
ref.read(homeViewPageIndexStateProvider.state).state = 1;
|
||||||
}
|
}
|
||||||
// DateTime now = DateTime.now();
|
// DateTime now = DateTime.now();
|
||||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
// if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
print("loading?");
|
// print("loading?");
|
||||||
await ExchangeDataLoadingService().loadAll(ref);
|
await ExchangeDataLoadingService().loadAll(ref);
|
||||||
}
|
// }
|
||||||
// if (now.difference(_lastRefreshed) > _refreshInterval) {
|
// if (now.difference(_lastRefreshed) > _refreshInterval) {
|
||||||
// await ExchangeDataLoadingService().loadAll(ref);
|
// await ExchangeDataLoadingService().loadAll(ref);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -37,6 +37,7 @@ import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||||
|
import 'package:stackwallet/utilities/logger.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';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
@ -45,12 +46,6 @@ import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
import 'package:stackwallet/hive/db.dart';
|
|
||||||
|
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
|
||||||
|
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
|
||||||
|
|
||||||
/// [eventBus] should only be set during testing
|
/// [eventBus] should only be set during testing
|
||||||
class WalletView extends ConsumerStatefulWidget {
|
class WalletView extends ConsumerStatefulWidget {
|
||||||
const WalletView({
|
const WalletView({
|
||||||
|
@ -235,12 +230,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onExchangePressed(BuildContext context) async {
|
void _onExchangePressed(BuildContext context) async {
|
||||||
final _cnLoadingService = ExchangeDataLoadingService();
|
|
||||||
final externalCalls = Prefs.instance.externalCalls;
|
|
||||||
if (!externalCalls) {
|
|
||||||
print("loading?");
|
|
||||||
unawaited(_cnLoadingService.loadAll(ref));
|
unawaited(_cnLoadingService.loadAll(ref));
|
||||||
}
|
|
||||||
final coin = ref.read(managerProvider).coin;
|
final coin = ref.read(managerProvider).coin;
|
||||||
|
|
||||||
if (coin == Coin.epicCash) {
|
if (coin == Coin.epicCash) {
|
||||||
|
@ -371,9 +362,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
|
|
||||||
void _loadCNData() {
|
void _loadCNData() {
|
||||||
// unawaited future
|
// unawaited future
|
||||||
final externalCalls = DB.instance
|
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
.get<dynamic>(boxName: DB.boxNamePrefs, key: "externalCalls") as bool?;
|
|
||||||
if (externalCalls ?? false) {
|
|
||||||
_cnLoadingService.loadAll(ref, coin: ref.read(managerProvider).coin);
|
_cnLoadingService.loadAll(ref, coin: ref.read(managerProvider).coin);
|
||||||
} else {
|
} else {
|
||||||
Logging.instance.log("User does not want to use external calls",
|
Logging.instance.log("User does not want to use external calls",
|
||||||
|
|
Loading…
Reference in a new issue