canShowInterstitial static method

bool canShowInterstitial()

Check if interstitial ad can be shown based on frequency rules

Implementation

static bool canShowInterstitial() {
  if (_sessionAdCount >= config.maxAdsPerSession) {
    return false;
  }
  if (_lastInterstitialShown == null) {
    return true;
  }

  final now = DateTime.now();
  final difference = now.difference(_lastInterstitialShown!).inSeconds;
  return difference >= config.minInterstitialInterval;
}