callback method

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

Implementation

callback(TPInterstitialAdListener 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 == 'interstitial_loaded') {
    listener.onAdLoaded(adUnitId, adInfo);
  } else if (method == 'interstitial_loadFailed') {
    listener.onAdLoadFailed(adUnitId, error);
  } else if (method == 'interstitial_impression') {
    listener.onAdImpression(adUnitId, adInfo);
  } else if (method == 'interstitial_showFailed') {
    listener.onAdShowFailed(adUnitId, adInfo, error);
  } else if (method == 'interstitial_clicked') {
    listener.onAdClicked(adUnitId, adInfo);
  } else if (method == 'interstitial_closed') {
    listener.onAdClosed(adUnitId, adInfo);
  } else if (method == 'interstitial_startLoad') {
    listener.onAdStartLoad!(adUnitId, adInfo);
  } else if (method == 'interstitial_oneLayerStartLoad') {
    listener.oneLayerStartLoad!(adUnitId, adInfo);
  } else if (method == 'interstitial_bidStart') {
    listener.onBiddingStart!(adUnitId, adInfo);
  } else if (method == 'interstitial_bidEnd') {
    listener.onBiddingEnd!(adUnitId, adInfo, error);
  } else if (method == 'interstitial_isLoading') {
    listener.onAdIsLoading!(adUnitId);
  } else if (method == 'interstitial_oneLayerLoaded') {
    listener.oneLayerLoaded!(adUnitId, adInfo);
  } else if (method == 'interstitial_oneLayerLoadedFail') {
    listener.oneLayerLoadFailed(adUnitId, adInfo, error);
  } else if (method == 'interstitial_allLoaded') {
    bool isSuccess = arguments["success"];
    listener.onAdAllLoaded!(adUnitId, isSuccess);
  } else if (method == 'interstitial_playStart') {
    listener.onVideoPlayStart!(adUnitId, adInfo);
  } else if (method == 'interstitial_playEnd') {
    listener.onVideoPlayEnd!(adUnitId, adInfo);
  } else if (method == 'interstitial_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 == 'interstitial_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 == 'interstitial_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 == 'interstitial_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 == 'interstitial_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 == 'interstitial_downloadinstall') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onInstall!(adUnitId, l, l1, s, s1);
  }
}