From 3dd14b60bea0ec06ac8fa6ceb739aa2c1ee36caa Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Wed, 4 Dec 2024 22:25:56 +0200 Subject: [PATCH] feat: minor corrections --- .../SampleRenderers/SampleAdViewRenderer.m | 2 +- .../SampleInterstitialRenderer.m | 2 +- ...ayBannerPluginRendererViewController.swift | 3 +- .../SampleInterstitialController.swift | 2 +- .../SampleCustomAdViewRenderer.swift | 77 ----------------- .../SampleCustomRenderer.swift | 83 ------------------- .../DisplayViewInteractionDelegate.swift | 2 +- 7 files changed, 6 insertions(+), 165 deletions(-) delete mode 100644 InternalTestApp/PrebidMobileDemoRendering/SampleCustomAdViewRenderer.swift delete mode 100644 InternalTestApp/PrebidMobileDemoRendering/SampleCustomRenderer.swift diff --git a/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleAdViewRenderer.m b/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleAdViewRenderer.m index f4e67182e..ccb88550b 100644 --- a/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleAdViewRenderer.m +++ b/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleAdViewRenderer.m @@ -31,7 +31,7 @@ - (instancetype)init { } - (BOOL)isSupportRenderingFor:(AdFormat *)format { - return YES; + return [@[AdFormat.banner, AdFormat.video] containsObject:format]; } - (UIView * _Nullable)createAdViewWith:(CGRect)frame diff --git a/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleInterstitialRenderer.m b/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleInterstitialRenderer.m index e8a2f2716..1b2dfc402 100644 --- a/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleInterstitialRenderer.m +++ b/Example/PrebidDemo/PrebidDemoObjectiveC/Examples/InApp/SampleRenderers/SampleInterstitialRenderer.m @@ -32,7 +32,7 @@ - (instancetype)init { } - (BOOL)isSupportRenderingFor:(AdFormat *)format { - return YES; + return [@[AdFormat.banner, AdFormat.video] containsObject:format]; } - (id)createInterstitialControllerWithBid:(Bid *)bid diff --git a/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/InAppDisplayBannerPluginRendererViewController.swift b/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/InAppDisplayBannerPluginRendererViewController.swift index 1020b526a..e2167dc8f 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/InAppDisplayBannerPluginRendererViewController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/InAppDisplayBannerPluginRendererViewController.swift @@ -39,7 +39,8 @@ class InAppDisplayBannerPluginRendererViewController: BannerBaseViewController, // 3. Create a BannerView prebidBannerView = BannerView( frame: CGRect(origin: .zero, size: adSize), - configID: storedImpDisplayBanner, adSize: adSize + configID: storedImpDisplayBanner, + adSize: adSize ) // 4. Configure the BannerView diff --git a/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/SampleRenderers/SampleInterstitialController.swift b/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/SampleRenderers/SampleInterstitialController.swift index 1713dc68d..f591900ab 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/SampleRenderers/SampleInterstitialController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/Examples/In-App/SampleRenderers/SampleInterstitialController.swift @@ -1,4 +1,4 @@ -/*   Copyright 2018-2021 Prebid.org, Inc. +/*   Copyright 2018-2024 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. diff --git a/InternalTestApp/PrebidMobileDemoRendering/SampleCustomAdViewRenderer.swift b/InternalTestApp/PrebidMobileDemoRendering/SampleCustomAdViewRenderer.swift deleted file mode 100644 index 5651447b8..000000000 --- a/InternalTestApp/PrebidMobileDemoRendering/SampleCustomAdViewRenderer.swift +++ /dev/null @@ -1,77 +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 UIKit -import PrebidMobile - -public class SampleCustomBannerViewRenderer: NSObject, PrebidMobilePluginRenderer { - - public let name = "SampleCustomBannerViewRenderer" - public let version = "1.0.0" - public var data: [AnyHashable: Any]? - - public func isSupportRendering(for format: AdFormat?) -> Bool { - AdFormat.allCases.contains(where: { $0 == format }) - } - - private weak var loadingDelegate: DisplayViewLoadingDelegate? - private weak var interactionDelegate: DisplayViewInteractionDelegate? - private weak var currentAdView: UIView? - - public func createBannerAdView( - with frame: CGRect, - bid: Bid, - adConfiguration: AdUnitConfig, - connection: PrebidServerConnectionProtocol, - loadingDelegate: DisplayViewLoadingDelegate?, - interactionDelegate: DisplayViewInteractionDelegate? - ) -> UIView { - - self.interactionDelegate = interactionDelegate - self.loadingDelegate = loadingDelegate - - let bannerView = UIView(frame: frame) - - let label = UILabel() - label.text = "Prebid SDK - Custom Renderer" - label.textAlignment = .center - label.textColor = .black - label.backgroundColor = .yellow - label.translatesAutoresizingMaskIntoConstraints = false - - bannerView.addSubview(label) - - NSLayoutConstraint.activate([ - label.centerXAnchor.constraint(equalTo: bannerView.centerXAnchor), - label.centerYAnchor.constraint(equalTo: bannerView.centerYAnchor), - label.widthAnchor.constraint(equalTo: bannerView.widthAnchor), - label.heightAnchor.constraint(equalTo: bannerView.heightAnchor) - ]) - - currentAdView = bannerView - - loadingDelegate?.displayViewDidLoadAd(bannerView) - - return bannerView - } - - public func createInterstitialController( - bid: Bid, - adConfiguration: AdUnitConfig, - connection: PrebidServerConnectionProtocol, - adViewManagerDelegate adViewDelegate: InterstitialController?, - videoControlsConfig: VideoControlsConfiguration? - ) {} -} diff --git a/InternalTestApp/PrebidMobileDemoRendering/SampleCustomRenderer.swift b/InternalTestApp/PrebidMobileDemoRendering/SampleCustomRenderer.swift deleted file mode 100644 index 155d14b3c..000000000 --- a/InternalTestApp/PrebidMobileDemoRendering/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 UIKit -import PrebidMobile - -public class SampleCustomAdViewRenderer: NSObject, PrebidMobilePluginRenderer { - - public let name = "SampleCustomRenderer" - public let version = "1.0.0" - public var data: [AnyHashable: Any]? - - public func isSupportRendering(for format: AdFormat?) -> Bool { - AdFormat.allCases.contains(where: { $0 == format }) - } - - private weak var loadingDelegate: DisplayViewLoadingDelegate? - private weak var interactionDelegate: DisplayViewInteractionDelegate? - private weak var currentAdView: UIView? - - public func createBannerAdView( - with frame: CGRect, - bid: Bid, - adConfiguration: AdUnitConfig, - connection: PrebidServerConnectionProtocol, - loadingDelegate: DisplayViewLoadingDelegate?, - interactionDelegate: DisplayViewInteractionDelegate? - ) -> UIView { - - self.interactionDelegate = interactionDelegate - self.loadingDelegate = loadingDelegate - - let bannerView = UIView(frame: frame) - - let label = UILabel() - label.text = "Prebid SDK - Custom Renderer" - label.textAlignment = .center - label.textColor = .black - label.backgroundColor = .yellow - label.translatesAutoresizingMaskIntoConstraints = false - - bannerView.addSubview(label) - - NSLayoutConstraint.activate([ - label.centerXAnchor.constraint(equalTo: bannerView.centerXAnchor), - label.centerYAnchor.constraint(equalTo: bannerView.centerYAnchor), - label.widthAnchor.constraint(equalTo: bannerView.widthAnchor), - label.heightAnchor.constraint(equalTo: bannerView.heightAnchor) - ]) - - currentAdView = bannerView - - loadingDelegate?.displayViewDidLoadAd(bannerView) - - return bannerView - } - - public func createInterstitialController( - bid: Bid, - adConfiguration: AdUnitConfig, - connection: PrebidServerConnectionProtocol, - adViewManagerDelegate adViewDelegate: InterstitialController?, - videoControlsConfig: VideoControlsConfiguration? - ) {} - - public func setupBid( - _ bid: Bid, - adConfiguration: AdUnitConfig, - connection: PrebidServerConnectionProtocol - ) {} -} diff --git a/PrebidMobile/PrebidMobileRendering/Prebid/PBMCacheRenderers/DisplayView/DisplayViewInteractionDelegate.swift b/PrebidMobile/PrebidMobileRendering/Prebid/PBMCacheRenderers/DisplayView/DisplayViewInteractionDelegate.swift index 7fc3f3d48..17d82e7b1 100644 --- a/PrebidMobile/PrebidMobileRendering/Prebid/PBMCacheRenderers/DisplayView/DisplayViewInteractionDelegate.swift +++ b/PrebidMobile/PrebidMobileRendering/Prebid/PBMCacheRenderers/DisplayView/DisplayViewInteractionDelegate.swift @@ -37,7 +37,7 @@ public protocol DisplayViewInteractionDelegate: NSObjectProtocol { /// - displayView: The `UIView` instance associated with the modal presentation. @objc func willPresentModal(from displayView: UIView) - /// Notifies the delegate that a modal view has been dismissed and control has returned to the app. + /// Notifies the delegate that a modal view has been dismissed. /// /// - Parameters: /// - displayView: The `UIView` instance associated with the dismissed modal.