From 936648cdbe34adda2852cf7358802f2303b8edd9 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 16 Jul 2024 10:33:54 -0500 Subject: [PATCH 1/3] Added support for privacyURL --- .../Sources/PrebidAdMobNativeAdapter.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift index 6f12784dd..8a740bf5b 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift @@ -45,6 +45,15 @@ public class PrebidAdMobNativeAdapter: public var store: String? + public var privacyUrl: String? { + set { + prebidNativeAd?.nativeAdMarkup?.privacy = newValue + } + get { + return prebidNativeAd?.nativeAdMarkup?.privacy + } + } + public var price: String? { prebidNativeAd?.dataObjects(of: .salePrice).first?.value } From 7eab8398017d7d6f1c077c377c963c5ae842b0dd Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Thu, 25 Jul 2024 09:30:31 -0500 Subject: [PATCH 2/3] Fix was added to the wrong class. --- .../Sources/PrebidAdMobNativeAdapter.swift | 9 --------- PrebidMobile/AdUnits/Native/NativeAd.swift | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift index 8a740bf5b..6f12784dd 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift @@ -45,15 +45,6 @@ public class PrebidAdMobNativeAdapter: public var store: String? - public var privacyUrl: String? { - set { - prebidNativeAd?.nativeAdMarkup?.privacy = newValue - } - get { - return prebidNativeAd?.nativeAdMarkup?.privacy - } - } - public var price: String? { prebidNativeAd?.dataObjects(of: .salePrice).first?.value } diff --git a/PrebidMobile/AdUnits/Native/NativeAd.swift b/PrebidMobile/AdUnits/Native/NativeAd.swift index 39e59b27d..79a1c9b5c 100644 --- a/PrebidMobile/AdUnits/Native/NativeAd.swift +++ b/PrebidMobile/AdUnits/Native/NativeAd.swift @@ -42,6 +42,15 @@ public class NativeAd: NSObject, CacheExpiryDelegate { private let eventManager = EventManager() + public var privacyUrl: String? { + set { + nativeAdMarkup?.privacy = newValue + } + get { + return nativeAdMarkup?.privacy + } + } + // MARK: - Array getters @objc public var titles: [NativeTitle] { From 9b55c549cf32067bf70293086c3339822a288e00 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 3 Sep 2024 09:37:46 -0500 Subject: [PATCH 3/3] Fixed broken build --- .../InternalTestApp.xcodeproj/project.pbxproj | 6 -- .../Utilities/SampleCustomRenderer.swift | 83 ------------------- PrebidMobile.xcodeproj/project.pbxproj | 4 + .../SampleCustomRenderer.swift | 2 +- .../TestUtils.xcodeproj/project.pbxproj | 12 --- 5 files changed, 5 insertions(+), 102 deletions(-) delete mode 100644 InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift rename {tools/TestUtils/TestUtils/SamplePluginRegister => PrebidMobile/PrebidMobileRendering/PluginRenderer}/SampleCustomRenderer.swift (99%) diff --git a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj index f923c4532..d2cf1fe9b 100644 --- a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj +++ b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj @@ -27,8 +27,6 @@ 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 */; }; @@ -381,7 +379,6 @@ 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 = ""; }; 3C28C9D72C35713B00D0A7DB /* CustomRendererInterstitialController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererInterstitialController.swift; sourceTree = ""; }; - 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = ""; }; 3CC4A3E82C11F96800B97128 /* CustomRendererBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererBannerController.swift; sourceTree = ""; }; 530E722B292FACB20025B44D /* UIImageView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Extensions.swift"; sourceTree = ""; }; 5397BD132936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIDisplayBannerController.swift; sourceTree = ""; }; @@ -847,7 +844,6 @@ 34B10A2F255017DE00B5FE09 /* ThreadCheckingButton.swift */, 34C25816255D69E1000A4A73 /* EventReportContainer.swift */, 530E722B292FACB20025B44D /* UIImageView+Extensions.swift */, - 3C28C9DA2C357E3500D0A7DB /* SampleCustomRenderer.swift */, ); path = Utilities; sourceTree = ""; @@ -1577,7 +1573,6 @@ 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 */, @@ -1674,7 +1669,6 @@ 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 */, diff --git a/InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift b/InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift deleted file mode 100644 index 5fd7d86b3..000000000 --- a/InternalTestApp/PrebidMobileDemoRendering/Utilities/SampleCustomRenderer.swift +++ /dev/null @@ -1,83 +0,0 @@ -/*   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?) { - } -} diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index ce63f7648..23bc8fcba 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -780,6 +780,7 @@ A908694629E05F7900B37479 /* PrebidRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A908694529E05F7900B37479 /* PrebidRenderer.swift */; }; A9750D7A2ABB9A300066E4E6 /* PluginEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */; }; A9A3396B2AC57193006AD0E7 /* PBMAdViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */; }; + F95DA2072C87567D0068A2BB /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */; }; FA5AD5E42271FA4100C8F274 /* ConstantsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */; }; FA9D7F2722E8A83D006FCBEF /* AdViewUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9D7F2622E8A83D006FCBEF /* AdViewUtilsTests.swift */; }; FAA29904242D1C27002ACBF2 /* TargetingObjCTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA29903242D1C27002ACBF2 /* TargetingObjCTests.m */; }; @@ -1672,6 +1673,7 @@ A908694529E05F7900B37479 /* PrebidRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidRenderer.swift; sourceTree = ""; }; A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginEventListener.swift; sourceTree = ""; }; A9A3396A2AC57193006AD0E7 /* PBMAdViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBMAdViewDelegate.swift; sourceTree = ""; }; + F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = ""; }; FA4A88432497A99D00FDCBB6 /* Swizzling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swizzling.swift; sourceTree = ""; }; FA5AD5E32271FA4100C8F274 /* ConstantsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsTest.swift; sourceTree = ""; }; FA85F9B4264946FC00B8BE72 /* TestUtils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TestUtils.xcodeproj; path = ../tools/TestUtils/TestUtils.xcodeproj; sourceTree = ""; }; @@ -3184,6 +3186,7 @@ A908694029E05E8D00B37479 /* PluginRenderer */ = { isa = PBXGroup; children = ( + F95DA2062C87567D0068A2BB /* SampleCustomRenderer.swift */, A908694129E05EAF00B37479 /* PrebidMobilePluginRegister.swift */, A908694329E05ED500B37479 /* PrebidMobilePluginRenderer.swift */, A9750D792ABB9A300066E4E6 /* PluginEventListener.swift */, @@ -4154,6 +4157,7 @@ 537B6518283372FD008AE9D1 /* PathBuilder.swift in Sources */, FAEE4D1A262DC2B200AD9966 /* NativeAd.swift in Sources */, 5BC37A1B271F1D0000444D5E /* Prebid.swift in Sources */, + F95DA2072C87567D0068A2BB /* SampleCustomRenderer.swift in Sources */, 5BC379A8271F1D0000444D5E /* PBMModalViewController.m in Sources */, 5BC37AC3271F1D0100444D5E /* PBMURLComponents.m in Sources */, 5BC378D3271F1CFF00444D5E /* PBMORTBAbstract.m in Sources */, diff --git a/tools/TestUtils/TestUtils/SamplePluginRegister/SampleCustomRenderer.swift b/PrebidMobile/PrebidMobileRendering/PluginRenderer/SampleCustomRenderer.swift similarity index 99% rename from tools/TestUtils/TestUtils/SamplePluginRegister/SampleCustomRenderer.swift rename to PrebidMobile/PrebidMobileRendering/PluginRenderer/SampleCustomRenderer.swift index f27d68dbd..8ff5a684e 100644 --- a/tools/TestUtils/TestUtils/SamplePluginRegister/SampleCustomRenderer.swift +++ b/PrebidMobile/PrebidMobileRendering/PluginRenderer/SampleCustomRenderer.swift @@ -12,8 +12,8 @@  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 { diff --git a/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj b/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj index 2663a5f43..a9dcc57c2 100644 --- a/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj +++ b/tools/TestUtils/TestUtils.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 3CD0ADF12C51274A006CDA6B /* SampleCustomRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CD0ADF02C51274A006CDA6B /* SampleCustomRenderer.swift */; }; 53AB8AB22851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53AB8AB12851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework */; }; 53AB8AB32851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 53AB8AB12851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 92C0CEA027BD411E00C480EB /* emptyResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 92C0CE9F27BD411E00C480EB /* emptyResponse.json */; }; @@ -61,7 +60,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 3CD0ADF02C51274A006CDA6B /* SampleCustomRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleCustomRenderer.swift; sourceTree = ""; }; 537B669C283DFCCD008AE9D1 /* OMSDK_Prebidorg.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = OMSDK_Prebidorg.xcframework; path = ../../Frameworks/OMSDK_Prebidorg.xcframework; sourceTree = ""; }; 53AB8AB12851D9EF00837C70 /* OMSDK-Static_Prebidorg.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "OMSDK-Static_Prebidorg.xcframework"; path = "../../Frameworks/OMSDK-Static_Prebidorg.xcframework"; sourceTree = ""; }; 92C0CE9F27BD411E00C480EB /* emptyResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = emptyResponse.json; sourceTree = ""; }; @@ -114,14 +112,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3CD0ADEF2C5126FD006CDA6B /* SamplePluginRegister */ = { - isa = PBXGroup; - children = ( - 3CD0ADF02C51274A006CDA6B /* SampleCustomRenderer.swift */, - ); - path = SamplePluginRegister; - sourceTree = ""; - }; 537B669B283DFCCD008AE9D1 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -151,7 +141,6 @@ FA9E5E0F2649420C0049B214 /* TestUtils */ = { isa = PBXGroup; children = ( - 3CD0ADEF2C5126FD006CDA6B /* SamplePluginRegister */, FAC853582649462E009DC0F3 /* Category */, FAC8536726494646009DC0F3 /* Responses */, FAC8537B26494647009DC0F3 /* Stubbing */, @@ -322,7 +311,6 @@ buildActionMask = 2147483647; files = ( FAC8535B2649462E009DC0F3 /* NSURLRequest+HTTPBodyTesting.m in Sources */, - 3CD0ADF12C51274A006CDA6B /* SampleCustomRenderer.swift in Sources */, FAC8539926494647009DC0F3 /* PBHTTPStubbingManager.m in Sources */, FAC8539A26494647009DC0F3 /* PBURLConnectionStub+NSURLSessionConfiguration.m in Sources */, FAC853652649463A009DC0F3 /* PBTestGlobal.m in Sources */,