Add didInjectView callback to PrebidMobilePluginRenderer - #941
Open
MattMur wants to merge 3 commits into
Open
Conversation
postindustria-code
suggested changes
Jul 15, 2026
postindustria-code
left a comment
Collaborator
There was a problem hiding this comment.
Please, add unit tests covering updated behaviour. Everything else LGTM
Contributor
|
@MattMur will you be able to add tests? If you don't have time for it now, let me know and we create follow-up ticket and merge this one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses a few issues I ran into while working with the plugin renderer system.
1. getPreferredPluginRendererName() returns null by default
When a bid response doesn't include a renderer key in its meta,
getPreferredPluginRendererName()is returning null. This leads to a live production bug where theifcondition in BannerView.displayPrebidView that can never be hit, since by default it will always evaluate to false.Fix: Set PrebidRenderer as the default for
getPreferredPluginRendererName()2. Final layout responsibility should be given to chosen PluginRenderer
Layout parameters for the injected ad view are being set directly inside BannerView. Since BannerView doesn't have visibility into how a given renderer intends to display its content, this feels like the wrong place for this logic. The renderer itself is best positioned to own those decisions — it knows the ad format, creative dimensions, and any renderer-specific requirements.
Fix: Add new callback to the
PrebidMobilePluginRendererto notify it once the ad has been injected so it can manage the final layout.3. MATCH_PARENT is the wrong default for fixed-size banner ads
Due to the bug from issue#1, MATCH_PARENT is always being set on the injected view. This is a potential source of issues since ideally the
PrebidRendererwants the size to be controlled by logic inPrebidWebView, and the outerDisplayViewshould simply WRAP_CONTENT.Fix: Use the new
didInjectViewmethod on PrebidRenderer to set WRAP_CONTENT with center gravity.Testing
I've tested these fixes on the PrebidInternalTestApp using every "Banner" "In-app" variant, and each one looks and behaves as expected.
Parallel PR for iOS PR 1261