-
Notifications
You must be signed in to change notification settings - Fork 124
Feature/admob 2021 adview, fullscreen listeners #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/admob 2021 adview, fullscreen listeners #713
Conversation
CompleteFuture(kAdMobErrorAlreadyInitialized, | ||
kAdAlreadyInitializedErrorMessage, future_handle, | ||
&future_data_); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the else clause so this looks like a major deletion. It's not, it appears again below.
Future<LoadAdResult> BannerView::LoadAd(const AdRequest& request) { | ||
if (!CheckIsInitialized(internal_)) return Future<LoadAdResult>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these methods were returning futures that hadn't been completed..!
@@ -143,42 +139,39 @@ public void initialize(Activity activity) { | |||
public void destroy(final long callbackDataPtr) { | |||
// If the Activity isn't initialized, there is nothing to destroy. | |||
if (mActivity == null) { | |||
completeBannerViewFutureCallback(callbackDataPtr, | |||
ConstantsHelper.CALLBACK_ERROR_NONE, | |||
ConstantsHelper.CALLBACK_ERROR_MESSAGE_NONE); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a bug when calling destroy on an uninitialized BannerView. Previously it would hang as the future was never completed.
Updated dependencies to support new AdClicked callback interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with a few notes.
// LINT.ThenChange(//depot_firebase_cpp/admob/client/cpp/src/include/firebase/admob/banner_view.h, | ||
// //depot_firebase_cpp/admob/client/cpp/src/include/firebase/admob/native_express_ad_view.h) | ||
|
||
// LINT.ThenChange(//depot_firebase_cpp/admob/client/cpp/src/include/firebase/admob/banner_view.h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we still have IfThisThenThat, so it might be cleaner to get rid of these. Unless there is a GitHub check equivalent - that would be awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Yeah, I'm actually removing some of the stuff in here in the next PR, so I'll remove those, too. I didn't know this was related to IFTTT!
|
||
extern "C" JNIEXPORT void JNICALL | ||
Java_com_google_firebase_admob_internal_cpp_BannerViewHelper_notifyAdClosed( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as my comment on a previous PR, consider shortening these names since they are passed into RegisterNatives anyway. (And you can put them in an anonymous namespace as well.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it'll be part of the RewardedAd PR for Android.
@@ -53,11 +53,62 @@ METHOD_LOOKUP_DEFINITION(ad_view, "com/google/android/gms/ads/AdView", | |||
|
|||
namespace internal { | |||
|
|||
// Contains data to invoke Initailize from the main thread. | |||
struct InitializeOnMainThreadData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 keep Java helper code as small as possible
// Default no-op implementation for each listener method so that applications | ||
// need only implement the methods they're interested in. | ||
AdListener::~AdListener() {} | ||
void AdListener::OnAdClicked() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the destructor (which needs to be here), WDYT about inlining the other implementations so it's clear to developers writing subclasses that they don't need to call the base class methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'll put this in the next change as well, to reduce merge conflicts.
❌ Integration test FAILEDRequested by @DellaBitta on commit bd8110e
Add flaky tests to go/fpl-cpp-flake-tracker |
Description
- iOS & Android dependencies increased to latest AdMob version to support AdClicked events.
- Implemented AdListener, FullScreenContent, and PaidEvent listeners. These listener signatures track closely with the iOS and Android counterparts so that they may easily be expanded and supported.
- Removed PresentationStateListeners. Similar functionality is now facilaited by AdListeners and FullScreenContentListeners.
- Methods for ad placement renamed from
MoveTo
toSetPosition
to align with AdMob's iOS and Android SDKs.- Invoking methods on BannerView and InterstitialAds now properly fail on "uninitialized" objects. Previously empty / invalid futures were returned from most methods.
- Fixed an hang on
loadAd
calls for uninitialized BannerViews and InterstialAds.- More thorough shut down / destruction of ad objects ensure consistency and reduce potential flake.
- Integration test updates:
- New manual tests track Bounding Box, AdView, FullScreenPresentation and Paid events when clicking through ads.
- Added higher-fidelity checks of bounding box state. Bounding box change behaviors across Android and iOS are now consistent.
- Added a "stress" test of loading and releasing 10 BannerView ads and 10 Interstitial Ads in tight succession.
-
Destroy()
is now called to properly clean up BannerViews.- Expanded coverage of error scenarios: uninitialized ads, duplicate load requests, etc.
Testing
Updated iTest sources.
Manually tested on iOS and Android.
iTest CI Run
Type of Change
Place an
x
the applicable box: