Skip to content
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

feat(ios, android): add FLUID size support #556

Merged
merged 14 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions RNGoogleMobileAdsExample/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import MobileAds, {
TestIds,
BannerAd,
BannerAdSize,
GAMBannerAdSize,
RevenuePrecisions,
RewardedAd,
RewardedAdEventType,
Expand Down Expand Up @@ -787,7 +788,13 @@ class AdInspectorTest implements Test {
}
}

const GAMBannerComponent = React.forwardRef<View>((_, ref) => {
const GAMBannerComponent = React.forwardRef<
View,
{
unitId: string;
sizes: GAMBannerAdSize[];
}
>(({unitId, sizes}, ref) => {
const bannerRef = useRef<GAMBannerAd>(null);
const recordManualImpression = () => {
bannerRef.current?.recordManualImpression();
Expand All @@ -797,8 +804,8 @@ const GAMBannerComponent = React.forwardRef<View>((_, ref) => {
{/* To test FLUID size ad, use `TestIds.GAM_NATIVE` */}
<GAMBannerAd
ref={bannerRef}
unitId={TestIds.GAM_BANNER}
sizes={[BannerAdSize.ADAPTIVE_BANNER]}
unitId={unitId}
sizes={sizes}
requestOptions={{
requestNonPersonalizedAdsOnly: true,
}}
Expand All @@ -812,16 +819,37 @@ const GAMBannerComponent = React.forwardRef<View>((_, ref) => {
);
});
class GAMBannerTest implements Test {
constructor(
private readonly props: {
unitId: string;
sizes: GAMBannerAdSize[];
},
) {}

getPath(): string {
return 'GAMBanner';
return (
'GAMBanner ' +
this.props.sizes
.map(size =>
size
.split('_')
.map(
(s: string) =>
s.toLowerCase().charAt(0).toUpperCase() +
s.toLowerCase().slice(1),
)
.join(''),
)
.join('_')
);
}

getTestType(): TestType {
return TestType.Interactive;
}

render(onMount: (component: any) => void): React.ReactNode {
return <GAMBannerComponent ref={onMount} />;
return <GAMBannerComponent ref={onMount} {...this.props} />;
}

execute(component: any, complete: (result: TestResult) => void): void {
Expand Down Expand Up @@ -971,7 +999,18 @@ TestRegistry.registerTest(new RewardedHookTest());
TestRegistry.registerTest(new AppOpenHookTest());
TestRegistry.registerTest(new RewardedInterstitialHookTest());
TestRegistry.registerTest(new AdInspectorTest());
TestRegistry.registerTest(new GAMBannerTest());
TestRegistry.registerTest(
new GAMBannerTest({
unitId: TestIds.GAM_BANNER,
sizes: [BannerAdSize.ADAPTIVE_BANNER],
}),
);
TestRegistry.registerTest(
new GAMBannerTest({
unitId: TestIds.GAM_NATIVE,
sizes: [GAMBannerAdSize.FLUID],
}),
);
TestRegistry.registerTest(new GAMInterstitialTest());
TestRegistry.registerTest(new DebugMenuTest());

Expand Down
72 changes: 10 additions & 62 deletions RNGoogleMobileAdsExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,60 +70,16 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- Google-Mobile-Ads-SDK (10.14.0):
- GoogleAppMeasurement (< 11.0, >= 7.0)
- Google-Mobile-Ads-SDK (11.0.1):
- GoogleUserMessagingPlatform (>= 1.1)
- GoogleAppMeasurement (10.19.0):
- GoogleAppMeasurement/AdIdSupport (= 10.19.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.19.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.19.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.19.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleUserMessagingPlatform (2.1.0)
- GoogleUtilities/AppDelegateSwizzler (7.12.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.12.0):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.12.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.12.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.12.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.12.0)"
- GoogleUtilities/Reachability (7.12.0):
- GoogleUtilities/Logger
- GoogleUserMessagingPlatform (2.2.0)
- hermes-engine (0.72.2):
- hermes-engine/Pre-built (= 0.72.2)
- hermes-engine/Pre-built (0.72.2)
- Jet (0.8.0):
- React-Core
- libevent (2.1.12)
- nanopb (2.30909.1):
- nanopb/decode (= 2.30909.1)
- nanopb/encode (= 2.30909.1)
- nanopb/decode (2.30909.1)
- nanopb/encode (2.30909.1)
- OpenSSL-Universal (1.1.1100)
- PromisesObjC (2.3.1)
- RCT-Folly (2021.07.22.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -534,9 +490,9 @@ PODS:
- React-jsi (= 0.72.2)
- React-logger (= 0.72.2)
- React-perflogger (= 0.72.2)
- RNGoogleMobileAds (12.7.1):
- Google-Mobile-Ads-SDK (= 10.14.0)
- GoogleUserMessagingPlatform (= 2.1.0)
- RNGoogleMobileAds (13.0.2):
- Google-Mobile-Ads-SDK (= 11.0.1)
- GoogleUserMessagingPlatform (= 2.2.0)
- RCT-Folly (= 2021.07.22.00)
- React-Core
- SocketRocket (0.6.1)
Expand Down Expand Up @@ -624,13 +580,9 @@ SPEC REPOS:
- FlipperKit
- fmt
- Google-Mobile-Ads-SDK
- GoogleAppMeasurement
- GoogleUserMessagingPlatform
- GoogleUtilities
- libevent
- nanopb
- OpenSSL-Universal
- PromisesObjC
- SocketRocket
- YogaKit

Expand Down Expand Up @@ -720,7 +672,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: 7dcd2de282d72e344012f7d6564d024930a6a440
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 565cdf5e3d0dd4b12a9c842f6a4bb5082b5aaa5b
Expand All @@ -735,16 +687,12 @@ SPEC CHECKSUMS:
FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
Google-Mobile-Ads-SDK: 8f67a72f88d057335b1ac3f501e2b68ad054116e
GoogleAppMeasurement: 68afe759316673c6554dac35a0c7ae8f5d6cb4ed
GoogleUserMessagingPlatform: dce302b8f1b84d6e945812ee7a15c3f65a102cbf
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
Google-Mobile-Ads-SDK: 7a466427864972f5229f1f89d004b998a28ddcae
GoogleUserMessagingPlatform: d31dbfb40ec02c5d9683029815c5d5a7f46389ee
hermes-engine: 3f42310d66bcbc814b3771b79ad8d5a3f8df3df1
Jet: c17c29bfbbaff56f08a17678211f36b859173e99
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: 40bf5271b434eae17c4f950abde576fb25d77d3a
RCTTypeSafety: 14400c4d956ff45c5a188e3b4f5f4daa89e3ae09
Expand Down Expand Up @@ -777,11 +725,11 @@ SPEC CHECKSUMS:
React-runtimescheduler: dbea23f2991dfa010654165de8159862935aed27
React-utils: ec05233cf7ee1d7014d41aaa17ec65ceeba8948d
ReactCommon: 77382645a088a81de55c24bde19c5a2805d891c3
RNGoogleMobileAds: b696339ffa53c8efbee232c0dff8b0dd466964fc
RNGoogleMobileAds: 836645c0b779f983854912f3564e8d699b8f662e
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: c79810ea24a2a73b7f39174e78d60f4e28261f33
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: ad5b72079f3063adc720629375fc9194bb51ba43

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
Loading
Loading