onAdEvent static method
广告事件
Implementation
static onAdEvent({required Map<dynamic, dynamic> arguments}) {
var adLoaderId = arguments[BwtAdCore.keyAdLoaderId];
var bwtAdLoader = _findBwtAdLoader(adLoaderId);
if (bwtAdLoader == null) return;
var adEvent = arguments[BwtAdCore.keyAdEvent];
if (adEvent == null) return;
var adId = arguments[BwtAdCore.keyAdId];
var bwtAd = bwtAdLoader.findBwtAd(adId: adId);
if (bwtAd == null) return;
/// TODO 还有_eventOnAdRender、_eventOnAdReward没做
switch (adEvent) {
case _eventOnAdLoad:
bwtAdLoader.onAdLoadCallback(bwtAd);
case _eventOnAdFailed:
bwtAdLoader.onAdFailedCallback(arguments[BwtAdCore.keyAdMsg]);
case _eventOnAdMeasured:
if (bwtAdLoader is BwtNativeExpressAdLoader &&
bwtAd is BwtNativeExpressAd) {
double adWidth = arguments[BwtAdCore.keyAdWidth] ?? 0;
double adHeight = arguments[BwtAdCore.keyAdHeight] ?? 0;
bwtAdLoader.onAdMeasured(bwtAd, adWidth, adHeight);
}
break;
case _eventOnAdExpose:
bwtAdLoader.onAdExposeCallback(bwtAd);
case _eventOnAdClick:
bwtAdLoader.onAdClickCallback(bwtAd);
case _eventOnAdClose:
bwtAdLoader.onAdCloseCallback(bwtAd);
}
}