删除dns,弹窗广告广告位调整
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/config/config.dart';
|
||||
import 'package:hgdj/hj_model/home/plate_model.dart';
|
||||
import 'package:hgdj/hj_model/splash/ads_model.dart';
|
||||
import 'package:hgdj/hj_page/pre_sale/pre_sale_provider.dart';
|
||||
import 'package:hgdj/hj_utils/const.dart';
|
||||
import 'package:hgdj/hj_utils/free_play_manager.dart';
|
||||
@@ -11,6 +12,8 @@ import 'package:hgdj/tools_base/ad_manager.dart';
|
||||
import 'package:hgdj/tools_base/global_store/store.dart';
|
||||
|
||||
import '../../alert/splash/app_center_dialog.dart';
|
||||
import '../../alert/splash/notice_image_dialog.dart';
|
||||
import '../../alert/splash/notice_text_dialog.dart';
|
||||
import '../../tools_base/event_bus/event_bus_util.dart';
|
||||
import '../../tools_base/event_bus/events.dart';
|
||||
import '../../tools_base/toast.dart';
|
||||
@@ -145,23 +148,55 @@ class MainPageLogic extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
/// 九宫格应用广告弹窗:每次启动只弹一次;首页弹窗链会 await 它,保证不叠弹
|
||||
static Future<void>? appDialogFuture;
|
||||
/// 广告弹窗链:九宫格应用广告 → 图片公告 → 文字公告。
|
||||
/// 每次启动只跑一次;首页自己的弹窗链会 await 它,保证不叠弹
|
||||
static Future<void>? adDialogFuture;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
//跟着启动落地页弹(不管默认落在哪个 tab),不再依赖首页被构建
|
||||
appDialogFuture ??= _showAppDialog();
|
||||
adDialogFuture ??= _showAdDialogs();
|
||||
}
|
||||
|
||||
Future<void> _showAppDialog() async {
|
||||
/// 逐个 await 串行弹,ab 测未命中广告则整条链都不弹
|
||||
Future<void> _showAdDialogs() async {
|
||||
if (!AdManager().showAbTestAd) return;
|
||||
await _showAppDialog(); //九宫格应用广告
|
||||
await _showImageDialog(); //图片公告
|
||||
await _showWordDialog(); //文字公告
|
||||
}
|
||||
|
||||
///九宫格应用广告
|
||||
Future<void> _showAppDialog() async {
|
||||
final appList = AdManager().adsByType(3);
|
||||
if (appList.isEmpty) return;
|
||||
await Get.dialog(AppCenterDialog(appList: appList));
|
||||
}
|
||||
|
||||
///图片公告(上下双排,每次弹两张)
|
||||
Future<void> _showImageDialog() async {
|
||||
final adsList = AdManager().adsByType(2);
|
||||
for (int i = 0; i < adsList.length; i += 2) {
|
||||
await Get.dialog(
|
||||
SystemImagesDialog(ads: adsList.skip(i).take(2).toList()));
|
||||
}
|
||||
}
|
||||
|
||||
///文字公告
|
||||
Future<void> _showWordDialog() async {
|
||||
for (final wordBean in AdManager().announceList) {
|
||||
await Get.dialog(
|
||||
wordBean.type == 0
|
||||
? NoticeTextDialog(
|
||||
content: wordBean.content.toString(), wordBean: wordBean)
|
||||
: NoticeImageDialog(
|
||||
model:
|
||||
AdsInfoModel(cover: wordBean.cover, href: wordBean.href)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onReLogin(ReLoginEvent event) {
|
||||
_backToRoot();
|
||||
jumpToPage(0);
|
||||
|
||||
Reference in New Issue
Block a user