-
Notifications
You must be signed in to change notification settings - Fork 285
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
Serve multiple ad types with a single AdLoaderAd widget #723
base: main
Are you sure you want to change the base?
Conversation
Happy New Year everyone! Is there anything else you would like to see before considering this PR? ✌🏻 |
I'm following up on this PR, and I've noticed that (unlike #749) this wasn't assigned any reviewers automatically, so checking in with all those listed in @blasten @bparrishMines @jjliu15 @luo86 @srichakradhar Is there anything further you'd like or need from me when considering this PR? |
a94f12b
to
d4328ec
Compare
I need this 🙏 |
a954ed5
to
f5c75bd
Compare
I'm trying to use this fork but having a problem with varying ad sizes. If setting a fixed size for all ads it works well. But if we have different sizes for e.g banners(https://developers.google.com/admob/flutter/banner/inline-adaptive) / native ads - how to set correct size of the Container of the AdWidget? Thanks |
a59cb76
to
d7d6aca
Compare
d7d6aca
to
555b681
Compare
02c4bd3
to
d03e4fc
Compare
@srichakradhar and @jjliu15 we have been testing this fork for a longer period and it helps us increasing the monitisation of these ad positions. Is there anything which holds back merging this PR? We're happy to assist with anything which is needed for that. |
Hey, any updates on the status of this PR? @srichakradhar @jjliu15 @luo86 @bparrishMines @LTPhantom |
dfba93c
to
9ad7cfb
Compare
In `FlutterNativeAdLoadedListener`, make the inner weak reference be generic on the `OnNativeAdLoadedListener` interface instead of the `FlutterNativeAd` concrete class. This allows using the same listener class with any other type that conforms to `OnNativeAdLoadedListener`. Update `FlutterNativeAd` to conform to `OnNativeAdLoadedListener` to allow delegating in the same existing fashion.
For the `onBanner*` and `onNative*` methods, relax the type constraint from `FLTBannerAd` and `FLTNativeAd` respectively, to `id<FLTAd>` so any instance that conforms to `FLTAd` can be used.
Create a new `GoogleMobileAdsPlugin` constructor which takes an additional `Supplier<FlutterAdLoader>` argument. This is available solely for testing, and allows the provision of a mock `FlutterAdLoader` for those `FlutterAd`s that need it during their construction.
Add the `AdLoaderAd` component, without the specific configuration items for each of the handled ad types. The component implementation is known as: * `AdLoaderAd` (Flutter) * `FlutterAdLoaderAd` (Android) * `FLTAdLoaderAd` (iOS)
Allow the `AdLoaderAd` instance to serve `Banner` ads, which are instances of: * `AdManagerAdView` under Android, and * `GAMBannerView` under iOS
Allow the `AdLoaderAd` instance to serve `Custom` ads, which are instances of: * `NativeCustomFormatAd` under Android, and * `GADCustomNativeAd` under iOS
Allow the `AdLoaderAd` instance to serve `Native` ads, which are instances of: * `NativeAd` under Android, and * `GADNativeAd` under iOS
Description
The motivation behind this PR is to allow more elaborate configurations such as the one described here, where a single
AdLoader
can serve either aNativeAd
or anAdManagerAdView
.To this end, this PR adds a new widget,
AdLoaderAd
, which can configured to serve any of the following platform ad types, all provided byAdLoader
/GADAdLoader
:NativeAd
/GADNativeAd
AdManagerAdView
/GAMBannerView
NativeCustomFormatAd
/GADCustomNativeAd
For the most part the widget and its supporting classes operated independently of the existing widgets. A notable exception is that for the
NativeAd
/GADNativeAd
andGAMBannerView
components, the existing supporting classes behind the relevant widgets are used. To allow this, internal APIs are modified as part of:FlutterNativeAdLoadedListener
more generally usableFLTAdInstanceManager
methodsto allow more general types to be passed to the existing classes. These changes do not cause any incompatibility with existing internal code.
To facilitate testing of the specific ad type under Android, a testing-only constructor has been added as part of:
FlutterAdLoader
factoryThis is applicable to the
FlutterAdLoaderAd
type but could also be used by other types that expect aFlutterAdLoader
during building and construction.Related Issues
N/A
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process. Updating the
pubspec.yaml
and changelogs is not required.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?