callback method

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

Implementation

callback(TPRewardVideoAdListener 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 == 'rewardVideo_loaded') {
    listener.onAdLoaded(adUnitId, adInfo);
  } else if (method == 'rewardVideo_loadFailed') {
    listener.onAdLoadFailed(adUnitId, error);
  } else if (method == 'rewardVideo_impression') {
    listener.onAdImpression(adUnitId, adInfo);
  } else if (method == 'rewardVideo_showFailed') {
    listener.onAdShowFailed(adUnitId, adInfo, error);
  } else if (method == 'rewardVideo_clicked') {
    listener.onAdClicked(adUnitId, adInfo);
  } else if (method == 'rewardVideo_closed') {
    listener.onAdClosed(adUnitId, adInfo);
  } else if (method == 'rewardVideo_startLoad') {
    listener.onAdStartLoad!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_oneLayerStartLoad') {
    listener.oneLayerStartLoad!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_bidStart') {
    listener.onBiddingStart!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_bidEnd') {
    listener.onBiddingEnd!(adUnitId, adInfo, error);
  } else if (method == 'rewardVideo_isLoading') {
    listener.onAdIsLoading!(adUnitId);
  } else if (method == 'rewardVideo_oneLayerLoaded') {
    listener.oneLayerLoaded!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_oneLayerLoadedFail') {
    listener.oneLayerLoadFailed(adUnitId, adInfo, error);
  } else if (method == 'rewardVideo_rewarded') {
    listener.onAdReward(adUnitId, adInfo);
  } else if (method == 'rewardVideo_allLoaded') {
    bool isSuccess = arguments["success"];
    listener.onAdAllLoaded!(adUnitId, isSuccess);
  } else if (method == 'rewardVideo_playStart') {
    listener.onVideoPlayStart!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_playEnd') {
    listener.onVideoPlayEnd!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_playAgain_impression') {
    listener.onPlayAgainImpression!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_playAgain_clicked') {
    listener.onPlayAgainClicked!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_playAgain_rewarded') {
    listener.onPlayAgainReward!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_playAgain_playStart') {
    listener.onPlayAgainVideoPlayStart!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_playAgain_playEnd') {
    listener.onPlayAgainVideoPlayEnd!(adUnitId, adInfo);
  } else if (method == 'rewardVideo_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 == 'rewardVideo_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 == 'rewardVideo_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 == 'rewardVideo_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 == 'rewardVideo_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 == 'rewardVideo_downloadinstall') {
    num l = arguments["l"];
    num l1 = arguments["l1"];
    String s = arguments["s"];
    String s1 = arguments["s1"];
    listener.onInstall!(adUnitId, l, l1, s, s1);
  }
  //playAgain_clicked
}