Procházet zdrojové kódy

1.开屏广告

tags/0.0.18
“yanghuaxuan” před 3 roky
rodič
revize
318359db05
2 změnil soubory, kde provedl 18 přidání a 11 odebrání
  1. +6
    -0
      lib/pages/home_page/home_page.dart
  2. +12
    -11
      lib/pages/launch_page/launch_page.dart

+ 6
- 0
lib/pages/home_page/home_page.dart Zobrazit soubor

@@ -70,6 +70,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker
@override
void initState() {
///初始化一些数据

initAsync();

//如果登出则重新打开首页
@@ -93,6 +94,11 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker
///初始化各种监听
initAsync() async {
try {
Future.delayed(Duration(milliseconds: 10), () async {
GlobalConfig.context = context;
await AdvertisingUtils.openSplashAd();
});

WidgetsBinding.instance.addObserver(this);

// mob锁粉隐私协议提交


+ 12
- 11
lib/pages/launch_page/launch_page.dart Zobrazit soubor

@@ -26,6 +26,7 @@ import 'package:zhiying_comm/util/shared_prefe_util.dart';
import 'package:package_info/package_info.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:zhiying_comm/util/update/app_update_util.dart';

// 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题
class LaunchPage extends StatefulWidget {
final WidgetBuilder builder;
@@ -57,19 +58,20 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
///检查是否覆盖安装
//取masterId

String lasterMasterId = await SharedPreferencesUtil.getStringValue(Constants.masterId, defaultVal: "1");
Map setting = await NativeUtil.getSetting();
String masterId = setting['master_id'];
if (lasterMasterId != "1") {
if (masterId != lasterMasterId) {
await SharedPreferencesUtil.clean();
}
String lasterMasterId = await SharedPreferencesUtil.getStringValue(Constants.masterId, defaultVal: "1");
Map setting = await NativeUtil.getSetting();
String masterId = setting['master_id'];
if (lasterMasterId != "1") {
if (masterId != lasterMasterId) {
await SharedPreferencesUtil.clean();
}
SharedPreferencesUtil.setStringValue(Constants.masterId, masterId);


}
SharedPreferencesUtil.setStringValue(Constants.masterId, masterId);

Application.init().then((_) async {
///初始化广告SDK
await AdvertisingUtils.init();

///引导页
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String versionNumber = await SharedPreferencesUtil.getStringValue(Constants.versionNumber);
@@ -86,7 +88,6 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
// CupertinoPageRoute(builder: (context) => HomePage()));
print("打开首页");
Navigator.of(context).pushReplacementNamed('/homePage');

}
}).catchError((err, s) async {
print(s);


Načítá se…
Zrušit
Uložit