fix:第一轮跑
This commit is contained in:
1 parent
e834ec7586
commit
33235f450b
56 files changed
+4357
-210
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import '../../mall/application/mall_tab_config.dart';
|
||||
import '../data/ads_api_client.dart';
|
||||
import 'splash_ad_controller.dart';
|
||||
|
||||
final adConfigForegroundRefresherProvider = Provider(
|
||||
(ref) => AdConfigForegroundRefresher(
|
||||
() => ref.invalidate(featuredAdsProvider(homeBannerAdPlacement)),
|
||||
() => ref.read(splashAdControllerProvider).refresh(),
|
||||
() => ref.read(mallTabConfigProvider.notifier).refresh(),
|
||||
),
|
||||
);
|
||||
|
||||
class AdConfigForegroundRefresher {
|
||||
AdConfigForegroundRefresher(this._banner, this._splash, this._mall);
|
||||
final void Function() _banner;
|
||||
final Future<void> Function() _splash, _mall;
|
||||
Future<void>? _running;
|
||||
Future<void> refresh() =>
|
||||
_running ??= _refresh().whenComplete(() => _running = null);
|
||||
Future<void> _refresh() async {
|
||||
try {
|
||||
_banner();
|
||||
} catch (_) {}
|
||||
try {
|
||||
await _splash();
|
||||
} catch (_) {}
|
||||
try {
|
||||
await _mall();
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user