Esempio n. 1
0
 public void OnAdFinished(AdResult result)
 {
     if (AdFinished != null)
     {
         AdFinished(result);
     }
 }
Esempio n. 2
0
        private void FireAdCallback(NativeMessage message, AdFormat adFormat)
        {
            var        adPayload = message.AdPayload;
            AdCallback callback  = GetCallback <AdCallback>(message.Id, !adPayload.AdStarted);

            if (adPayload.AdStarted)
            {
                if (ads.ContainsKey(message.Id))
                {
                    Ad ad = ads[message.Id];
                    // only remove if it's not a banner
                    ads.Remove(message.Id);
                    callback.OnAdStarted(ad);
                }
                else
                {
                    ClearCallbacks(message.Id);
                    FyberCallback.Instance.OnNativeError("An unknown error occurred. Please, request Ads again.");
                }
            }
            else
            {
                AdResult result = new AdResult();
                if (string.IsNullOrEmpty(adPayload.Error))
                {
                    result.Status  = AdStatus.OK;
                    result.Message = adPayload.Status;
                }
                else
                {
                    result.Status  = AdStatus.Error;
                    result.Message = adPayload.Error;
                }
                result.AdFormat = adFormat;
                callback.OnAdFinished(result);
            }
        }