Skip to content

Commit 44e75a0

Browse files
authored
LoadAd operations return LoadAdResults (#682)
LoadAd operations on BannerView and Interstitial Ads now return a LoadAdResult. On error this contains information from the AdMob service as to why a failure occurred. The C++ SDK also uses it to return errors that may have occurred when attempting to marshal the Android and iOS SDKs. The implementation obfuscates Objective C pointers and Android references via Internal structs. These are forward declared in our public API and defined internally. These structs are passed to AdapterResponseInfo, AdResult, LoadAdResult and ResponseInfo class constructors. Other changes include: - Updated the use of Futures in BannerView and InterstitialAd to use SafeFutures. - Removed the use GetLastResult to construct future objects, and its use opens up the potential issue of race conditions. Replaced this implementation with MakeFuture. - Moved LoadAd error code mappings from Android and iOS to C++ code. - Updated integration tests to include the following scenarios for both Interstitial and Banner Ads - Duplicate initialization invocations on the same object. - Duplicate loadAd requests on the same object. - The use of an errant AdUnitId string - Reenabled a multithreaded deletion test that was previously disabled due to a now obsolete Android bug - Added a LoadAd integration test that doesn't require user interaction, so that we can run it on FTL. - Updated iOS Admob SDK to 8+, and reworked the InterstitialDelegates and Loading process to match the new 8.0 flow. [Integration Test run](https://github.com/firebase/firebase-cpp-sdk/actions/runs/1408627388)
1 parent a00b2da commit 44e75a0

File tree

61 files changed

+2961
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2961
-512
lines changed

admob/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,35 @@ binary_to_array("admob_resources"
3434
set(android_SRCS
3535
${admob_resources_source}
3636
src/android/ad_request_converter.cc
37+
src/android/ad_result_android.cc
38+
src/android/adapter_response_info_android.cc
3739
src/android/admob_android.cc
3840
src/android/banner_view_internal_android.cc
39-
src/android/interstitial_ad_internal_android.cc)
41+
src/android/interstitial_ad_internal_android.cc
42+
src/android/load_ad_result_android.cc
43+
src/android/response_info_android.cc)
4044

4145
# Source files used by the iOS implementation.
4246
set(ios_SRCS
4347
src/ios/FADAdSize.mm
4448
src/ios/FADBannerView.mm
4549
src/ios/FADInterstitialDelegate.mm
4650
src/ios/FADRequest.mm
51+
src/ios/ad_result_ios.mm
52+
src/ios/adapter_response_info_ios.mm
4753
src/ios/admob_ios.mm
4854
src/ios/banner_view_internal_ios.mm
49-
src/ios/interstitial_ad_internal_ios.mm)
55+
src/ios/interstitial_ad_internal_ios.mm
56+
src/ios/load_ad_result_ios.mm
57+
src/ios/response_info_ios.mm)
5058

5159
# Source files used by the stub implementation.
5260
set(stub_SRCS
53-
src/stub/admob_stub.cc)
61+
src/stub/ad_result_stub.cc
62+
src/stub/adapter_response_info_stub.cc
63+
src/stub/admob_stub.cc
64+
src/stub/load_ad_result_stub.cc
65+
src/stub/response_info_stub.cc)
5466

5567
if(ANDROID)
5668
set(admob_platform_SRCS

admob/integration_test/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ platform :ios, '10.0'
44

55
target 'integration_test' do
66
pod 'Firebase/Analytics', '8.5.0'
7-
pod 'Google-Mobile-Ads-SDK', '7.69.0-cppsdk'
7+
pod 'Google-Mobile-Ads-SDK', '8.12.0'
88
end
99

1010
post_install do |installer|

admob/integration_test/integration_test.xcodeproj/project.pbxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
developmentRegion = English;
159159
hasScannedForEncodings = 0;
160160
knownRegions = (
161+
English,
161162
en,
162163
);
163164
mainGroup = 529226C91C85F68000C89379;
@@ -289,6 +290,7 @@
289290
CODE_SIGN_IDENTITY = "iPhone Developer";
290291
CODE_SIGN_STYLE = Automatic;
291292
DEVELOPMENT_TEAM = "";
293+
EXCLUDED_ARCHS = i386;
292294
FRAMEWORK_SEARCH_PATHS = (
293295
"$(inherited)",
294296
"$(PROJECT_DIR)",
@@ -303,6 +305,7 @@
303305
"\"$(SRCROOT)/external/googletest/src/googlemock\"",
304306
);
305307
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
308+
OTHER_LDFLAGS = "$(inherited)";
306309
PRODUCT_NAME = "$(TARGET_NAME)";
307310
PROVISIONING_PROFILE_SPECIFIER = "";
308311
WRAPPER_EXTENSION = app;
@@ -317,6 +320,7 @@
317320
CODE_SIGN_IDENTITY = "iPhone Developer";
318321
CODE_SIGN_STYLE = Automatic;
319322
DEVELOPMENT_TEAM = "";
323+
EXCLUDED_ARCHS = i386;
320324
FRAMEWORK_SEARCH_PATHS = (
321325
"$(inherited)",
322326
"$(PROJECT_DIR)",
@@ -331,6 +335,7 @@
331335
"\"$(SRCROOT)/external/googletest/src/googlemock\"",
332336
);
333337
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
338+
OTHER_LDFLAGS = "$(inherited)";
334339
PRODUCT_NAME = "$(TARGET_NAME)";
335340
PROVISIONING_PROFILE_SPECIFIER = "";
336341
WRAPPER_EXTENSION = app;

0 commit comments

Comments
 (0)