callback method

dynamic callback(
  1. TPBannerAdListener listener,
  2. String adUnitId,
  3. String method,
  4. Map arguments,
)

Implementation

callback(TPBannerAdListener 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'];
  }
  if (method == 'banner_loaded') {
    listener.onAdLoaded(adUnitId, adInfo);
  } else if (method == 'banner_loadFailed') {
    listener.onAdLoadFailed(adUnitId, error);
  } else if (method == 'banner_impression') {
    listener.onAdImpression(adUnitId, adInfo);
  } else if (method == 'banner_showFailed') {
    listener.onAdShowFailed(adUnitId, adInfo, error);
  } else if (method == 'banner_clicked') {
    listener.onAdClicked(adUnitId, adInfo);
  } else if (method == 'banner_closed') {
    listener.onAdClosed(adUnitId, adInfo);
  } else if (method == 'banner_startLoad') {
    listener.onAdStartLoad!(adUnitId, adInfo);
  } else if (method == 'banner_oneLayerStartLoad') {
    listener.oneLayerStartLoad!(adUnitId, adInfo);
  } else if (method == 'banner_bidStart') {
    listener.onBiddingStart!(adUnitId, adInfo);
  } else if (method == 'banner_bidEnd') {
    listener.onBiddingEnd!(adUnitId, adInfo, error);
  } else if (method == 'banner_isLoading') {
    listener.onAdIsLoading!(adUnitId);
  } else if (method == 'banner_oneLayerLoaded') {
    listener.oneLayerLoaded!(adUnitId, adInfo);
  } else if (method == 'banner_oneLayerLoadedFail') {
    listener.oneLayerLoadFailed(adUnitId, adInfo, error);
  } else if (method == 'banner_allLoaded') {
    bool isSuccess = arguments["success"];
    listener.onAdAllLoaded!(adUnitId, isSuccess);
  } else if (method == 'banner_downloadstart') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onDownloadStart!(adUnitId, l, l1, s, s1);
  } else if (method == 'banner_downloadupdate') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    int i = arguments["p"];
    listener.onDownloadUpdate!(adUnitId, l, l1, s, s1, i);
  } else if (method == 'banner_downloadpause') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onDownloadPause!(adUnitId, l, l1, s, s1);
  } else if (method == 'banner_downloadfinish') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onDownloadFinish!(adUnitId, l, l1, s, s1);
  } else if (method == 'banner_downloadfail') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onDownloadFail!(adUnitId, l, l1, s, s1);
  } else if (method == 'banner_downloadinstall') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onInstall!(adUnitId, l, l1, s, s1);
  }
}