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

Add Prebid Plugin Renderer #1021

Merged
merged 37 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
37fcc5f
add bidRequest.data.plugin_renderers structure and parsing
github-paul-nicolas Apr 7, 2023
447aa7b
Merge branch 'master' into feature/custom_render
github-paul-nicolas Sep 20, 2023
e42ff7a
comply with Google Mobile Ads v10.9.0
github-paul-nicolas Sep 20, 2023
2397ac6
PluginRenderer implementation
github-paul-nicolas Mar 7, 2024
6458afc
Merge branch 'master' into feature/custom_render
github-paul-nicolas Mar 7, 2024
e86a559
remove pluginRendererName from PluginEventDelegate protocol
github-paul-nicolas Mar 7, 2024
9c18547
update syntax
github-paul-nicolas Mar 8, 2024
19a1902
added KEY_RENDERER_VERSION and getPreferredPluginRendererVersion
github-richard-depierre Mar 15, 2024
9fb1340
merge
github-richard-depierre Mar 15, 2024
38cb626
Merge branch 'prebid:master' into feature/custom_render
github-richard-depierre May 2, 2024
c12ec78
finished bannerAd, almost done interstitialAd
github-richard-depierre May 2, 2024
e719bd7
Merge branch 'feature/custom_render' of teads:github-paul-nicolas/pre…
github-richard-depierre May 2, 2024
15c5f3c
finished bannerAd, almost done interstitialAd
github-richard-depierre May 2, 2024
9eadc01
fixed: changed the names functions to conincide with android
github-richard-depierre May 16, 2024
2524690
added interstitial view
github-richard-depierre May 16, 2024
1b2e5f8
changed token to data in prebidmobilepluginrenderer
github-richard-depierre May 16, 2024
2745c11
changed token to data in prebidmobilepluginrenderer
github-richard-depierre May 16, 2024
ea75c86
Refacto of BidResponse
github-richard-depierre May 17, 2024
c356d1d
fixed pluginEventListener, refactor of bidResponse, modified pluginRe…
github-richard-depierre May 22, 2024
afd1dcb
fix PBMORTBRendererConfig naming, getRTBListOfRenderersFor function, …
github-richard-depierre May 30, 2024
d7e5d52
Update PrebidMobile/PrebidMobileRendering/ORTB/PBMORTBRendererConfig.h
github-richard-depierre Jun 6, 2024
dd7e0cb
finished integration of custom rendere in internal testing app
github-richard-depierre Jul 3, 2024
bd44ff5
fixed issue with setting to null the transactionFactory
github-richard-depierre Jul 3, 2024
16ff263
finished implementation of internalsampleapp
github-richard-depierre Jul 3, 2024
dec8462
finished implementation of internalsampleapp
github-richard-depierre Jul 3, 2024
883bb38
Merge branch 'master' into feature/custom_render
github-richard-depierre Jul 3, 2024
5c90b75
added UI tests for custom renderer
github-richard-depierre Jul 4, 2024
3782feb
removed data field from request since it is not being used anymore
github-richard-depierre Jul 4, 2024
8290b77
fixed issues given by Lucas
github-richard-depierre Jul 4, 2024
48b1c65
removed unused function
github-richard-depierre Jul 4, 2024
ffe282e
fixed: PR review from Yuri
github-richard-depierre Jul 24, 2024
e8e8833
refacto indent
github-richard-depierre Jul 24, 2024
68c69c0
removed unused transaction factory
github-richard-depierre Aug 7, 2024
31c2dfb
pass the adConfiguration through the app
github-richard-depierre Aug 8, 2024
22c6006
moved sdk version creation in buildbidrequest
github-richard-depierre Aug 20, 2024
390df17
fixed sampleCustomRenderer so that it does not use transactionFactory
github-richard-depierre Aug 21, 2024
b2f62dd
removed default renderer from request
github-richard-depierre Aug 22, 2024
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
37 changes: 31 additions & 6 deletions InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
34E5698A237DB96900B47B01 /* UtilitiesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E56989237DB96900B47B01 /* UtilitiesViewController.swift */; };
34FC0CF424ADD3A80045553E /* PrebidInterstitialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34FC0CF324ADD3A80045553E /* PrebidInterstitialController.swift */; };
34FC0CF624ADD5640045553E /* PrebidGAMRewardedController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34FC0CF524ADD5640045553E /* PrebidGAMRewardedController.swift */; };
3C28C9D82C35713B00D0A7DB /* CustomRendererInterstitialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */; };
3C28C9D92C35713B00D0A7DB /* CustomRendererInterstitialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */; };
3C28C9DB2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */; };
3C28C9DC2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */; };
3CC4A3E92C11F96800B97128 /* CustomRendererBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */; };
3CC4A3EA2C11F96800B97128 /* CustomRendererBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */; };
457FD34BA45C3840CC31A8F5 /* Pods_InternalTestApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C11D97034E668BBFDD0DDCA /* Pods_InternalTestApp.framework */; };
530E722C292FACB20025B44D /* UIImageView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 530E722B292FACB20025B44D /* UIImageView+Extensions.swift */; };
5397BD142936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5397BD132936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift */; };
Expand Down Expand Up @@ -374,6 +380,9 @@
34FC0CF524ADD5640045553E /* PrebidGAMRewardedController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidGAMRewardedController.swift; sourceTree = "<group>"; };
35F94D131F93F85D00CF46DB /* InternalTestAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InternalTestAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
35F94D171F93F85D00CF46DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererInterstitialController.swift; sourceTree = "<group>"; };
3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = "<group>"; };
3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererBannerController.swift; sourceTree = "<group>"; };
530E722B292FACB20025B44D /* UIImageView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Extensions.swift"; sourceTree = "<group>"; };
5397BD132936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIDisplayBannerController.swift; sourceTree = "<group>"; };
5397BD25293760F500ABDA22 /* PrebidOriginalAPIDisplayInterstitialController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIDisplayInterstitialController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -634,6 +643,7 @@
349302192473F2EF004A6086 /* Prebid */ = {
isa = PBXGroup;
children = (
3CC4A3E72C11F93A00B97128 /* CustomRenderer */,
3461835425A6020500783A2C /* NativeAdViewBox.swift */,
AC4F253825DFF6300095C601 /* NativeAdViewBoxLinks.swift */,
AC4F254A25E0112C0095C601 /* NativeAdViewBoxProtocol.swift */,
Expand Down Expand Up @@ -691,6 +701,15 @@
path = PrebidMobileDemoRenderingUITests;
sourceTree = "<group>";
};
3CC4A3E72C11F93A00B97128 /* CustomRenderer */ = {
isa = PBXGroup;
children = (
3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */,
3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */,
);
path = CustomRenderer;
sourceTree = "<group>";
};
5397BD122936180600ABDA22 /* OriginalAPI */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -828,6 +847,7 @@
34B10A2F255017DE00B5FE09 /* ThreadCheckingButton.swift */,
34C25816255D69E1000A4A73 /* EventReportContainer.swift */,
530E722B292FACB20025B44D /* UIImageView+Extensions.swift */,
3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -1166,6 +1186,7 @@
};
93FED9C21A376EFE009A6E9F = {
CreatedOnToolsVersion = 6.1.1;
DevelopmentTeam = 9TN4TUCG8N;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
Expand Down Expand Up @@ -1536,6 +1557,7 @@
53A651852AC200AA000D42E4 /* PrebidOriginalAPIMultiformatNativeStylesController.swift in Sources */,
53ED2FD729798104007D13EE /* UtilitiesViewController.swift in Sources */,
53ED2FD829798104007D13EE /* AdMobNativeAdView.swift in Sources */,
3CC4A3EA2C11F96800B97128 /* CustomRendererBannerController.swift in Sources */,
53ED2FD929798104007D13EE /* PrebidGAMInterstitialController.swift in Sources */,
53ED2FDA29798104007D13EE /* PrebidMAXRewardedController.swift in Sources */,
53ED2FDB29798104007D13EE /* PrebidMAXNativeController.swift in Sources */,
Expand All @@ -1555,6 +1577,7 @@
53ED2FE829798104007D13EE /* PrebidBannerController.swift in Sources */,
53ED2FE929798104007D13EE /* PrebidBannerConfigurationController.swift in Sources */,
53ED2FEA29798104007D13EE /* TestCase.swift in Sources */,
3C28C9DC2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */,
53ED2FEB29798104007D13EE /* PrebidAdMobNativeViewController.swift in Sources */,
53ED2FEC29798104007D13EE /* PrebidInterstitialController.swift in Sources */,
53ED2FED29798104007D13EE /* PrebidOriginalAPIDisplayInterstitialController.swift in Sources */,
Expand Down Expand Up @@ -1600,6 +1623,7 @@
53ED301229798104007D13EE /* ReactiveSdkInitFlag.swift in Sources */,
53ED301329798104007D13EE /* PrebidOriginalAPINativeBannerController.swift in Sources */,
53ED301429798104007D13EE /* TestCasesSectionsViewController.swift in Sources */,
3C28C9D92C35713B00D0A7DB /* CustomRendererInterstitialController.swift in Sources */,
53ED301529798104007D13EE /* AppSettingsKeys.swift in Sources */,
53ED301729798104007D13EE /* NativeEventTracker+Extensions.swift in Sources */,
53ED301829798104007D13EE /* PrebidRewardedController.swift in Sources */,
Expand Down Expand Up @@ -1630,6 +1654,7 @@
53A651842AC200AA000D42E4 /* PrebidOriginalAPIMultiformatNativeStylesController.swift in Sources */,
34E5698A237DB96900B47B01 /* UtilitiesViewController.swift in Sources */,
92ABD58C279DA7E200AFDFF6 /* AdMobNativeAdView.swift in Sources */,
3CC4A3E92C11F96800B97128 /* CustomRendererBannerController.swift in Sources */,
34BA95FE249CBF05006AE372 /* PrebidGAMInterstitialController.swift in Sources */,
92221CE52804BBB6005DF671 /* PrebidMAXRewardedController.swift in Sources */,
92986537280604E4007A2F34 /* PrebidMAXNativeController.swift in Sources */,
Expand All @@ -1649,6 +1674,7 @@
3493022224740BEE004A6086 /* PrebidBannerController.swift in Sources */,
5BDB85DA2739794900A529F6 /* PrebidBannerConfigurationController.swift in Sources */,
5B3EEDE52101FB8800BAA0C4 /* TestCase.swift in Sources */,
3C28C9DB2C357E3500D0A7DB /* SampleCustomRenderer.swift in Sources */,
92C475122796FF8400C26E27 /* PrebidAdMobNativeViewController.swift in Sources */,
34FC0CF424ADD3A80045553E /* PrebidInterstitialController.swift in Sources */,
5397BD26293760F500ABDA22 /* PrebidOriginalAPIDisplayInterstitialController.swift in Sources */,
Expand Down Expand Up @@ -1694,6 +1720,7 @@
346C6F5725DFAB7E00457DD3 /* ReactiveSdkInitFlag.swift in Sources */,
5397BD2C2937764100ABDA22 /* PrebidOriginalAPINativeBannerController.swift in Sources */,
5B3EEDE22101EDA200BAA0C4 /* TestCasesSectionsViewController.swift in Sources */,
3C28C9D82C35713B00D0A7DB /* CustomRendererInterstitialController.swift in Sources */,
ACC41ACD2444EADB00B9A3A7 /* AppSettingsKeys.swift in Sources */,
92C4E60D27A2F6D700738370 /* NativeEventTracker+Extensions.swift in Sources */,
34BA9600249CC118006AE372 /* PrebidRewardedController.swift in Sources */,
Expand Down Expand Up @@ -2092,10 +2119,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 9TN4TUCG8N;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -2125,10 +2151,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 9TN4TUCG8N;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,24 @@ struct TestCaseManager {
setupCustomParams(for: bannerController.prebidConfigId)
}),

TestCase(title: "Banner 320x50 (CustomRenderer)",
tags: [.banner, .inapp, .server],
exampleVCStoryboardID: "AdapterViewController",
configurationClosure: { vc in
guard let adapterVC = vc as? AdapterViewController else {
return
}

let bannerController = CustomRendererBannerController(rootController: adapterVC)
bannerController.adSizes = [CGSize(width: 320, height: 50)]

bannerController.prebidConfigId = "prebid-ita-banner-320-50-meta-custom-renderer";

adapterVC.setup(adapter: bannerController)

setupCustomParams(for: bannerController.prebidConfigId)
}),

TestCase(title: "Banner 320x50 Server-Side Creative Factory Timeout (In-App)",
tags: [.banner, .inapp, .server],
exampleVCStoryboardID: "AdapterViewController",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*   Copyright 2018-2021 Prebid.org, Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
import Foundation
import PrebidMobile
import UIKit

public class SampleCustomRenderer: NSObject, PrebidMobilePluginRenderer {

public let name = "SampleCustomRenderer"

public let version = "1.0.0"

public var data: [AnyHashable: Any]? = nil

private var adViewManager: PBMAdViewManager?

public func isSupportRendering(for format: AdFormat?) -> Bool {
AdFormat.allCases.contains(where: { $0 == format })
}

public func setupBid(_ bid: Bid, adConfiguration: AdUnitConfig, connection: PrebidServerConnectionProtocol) {

}

public func createBannerAdView(with frame: CGRect, bid: Bid, adConfiguration: AdUnitConfig,
connection: PrebidServerConnectionProtocol, adViewDelegate: (any PBMAdViewDelegate)?) {
DispatchQueue.main.async {
if let window = UIApplication.shared.windows.first(where: { $0.isKeyWindow }),
let rootView = window.rootViewController?.view {
if let prebidBannerView = self.findPrebidBannerView(in: rootView) {
print("Found PrebidBannerView: \(prebidBannerView)")

let label = UILabel()
label.text = "Prebid SDK - Custom Renderer"
label.textAlignment = .center
label.textColor = .black
label.backgroundColor = .yellow
label.translatesAutoresizingMaskIntoConstraints = false

prebidBannerView.addSubview(label)

NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: prebidBannerView.centerXAnchor),
label.centerYAnchor.constraint(equalTo: prebidBannerView.centerYAnchor),
label.widthAnchor.constraint(equalTo: prebidBannerView.widthAnchor),
label.heightAnchor.constraint(equalTo: prebidBannerView.heightAnchor)
])

} else {
print("PrebidBannerView not found.")
}
}
}
}

private func findPrebidBannerView(in view: UIView) -> UIView? {
if view.accessibilityIdentifier == "PrebidBannerView" {
return view
}
for subview in view.subviews {
if let foundView = findPrebidBannerView(in: subview) {
return foundView
}
}
return nil
}

public func createInterstitialController(bid: Bid, adConfiguration: AdUnitConfig, connection: PrebidServerConnectionProtocol,
adViewManagerDelegate adViewDelegate: InterstitialController?, videoControlsConfig: VideoControlsConfiguration?) {
}
}
Loading