refreshConsent method

Future<void> refreshConsent()

Re-reads the UMP decision after the user changes privacy settings.

When consent is revoked, existing handlers are disposed immediately so future loads and shows cannot continue using the old decision. When it is granted again, the current Remote Config/ID configuration is rebuilt.

Implementation

Future<void> refreshConsent() async {
  if (_consentChecker == null) return;

  _consentAllowed = await _readConsent();
  if (!_consentAllowed) {
    _disposeHandlers();
    _config = _config.copyWith(adsEnabled: false, preloadEnabled: false);
    _retryManager = AdsRetryManager(_config);
    return;
  }

  await refreshConfig();
}