删除dns,弹窗广告广告位调整
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/hj_model/splash/ads_model.dart';
|
||||
import 'package:hgdj/hj_page/main_page/provider/msg_provider.dart';
|
||||
import 'package:hgdj/hj_page/pre_sale/pre_sale_provider.dart';
|
||||
import 'package:hgdj/alert/vip_guide/guide_manager.dart';
|
||||
import 'package:hgdj/alert/vip_guide/timed_popup_manager.dart';
|
||||
import 'package:hgdj/tools_base/ad_manager.dart';
|
||||
|
||||
import '../../alert/splash/notice_image_dialog.dart';
|
||||
import '../../alert/splash/notice_text_dialog.dart';
|
||||
import '../../alert/vip_guide/guide_bottom_sheet.dart';
|
||||
import '../../alert/vip_guide/guide_home_dialog.dart';
|
||||
import '../../config/config.dart';
|
||||
@@ -121,17 +117,13 @@ class HomeMainLogic extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
/// 首页开屏弹窗链:图片公告 → 文字公告 → 预售 → 支付分层 → VIP 引导。
|
||||
/// 首页弹窗链:预售 → 支付分层 → VIP 引导。
|
||||
/// 逐个 await 串行弹,每次启动只跑一次。
|
||||
/// 九宫格应用广告不在这里:它跟着启动落地页弹,见 MainPageLogic.onReady
|
||||
/// 广告类弹窗(九宫格/图片公告/文字公告)不在这里:它们跟着启动落地页弹,见 MainPageLogic.onReady
|
||||
Future<void> _showAdChain() async {
|
||||
if (_adShown) return;
|
||||
_adShown = true;
|
||||
await MainPageLogic.appDialogFuture; //等落地页的九宫格弹窗关掉再接着弹,避免叠在一起
|
||||
if (AdManager().showAbTestAd) {
|
||||
await _showImageDialog(); //图片公告
|
||||
await _showWordDialog(); //文字公告
|
||||
}
|
||||
await MainPageLogic.adDialogFuture; //等落地页的广告弹窗链走完再接着弹,避免叠在一起
|
||||
|
||||
await PreSaleProvider().showAlert(); //预售弹窗
|
||||
await _showPayDialog(); //支付分层首页弹窗
|
||||
@@ -177,27 +169,4 @@ class HomeMainLogic extends GetxController {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///显示图片公告(上下双排,每次弹两张)
|
||||
Future<void> _showImageDialog() async {
|
||||
final adsList = AdManager().adsByType(46);
|
||||
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)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import 'package:hgdj/hj_model/splash/ads_model.dart';
|
||||
import 'package:hgdj/hj_model/video_model.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/vid_service.dart';
|
||||
import 'package:hgdj/hj_utils/const.dart';
|
||||
import 'package:hgdj/tools_base/base_list_controller.dart';
|
||||
import 'package:hgdj/tools_base/ad_manager.dart';
|
||||
import 'package:hgdj/tools_base/base_list_controller.dart';
|
||||
|
||||
import '../home_cell_style/home_section_cell.dart';
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -28,7 +28,6 @@ import 'package:hgdj/tools_base/net/net_manager.dart';
|
||||
import 'package:hgdj/tools_base/widget/common_alert.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../../alert/splash/line_error_dialog.dart';
|
||||
import '../../alert/splash/update_dialog.dart';
|
||||
import '../../hj_utils/free_play_manager.dart';
|
||||
import '../../tools_base/loading/loading_alert_widget.dart';
|
||||
@@ -58,8 +57,7 @@ class SplashLogic extends GetxController {
|
||||
await AdManager().preload(); //预热广告内存缓存,后续统一用 AdManager().adsByType
|
||||
_loadAds(isLast: true); //获取上次启动的广告
|
||||
final line = await _detectLine(); //选线
|
||||
//拿不到线路就到此为止:要么用户放弃了重试,要么弹框回调里重试成功、
|
||||
//已经自己走了一遍 _initByLine。这里再调一次会重复初始化
|
||||
//拿不到线路就到此为止(线路异常弹窗已去掉,失败暂不提示),启动流程停在启动页
|
||||
if (TextUtil.isEmpty(line)) return;
|
||||
_initByLine(line!); //初始化流程
|
||||
}
|
||||
@@ -95,7 +93,8 @@ class SplashLogic extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
///一直检查网络直到成功
|
||||
///选线:拿到线路才继续启动流程
|
||||
//选线失败暂时不做处理(线路异常弹窗已去掉),启动流程停在启动页
|
||||
Future<String?> _detectLine() async {
|
||||
LoadingAlertWidget.show(title: "选线中...");
|
||||
|
||||
@@ -106,11 +105,6 @@ class SplashLogic extends GetxController {
|
||||
LoadingAlertWidget.cancel();
|
||||
if (TextUtil.isNotEmpty(line)) return line;
|
||||
}
|
||||
await LineErrorDialog.show(callback: () async {
|
||||
final line = await DetectLineManager().detectLineOnce();
|
||||
LoadingAlertWidget.cancel();
|
||||
if (TextUtil.isNotEmpty(line)) _initByLine(line); //初始化流程
|
||||
});
|
||||
LoadingAlertWidget.cancel();
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user