diff --git a/lib/bloc/rev_swap_in_progress/rev_swap_in_progress_bloc.dart b/lib/bloc/rev_swap_in_progress/rev_swap_in_progress_bloc.dart index 1d1e09283..e09af8864 100644 --- a/lib/bloc/rev_swap_in_progress/rev_swap_in_progress_bloc.dart +++ b/lib/bloc/rev_swap_in_progress/rev_swap_in_progress_bloc.dart @@ -20,19 +20,19 @@ class RevSwapsInProgressBloc extends Cubit { pollReverseSwapsInProgress() async { _log.info("Started polling for reverse swaps in progress."); - await _refreshInProgressReverseSwaps().whenComplete(() => _startPolling()); + await _refreshInProgressReverseSwaps(showLoader: true).whenComplete(() => _startPolling()); } late Timer timer; void _startPolling() { - timer = Timer.periodic(const Duration(seconds: 30), (_) async => _refreshInProgressReverseSwaps); + timer = Timer.periodic(const Duration(seconds: 30), (_) => _refreshInProgressReverseSwaps()); } - Future _refreshInProgressReverseSwaps() async { + Future _refreshInProgressReverseSwaps({bool showLoader = false}) async { try { _log.info("Refreshing reverse swaps in progress."); - _emitState(state.copyWith(isLoading: true)); + _emitState(state.copyWith(isLoading: showLoader)); final reverseSwapsInProgress = await _breezSDK.inProgressOnchainPayments(); _logReverseSwapsInProgress(reverseSwapsInProgress); _emitState(state.copyWith( diff --git a/lib/bloc/swap_in_progress/swap_in_progress_bloc.dart b/lib/bloc/swap_in_progress/swap_in_progress_bloc.dart index aee3fb2ec..ea85e5f9b 100644 --- a/lib/bloc/swap_in_progress/swap_in_progress_bloc.dart +++ b/lib/bloc/swap_in_progress/swap_in_progress_bloc.dart @@ -20,19 +20,19 @@ class SwapInProgressBloc extends Cubit { pollSwapInAddress() async { _log.info("Started polling for swap in address."); - await _refreshAddresses().whenComplete(() => _startPolling()); + await _refreshAddresses(showLoader: true).whenComplete(() => _startPolling()); } late Timer timer; void _startPolling() { - timer = Timer.periodic(const Duration(seconds: 30), (_) async => _refreshAddresses); + timer = Timer.periodic(const Duration(seconds: 30), (_) => _refreshAddresses()); } - Future _refreshAddresses() async { + Future _refreshAddresses({bool showLoader = false}) async { try { _log.info("Refreshing swap in address."); - _emitState(state.copyWith(isLoading: true)); + _emitState(state.copyWith(isLoading: showLoader)); SwapInfo? inProgress = (await _breezSDK.inProgressSwap()); // Reset unused if there's a swap in progress _emitState(state.copyWith(inProgress: inProgress, unused: inProgress != null ? null : state.unused));