disable checking trade history for updates in incognito mode

This commit is contained in:
julian 2022-10-17 17:20:08 -06:00
parent 8664699484
commit e1e9cb7126
2 changed files with 19 additions and 15 deletions

View file

@ -79,23 +79,25 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
transactionIfSentFromStack = widget.transactionIfSentFromStack;
walletId = widget.walletId;
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final trade = ref
.read(tradesServiceProvider)
.trades
.firstWhere((e) => e.tradeId == tradeId);
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final trade = ref
.read(tradesServiceProvider)
.trades
.firstWhere((e) => e.tradeId == tradeId);
if (mounted) {
final exchange = Exchange.fromName(trade.exchangeName);
final response = await exchange.updateTrade(trade);
if (mounted) {
final exchange = Exchange.fromName(trade.exchangeName);
final response = await exchange.updateTrade(trade);
if (mounted && response.value != null) {
await ref
.read(tradesServiceProvider)
.edit(trade: response.value!, shouldNotifyListeners: true);
if (mounted && response.value != null) {
await ref
.read(tradesServiceProvider)
.edit(trade: response.value!, shouldNotifyListeners: true);
}
}
}
});
});
}
super.initState();
}

View file

@ -84,7 +84,9 @@ class NotificationsService extends ChangeNotifier {
_timer = Timer.periodic(notificationRefreshInterval, (_) {
Logging.instance
.log("Periodic notifications update check", level: LogLevel.Info);
_checkTrades();
if (prefs.externalCalls) {
_checkTrades();
}
_checkTransactions();
});
}