21 private const string AdAlreadyPresentedErrorMessage =
22 "Interstitial ad was already presented. Single Interstitial ad can be presented just once.";
49 private IInterstitialClient _client;
50 private bool _adShown;
54 this._client = client;
55 this._adShown =
false;
57 MainThreadDispatcher.initialize();
58 ConfigureInterstitialEvents(this._client);
67 return this._client.GetInfo();
84 Message = AdAlreadyPresentedErrorMessage
107 this.OnAdShown =
null;
108 this.OnAdFailedToShow =
null;
109 this.OnAdImpression =
null;
110 this.OnAdClicked =
null;
111 this.OnAdDismissed =
null;
114 private void ConfigureInterstitialEvents(IInterstitialClient client)
121 client.OnAdClicked += (sender, args) =>
123 if (this.OnAdClicked ==
null)
128 MainThreadDispatcher.EnqueueAction(() =>
130 if (this.OnAdClicked ==
null)
139 client.OnAdShown += (sender, args) =>
141 if (this.OnAdShown ==
null)
146 MainThreadDispatcher.EnqueueAction(() =>
148 if (this.OnAdShown ==
null)
157 client.OnAdDismissed += (sender, args) =>
159 if (this.OnAdDismissed ==
null)
164 MainThreadDispatcher.EnqueueAction(() =>
166 if (this.OnAdDismissed ==
null)
175 client.OnAdImpression += (sender, args) =>
177 if (this.OnAdImpression ==
null)
182 MainThreadDispatcher.EnqueueAction(() =>
184 if (this.OnAdImpression ==
null)
193 client.OnAdFailedToShow += (sender, args) =>
195 if (this.OnAdFailedToShow ==
null)
200 MainThreadDispatcher.EnqueueAction(() =>
202 if (this.OnAdFailedToShow ==
null)