From d5fbcad025009ff8845d45d578bcbe5d3fb65e03 Mon Sep 17 00:00:00 2001 From: Justin Malandruccolo Date: Fri, 8 Dec 2023 13:34:22 -0500 Subject: [PATCH] DebugPrint: --- .../lib/app_lifecycle_reactor.dart | 3 ++- .../lib/app_open_ad_manager.dart | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/samples/admob/app_open_example/lib/app_lifecycle_reactor.dart b/samples/admob/app_open_example/lib/app_lifecycle_reactor.dart index 5171df636..b848499e7 100644 --- a/samples/admob/app_open_example/lib/app_lifecycle_reactor.dart +++ b/samples/admob/app_open_example/lib/app_lifecycle_reactor.dart @@ -14,6 +14,7 @@ // ignore_for_file: public_member_api_docs import 'package:app_open_example/app_open_ad_manager.dart'; +import 'package:flutter/cupertino.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; /// Listens for app foreground events and shows app open ads. @@ -29,7 +30,7 @@ class AppLifecycleReactor { } void _onAppStateChanged(AppState appState) { - print('New AppState state: $appState'); + debugPrint('New AppState state: $appState'); if (appState == AppState.foreground) { appOpenAdManager.showAdIfAvailable(); } diff --git a/samples/admob/app_open_example/lib/app_open_ad_manager.dart b/samples/admob/app_open_example/lib/app_open_ad_manager.dart index 4505b2421..6bf2558da 100644 --- a/samples/admob/app_open_example/lib/app_open_ad_manager.dart +++ b/samples/admob/app_open_example/lib/app_open_ad_manager.dart @@ -14,6 +14,7 @@ // ignore_for_file: public_member_api_docs +import 'package:flutter/cupertino.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'dart:io' show Platform; @@ -40,12 +41,12 @@ class AppOpenAdManager { request: const AdRequest(), adLoadCallback: AppOpenAdLoadCallback( onAdLoaded: (ad) { - print('$ad loaded'); + debugPrint('$ad loaded'); _appOpenLoadTime = DateTime.now(); _appOpenAd = ad; }, onAdFailedToLoad: (error) { - print('AppOpenAd failed to load: $error'); + debugPrint('AppOpenAd failed to load: $error'); }, ), ); @@ -62,16 +63,16 @@ class AppOpenAdManager { /// new ad. void showAdIfAvailable() { if (!isAdAvailable) { - print('Tried to show ad before available.'); + debugPrint('Tried to show ad before available.'); loadAd(); return; } if (_isShowingAd) { - print('Tried to show ad while already showing an ad.'); + debugPrint('Tried to show ad while already showing an ad.'); return; } if (DateTime.now().subtract(maxCacheDuration).isAfter(_appOpenLoadTime!)) { - print('Maximum cache duration exceeded. Loading another ad.'); + debugPrint('Maximum cache duration exceeded. Loading another ad.'); _appOpenAd!.dispose(); _appOpenAd = null; loadAd(); @@ -81,16 +82,16 @@ class AppOpenAdManager { _appOpenAd!.fullScreenContentCallback = FullScreenContentCallback( onAdShowedFullScreenContent: (ad) { _isShowingAd = true; - print('$ad onAdShowedFullScreenContent'); + debugPrint('$ad onAdShowedFullScreenContent'); }, onAdFailedToShowFullScreenContent: (ad, error) { - print('$ad onAdFailedToShowFullScreenContent: $error'); + debugPrint('$ad onAdFailedToShowFullScreenContent: $error'); _isShowingAd = false; ad.dispose(); _appOpenAd = null; }, onAdDismissedFullScreenContent: (ad) { - print('$ad onAdDismissedFullScreenContent'); + debugPrint('$ad onAdDismissedFullScreenContent'); _isShowingAd = false; ad.dispose(); _appOpenAd = null;