callback method

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

Implementation

callback(TPOfferwallAdListener 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 == 'offerwall_loaded') {
    listener.onAdLoaded(adUnitId, adInfo);
  } else if (method == 'offerwall_loadFailed') {
    listener.onAdLoadFailed(adUnitId, error);
  } else if (method == 'offerwall_impression') {
    listener.onAdImpression(adUnitId, adInfo);
  } else if (method == 'offerwall_showFailed') {
    listener.onAdShowFailed(adUnitId, adInfo, error);
  } else if (method == 'offerwall_clicked') {
    listener.onAdClicked(adUnitId, adInfo);
  } else if (method == 'offerwall_closed') {
    listener.onAdClosed(adUnitId, adInfo);
  } else if (method == 'offerwall_startLoad') {
    listener.onAdStartLoad!(adUnitId, adInfo);
  } else if (method == 'offerwall_oneLayerStartLoad') {
    listener.oneLayerStartLoad!(adUnitId, adInfo);
  } else if (method == 'offerwall_bidStart') {
    listener.onBiddingStart!(adUnitId, adInfo);
  } else if (method == 'offerwall_bidEnd') {
    listener.onBiddingEnd!(adUnitId, adInfo, error);
  } else if (method == 'offerwall_isLoading') {
    listener.onAdIsLoading!(adUnitId);
  } else if (method == 'offerwall_oneLayerLoaded') {
    listener.oneLayerLoaded!(adUnitId, adInfo);
  } else if (method == 'offerwall_oneLayerLoadedFail') {
    listener.oneLayerLoadFailed(adUnitId, adInfo, error);
  } else if (method == 'offerwall_allLoaded') {
    bool isSuccess = arguments["success"];
    listener.onAdAllLoaded!(adUnitId, isSuccess);
  } else if (method == 'offerwall_playStart') {
    listener.onVideoPlayStart!(adUnitId, adInfo);
  } else if (method == 'offerwall_playEnd') {
    listener.onVideoPlayEnd!(adUnitId, adInfo);
  } else if (method == 'offerwall_currency_success') {
    int amount = arguments["amount"];
    String msg = arguments["msg"];
    listener.currencyBalanceSuccess!(adUnitId, amount, msg);
  } else if (method == 'offerwall_currency_failed') {
    String msg = arguments["msg"];
    listener.currencyBalanceFailed!(adUnitId, msg);
  } else if (method == 'offerwall_spend_success') {
    int amount = arguments["amount"];
    String msg = arguments["msg"];
    listener.spendCurrencySuccess!(adUnitId, amount, msg);
  } else if (method == 'offerwall_spend_failed') {
    String msg = arguments["msg"];
    listener.spendCurrencyFailed!(adUnitId, msg);
  } else if (method == 'offerwall_award_success') {
    int amount = arguments["amount"];
    String msg = arguments["msg"];
    listener.awardCurrencySuccess!(adUnitId, amount, msg);
  } else if (method == 'offerwall_award_failed') {
    String msg = arguments["msg"];
    listener.awardCurrencyFailed!(adUnitId, msg);
  } else if (method == 'offerwall_setUserIdFinish') {
    bool isSuccess = arguments["success"];
    listener.setUserIdFinish!(adUnitId, isSuccess);
  }
}