@@ -176,6 +176,7 @@ class InterstitialAdManager {
176176 if (requiredTransitions > 0 && _transitionCount >= requiredTransitions) {
177177 _logger.info ('Transition count meets threshold. Attempting to show ad.' );
178178 await _showAd ();
179+ // Reset counter after showing (or attempting to show)
179180 _transitionCount = 0 ;
180181 } else {
181182 _logger.info (
@@ -201,6 +202,7 @@ class InterstitialAdManager {
201202 }
202203
203204 final adToShow = _preloadedAd! ;
205+ // Clear the pre-loaded ad before showing
204206 _preloadedAd = null ;
205207
206208 try {
@@ -234,6 +236,8 @@ class InterstitialAdManager {
234236 } finally {
235237 // After the ad is shown or fails to show, dispose of it and
236238 // start pre-loading the next one for the next opportunity.
239+
240+ // Ensure the ad object is disposed
237241 _disposePreloadedAd ();
238242 unawaited (_maybePreloadAd (_appBloc.state));
239243 }
@@ -272,6 +276,7 @@ class InterstitialAdManager {
272276 // Await the result of showDialog, which completes when the dialog is popped.
273277 await showDialog <void >(
274278 context: context,
279+ // Prevent dismissing by tapping outside
275280 barrierDismissible: false ,
276281 builder: (_) => LocalInterstitialAdDialog (
277282 localInterstitialAd: ad.adObject as LocalInterstitialAd ,
@@ -283,6 +288,7 @@ class InterstitialAdManager {
283288 // Await the result of showDialog, which completes when the dialog is popped.
284289 await showDialog <void >(
285290 context: context,
291+ // Prevent dismissing by tapping outside
286292 barrierDismissible: false ,
287293 builder: (_) => const DemoInterstitialAdDialog (),
288294 );
0 commit comments