callback method
Implementation
callback(TPSplashAdListener listener, String adUnitId, String method,
Map arguments) {
Map adInfo = {};
if (arguments.containsKey("adInfo")) {
adInfo = arguments['adInfo'];
}
Map error = {};
if (arguments.containsKey("adError")) {
error = arguments['adError'];
}
try {
if (method == 'splash_loaded') {
listener.onAdLoaded(adUnitId, adInfo);
} else if (method == 'splash_loadFailed') {
listener.onAdLoadFailed(adUnitId, error);
} else if (method == 'splash_impression') {
listener.onAdImpression(adUnitId, adInfo);
} else if (method == 'splash_showFailed') {
listener.onAdShowFailed(adUnitId, adInfo, error);
} else if (method == 'splash_clicked') {
listener.onAdClicked(adUnitId, adInfo);
} else if (method == 'splash_closed') {
listener.onAdClosed(adUnitId, adInfo);
} else if (method == 'splash_startLoad') {
listener.onAdStartLoad?.call(adUnitId, adInfo);
} else if (method == 'splash_oneLayerStartLoad') {
listener.oneLayerStartLoad?.call(adUnitId, adInfo);
} else if (method == 'splash_bidStart') {
listener.onBiddingStart?.call(adUnitId, adInfo);
} else if (method == 'splash_bidEnd') {
listener.onBiddingEnd?.call(adUnitId, adInfo, error);
} else if (method == 'splash_isLoading') {
listener.onAdIsLoading?.call(adUnitId);
} else if (method == 'splash_oneLayerLoaded') {
listener.oneLayerLoaded?.call(adUnitId, adInfo);
} else if (method == 'splash_oneLayerLoadedFail') {
listener.oneLayerLoadFailed(adUnitId, adInfo, error);
} else if (method == 'splash_allLoaded') {
bool isSuccess = arguments["success"];
listener.onAdAllLoaded?.call(adUnitId, isSuccess);
} else if (method == 'splash_onZoomOutStart') {
listener.onZoomOutStart?.call(adUnitId, adInfo);
} else if (method == 'splash_onZoomOutEnd') {
listener.onZoomOutEnd?.call(adUnitId, adInfo);
} else if (method == 'splash_onSkip') {
listener.onSkip?.call(adUnitId, adInfo);
} else if (method == 'splash_downloadstart') {
num l = arguments["l"];
num l1 = arguments["l1"];
String s = arguments["s"];
String s1 = arguments["s1"];
listener.onDownloadStart?.call(adUnitId, l, l1, s, s1);
} else if (method == 'splash_downloadupdate') {
num l = arguments["l"];
num l1 = arguments["l1"];
String s = arguments["s"];
String s1 = arguments["s1"];
int i = arguments["p"];
listener.onDownloadUpdate?.call(adUnitId, l, l1, s, s1, i);
} else if (method == 'splash_downloadpause') {
num l = arguments["l"];
num l1 = arguments["l1"];
String s = arguments["s"];
String s1 = arguments["s1"];
listener.onDownloadPause?.call(adUnitId, l, l1, s, s1);
} else if (method == 'splash_downloadfinish') {
num l = arguments["l"];
num l1 = arguments["l1"];
String s = arguments["s"];
String s1 = arguments["s1"];
listener.onDownloadFinish?.call(adUnitId, l, l1, s, s1);
} else if (method == 'splash_downloadfail') {
num l = arguments["l"];
num l1 = arguments["l1"];
String s = arguments["s"];
String s1 = arguments["s1"];
listener.onDownloadFail?.call(adUnitId, l, l1, s, s1);
} else if (method == 'splash_downloadinstall') {
num l = arguments["l"];
num l1 = arguments["l1"];
String s = arguments["s"];
String s1 = arguments["s1"];
listener.onInstall?.call(adUnitId, l, l1, s, s1);
} else {
_tpSplashLog('[tradplus][splash] unhandled method=$method');
}
} catch (e, s) {
debugPrint('[tradplus][splash] callback exception method=$method adUnitId=$adUnitId error=$e\n$s');
}
}