@@ -27,7 +27,7 @@ class App extends ConsumerWidget {
2727 return FutureBuilder <bool >(
2828 future: _initializeApp (ref),
2929 builder: (context, snapshot) {
30- _handleAdConfiguration (snapshot);
30+ _handleAdConfiguration (snapshot, ref );
3131 return _buildApp (context, ref);
3232 },
3333 );
@@ -40,22 +40,25 @@ class App extends ConsumerWidget {
4040 return await AdvertiseDirector .shouldUseInternalAds (ref);
4141 }
4242
43- void _handleAdConfiguration (AsyncSnapshot <bool > snapshot) {
43+ void _handleAdConfiguration (AsyncSnapshot <bool > snapshot, WidgetRef ref ) {
4444 if (! snapshot.hasData) return ;
4545
4646 final shouldUseInternalAds = snapshot.data! ;
4747 if (shouldUseInternalAds) {
4848 debugPrint ('Using internal ads' );
4949 } else {
50- _initializeMobileAdsWithConsent ();
50+ _initializeMobileAdsWithConsent (ref );
5151 }
5252 }
5353
54- Future <void > _initializeMobileAdsWithConsent () async {
54+ Future <void > _initializeMobileAdsWithConsent (WidgetRef ref ) async {
5555 try {
5656 if (Platform .isAndroid || Platform .isIOS) {
57- // Request UMP consent first (required for GDPR compliance)
58- UmpService .requestConsent (
57+ // Get UMP service with cache integration
58+ final umpService = ref.read (umpServiceProvider);
59+
60+ // Request UMP consent (checks cache first)
61+ await umpService.requestConsent (
5962 onDone: () async {
6063 // Initialize Mobile Ads after consent flow completes
6164 await MobileAds .instance.initialize ();
0 commit comments