优化代码逻辑
This commit is contained in:
@@ -2,33 +2,24 @@ export 'flutter_union_ad_stream.dart';
|
||||
export 'flutter_union_ad_code.dart.dart';
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:union_ad_ssgf/banner/banner_ad_view.dart';
|
||||
import 'package:union_ad_ssgf/splash/splash_ad_view.dart';
|
||||
import 'flutter_union_ad_code.dart.dart';
|
||||
|
||||
import 'express/express_ad_view.dart';
|
||||
|
||||
part 'flutter_union_ad_callback.dart';
|
||||
|
||||
part 'flutter_unio_ad_bidding_controller.dart';
|
||||
|
||||
class FlutterUnionAd {
|
||||
static const MethodChannel _channel = MethodChannel('flutter_union_ad');
|
||||
|
||||
///
|
||||
/// # SDK注册初始化
|
||||
///
|
||||
/// SDK注册初始化
|
||||
/// [androidId] androidId 必填
|
||||
///
|
||||
/// [iosId] iosId 必填
|
||||
///
|
||||
/// [channelId] channelId 渠道id [FlutterTencentadChannel]
|
||||
///
|
||||
/// [personalized] personalized 是否开启个性化广告 [FlutterTencentadPersonalized]
|
||||
///
|
||||
static Future<bool> register({
|
||||
required String androidId,
|
||||
required String iosId,
|
||||
@@ -45,32 +36,20 @@ class FlutterUnionAd {
|
||||
});
|
||||
}
|
||||
|
||||
///
|
||||
/// # 获取SDK版本号
|
||||
///
|
||||
/// 获取SDK版本号
|
||||
static Future<String> getSDKVersion() async {
|
||||
return await _channel.invokeMethod("getSDKVersion");
|
||||
}
|
||||
|
||||
///
|
||||
/// # 激励视频广告预加载
|
||||
///
|
||||
/// [androidId] android广告ID
|
||||
///
|
||||
/// [iosId] ios广告ID
|
||||
///
|
||||
/// 激励视频广告预加载
|
||||
/// [androidId] android 广告ID
|
||||
/// [iosId] ios 广告ID
|
||||
/// [rewardName] 奖励名称
|
||||
///
|
||||
/// [rewardAmount] 奖励金额
|
||||
///
|
||||
/// [userID] 用户id
|
||||
///
|
||||
/// [customData] 扩展参数,服务器回调使用
|
||||
///
|
||||
/// [downloadConfirm] 下载二次确认弹窗 默认false
|
||||
///
|
||||
/// [videoMuted] 是否静音 默认false
|
||||
///
|
||||
/// [isBidding] 是否开启竞价模式 默认false
|
||||
static Future<bool> loadRewardVideoAd({
|
||||
required String androidId,
|
||||
@@ -96,29 +75,23 @@ class FlutterUnionAd {
|
||||
});
|
||||
}
|
||||
|
||||
///
|
||||
/// # 显示激励广告
|
||||
///
|
||||
/// [result] 竞价成功、失败后调用 [FlutterTencentBiddingResult] ,isBidding = true时必传
|
||||
static Future<bool> showRewardVideoAd(
|
||||
{FlutterTencentBiddingResult? result}) async {
|
||||
/// 显示激励广告
|
||||
/// [result] 竞价成功、失败后调用 [FlutterUnioAdBiddingResult] ,isBidding = true时必传
|
||||
static Future<bool> showRewardVideoAd({
|
||||
FlutterUnioAdBiddingResult? result,
|
||||
}) async {
|
||||
return await _channel.invokeMethod(
|
||||
"showRewardVideoAd", result?.toJson() ?? {});
|
||||
"showRewardVideoAd",
|
||||
result?.toJson() ?? {},
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// # 预加载插屏广告
|
||||
///
|
||||
/// 预加载插屏广告
|
||||
/// [androidId] android广告ID
|
||||
///
|
||||
/// [iosId] ios广告ID
|
||||
///
|
||||
/// [isFullScreen] 是否全屏
|
||||
///
|
||||
/// [isFullScreen] 是否全屏
|
||||
/// [downloadConfirm] 下载二次确认弹窗 默认false
|
||||
///
|
||||
/// [isBidding] 是否开启竞价模式 默认false
|
||||
///
|
||||
static Future<bool> loadUnifiedInterstitialAD({
|
||||
required String androidId,
|
||||
required String iosId,
|
||||
@@ -135,37 +108,27 @@ class FlutterUnionAd {
|
||||
});
|
||||
}
|
||||
|
||||
///
|
||||
/// # 显示新模板渲染插屏
|
||||
///
|
||||
///
|
||||
/// [result] 竞价成功、失败后调用 [FlutterTencentBiddingResult] ,isBidding = true时必传
|
||||
///
|
||||
static Future<bool> showUnifiedInterstitialAD(
|
||||
{FlutterTencentBiddingResult? result}) async {
|
||||
/// 显示新模板渲染插屏
|
||||
/// [result] 竞价成功、失败后调用 [FlutterUnioAdBiddingResult] ,isBidding = true时必传
|
||||
static Future<bool> showUnifiedInterstitialAD({
|
||||
FlutterUnioAdBiddingResult? result,
|
||||
}) async {
|
||||
return await _channel.invokeMethod(
|
||||
"showInterstitialAD", result?.toJson() ?? {});
|
||||
"showInterstitialAD",
|
||||
result?.toJson() ?? {},
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// # banner广告
|
||||
///
|
||||
/// banner广告
|
||||
/// [androidId] android广告ID
|
||||
///
|
||||
/// [iosId] ios广告ID
|
||||
///
|
||||
/// [viewWidth] 广告宽 单位dp
|
||||
///
|
||||
/// [viewHeight] 广告高 单位dp 宽高比应该为6.4:1
|
||||
///
|
||||
/// [FlutterTencentAdBannerCallBack] 广告回调
|
||||
///
|
||||
/// [FlutterUnionAdBannerCallBack] 广告回调
|
||||
/// [downloadConfirm] 下载二次确认弹窗 默认false
|
||||
///
|
||||
/// [isBidding] 是否开启竞价模式 默认false
|
||||
///
|
||||
/// [bidding] 竞价成功、失败后调用 [FlutterTencentAdBiddingController] ,isBidding = true时必传
|
||||
///
|
||||
/// [bidding] 竞价成功、失败后调用 [FlutterUnioAdBiddingController] ,isBidding = true时必传
|
||||
static Widget bannerAdView({
|
||||
required String androidId,
|
||||
required String iosId,
|
||||
@@ -188,25 +151,14 @@ class FlutterUnionAd {
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// # 开屏广告
|
||||
///
|
||||
/// 开屏广告
|
||||
/// [androidId] android广告ID
|
||||
///
|
||||
/// [iosId] ios广告ID
|
||||
///
|
||||
/// [fetchDelay] 设置开屏广告从请求到展示所花的最大时长(并不是指广告曝光时长),
|
||||
/// 取值范围为[1500, 5000]ms。如果需要使用默认值,可以调用上一个构造方法,
|
||||
/// 或者给 fetchDelay 设为0。
|
||||
///
|
||||
/// [FlutterTencentAdSplashCallBack] 广告回调
|
||||
///
|
||||
/// [fetchDelay] 设置开屏广告从请求到展示所花的最大时长(并不是指广告曝光时长),取值范围为[1500, 5000]ms。如果需要使用默认值,可以调用上一个构造方法,或者给 fetchDelay 设为0。
|
||||
/// [FlutterUnionAdSplashCallBack] 广告回调
|
||||
/// [downloadConfirm] 下载二次确认弹窗 默认false
|
||||
///
|
||||
/// [isBidding] 是否开启竞价模式 默认false
|
||||
///
|
||||
/// [bidding] 竞价成功、失败后调用 [FlutterTencentAdBiddingController] ,isBidding = true时必传
|
||||
///
|
||||
/// [bidding] 竞价成功、失败后调用 [FlutterUnioAdBiddingController] ,isBidding = true时必传
|
||||
static Widget splashAdView({
|
||||
required String androidId,
|
||||
required String iosId,
|
||||
@@ -227,25 +179,15 @@ class FlutterUnionAd {
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// # 动态信息流/横幅/视频贴片广告
|
||||
///
|
||||
/// 动态信息流/横幅/视频贴片广告
|
||||
/// [androidId] android广告ID
|
||||
///
|
||||
/// [iosId] ios广告ID
|
||||
///
|
||||
/// [viewWidth] 广告宽 单位dp
|
||||
///
|
||||
/// [viewHeight] 广告高 单位dp
|
||||
///
|
||||
/// [FlutterTencentAdExpressCallBack] 回调事件
|
||||
///
|
||||
/// [FlutterUnionAdExpressCallBack] 回调事件
|
||||
/// [downloadConfirm] 下载二次确认弹窗 默认false
|
||||
///
|
||||
/// [isBidding] 是否开启竞价模式 默认false
|
||||
///
|
||||
/// [bidding] 竞价成功、失败后调用 [FlutterTencentAdBiddingController] ,isBidding = true时必传
|
||||
///
|
||||
/// [bidding] 竞价成功、失败后调用 [FlutterUnioAdBiddingController] ,isBidding = true时必传
|
||||
static Widget expressAdView({
|
||||
required String androidId,
|
||||
required String iosId,
|
||||
|
Reference in New Issue
Block a user