From a91434f44e944d4b40c4425ba0d6472b3267dddc Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk <92721590+OlenaPostindustria@users.noreply.github.com> Date: Mon, 31 Oct 2022 11:10:23 +0200 Subject: [PATCH] Update GMA SDK In PrebidMobileAdMobAdapters and PrebidMobileGAMEventHandlers (#696) * fix: fix available issue * feat: implement new gam banner mediation api * fix: fix size for Banner 320x50 (GAM) [Vanilla Prebid Order] * feat: sort files in PrebidMobile project * fix: fix building PrebidDemoSwift * fix: fix building PrebidDemoObjectiveC * feat: implement new gam sdk interstitial mediation api * feat: implement new gam rewarded and video interstitial mediation api * feat: implement new native mediation api * fix: remove check locationServicesEnabled that causes ui unresponsiveness * refactor: clean * fix: update to some recommended settings * feat: remove hard dependancy on version in AdMod pod spec * refactor: clear * feat: add GMA SDK version tests & update Podfile * feat: update Podfile * fix: fix building of demo apps * fix: revert team settings in InternalTestApp * fix: revert bundle id settings in InternalTestApp * feat: update AdMob tests --- .../EventHandlers.xcodeproj/project.pbxproj | 76 ++++------- .../Sources/AdMobAdaptersError.swift | 4 + .../Sources/AdMobMediationBannerUtils.swift | 20 ++- .../AdMobMediationInterstitialUtils.swift | 21 ++- .../Sources/AdMobMediationNativeUtils.swift | 32 ++--- .../Sources/AdMobMediationRewardedUtils.swift | 23 ++-- .../Sources/AdMobUtils.swift | 2 +- .../Sources/PrebidAdMobBannerAdapter.swift | 81 ++++++----- .../Sources/PrebidAdMobEventExtras.swift | 25 ---- .../PrebidAdMobInterstitialAdapter.swift | 95 ++++++------- .../PrebidAdMobMediationBaseAdapter.swift | 7 +- .../Sources/PrebidAdMobNativeAdapter.swift | 126 ++++++++++++++---- .../PrebidAdMobRewardedVideoAdapter.swift | 69 ++++++---- .../PrebidAdMobVideoInterstitialAdapter.swift | 98 +++++++------- .../PrebidMediatedUnifiedNativeAd.swift | 100 -------------- .../AdMobGMATests.swift | 38 ++++++ .../AdMobMediationUtilsTest.swift | 12 +- .../Sources/GAMUtils.swift | 5 + .../BoxTests/GAMBannerViewWrapperTest.swift | 4 +- .../GMATests.swift | 38 ++++++ .../PrebidDemo.xcodeproj/project.pbxproj | 10 +- .../PrebidDemoObjectiveC/AppDelegate.m | 3 + .../RenderingBannerViewController.m | 7 +- .../RenderingInterstitialViewController.m | 5 - .../PrebidDemoObjectiveC/ViewController.m | 4 +- .../PrebidDemoSwift/AppDelegate.swift | 2 +- .../PrebidDemoSwift/BannerController.swift | 12 +- .../InstreamVideoViewController.swift | 5 +- .../InterstitialViewController.swift | 16 +-- .../NativeAd/NativeInAppViewController.swift | 5 - .../NativeAd/NativeViewController.swift | 2 +- .../RewardedVideoController.swift | 4 - .../InternalTestApp.xcodeproj/project.pbxproj | 8 +- .../AppDelegate.swift | 4 +- .../Model/TestCasesManager.swift | 34 ++--- .../Resources/UnifiedNativeAdView.xib | 6 +- .../PrebidAdMobBannerViewController.swift | 59 ++++---- ...rebidAdMobInterstitialViewController.swift | 11 -- .../PrebidAdMobNativeViewController.swift | 5 +- .../PrebidAdMobRewardedViewController.swift | 8 +- .../TestCasesViewController.swift | 2 + .../UtilitiesViewController.swift | 20 +-- Podfile | 34 +++-- Podfile.lock | 93 +++++++------ PrebidMobile.xcodeproj/project.pbxproj | 14 +- .../MediationAPI/MediationUtils.swift | 6 +- .../Utilities/PBMLocationManager.m | 4 - PrebidMobileAdMobAdapters.podspec | 2 +- .../Dr.Prebid.xcodeproj/project.pbxproj | 4 +- 49 files changed, 612 insertions(+), 653 deletions(-) delete mode 100644 EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobEventExtras.swift delete mode 100644 EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidMediatedUnifiedNativeAd.swift create mode 100644 EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobGMATests.swift create mode 100644 EventHandlers/PrebidMobileGAMEventHandlersTests/GMATests.swift diff --git a/EventHandlers/EventHandlers.xcodeproj/project.pbxproj b/EventHandlers/EventHandlers.xcodeproj/project.pbxproj index 635c8595a..4be523e97 100644 --- a/EventHandlers/EventHandlers.xcodeproj/project.pbxproj +++ b/EventHandlers/EventHandlers.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 12360E4989D626E58508B440 /* Pods_PrebidMobileGAMEventHandlersTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 39183ECBC4E402BC48B3691D /* Pods_PrebidMobileGAMEventHandlersTests.framework */; }; 3405F94A250A555800268A77 /* PrebidMobileGAMEventHandlers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34B64D5C24F7E41600FDD9F4 /* PrebidMobileGAMEventHandlers.framework */; }; 3405F951250A55AE00268A77 /* GAMBannerViewWrapperTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3405F950250A55AE00268A77 /* GAMBannerViewWrapperTest.swift */; }; 344A7F09250B73FA00743A93 /* PropertyTestModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344A7F08250B73FA00743A93 /* PropertyTestModels.swift */; }; @@ -14,7 +15,8 @@ 344A7F0E250B749600743A93 /* GAMRequestWrapperTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344A7F0D250B749600743A93 /* GAMRequestWrapperTest.swift */; }; 344A7F14250B823F00743A93 /* GAMInterstitialAdWrapperTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344A7F13250B823F00743A93 /* GAMInterstitialAdWrapperTest.swift */; }; 344A7F1A250B8E5400743A93 /* GADRewardedAdWrapperTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344A7F19250B8E5400743A93 /* GADRewardedAdWrapperTest.swift */; }; - 4061C58DCF0AD6DF117242EA /* Pods_PrebidMobileAdMobAdaptersTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCB1E381265AD3A8E6AF13DA /* Pods_PrebidMobileAdMobAdaptersTests.framework */; }; + 53632B24290BC57A00139EF3 /* AdMobGMATests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53632B23290BC57A00139EF3 /* AdMobGMATests.swift */; }; + 53632B2C290BE17300139EF3 /* GMATests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53632B2B290BE17300139EF3 /* GMATests.swift */; }; 5B36172626370A8700AFA1C2 /* GAMUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B36172526370A8700AFA1C2 /* GAMUtils.swift */; }; 5B3617FC2638131A00AFA1C2 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B3617FB2638131A00AFA1C2 /* Constants.swift */; }; 5B36182326384C7D00AFA1C2 /* GAMRewardedEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B36182226384C7D00AFA1C2 /* GAMRewardedEventHandler.swift */; }; @@ -56,20 +58,18 @@ 92C1346927FC6B4900F96387 /* PrebidMobileMAXAdapters.h in Headers */ = {isa = PBXBuildFile; fileRef = 92C1345D27FC6B4900F96387 /* PrebidMobileMAXAdapters.h */; settings = {ATTRIBUTES = (Public, ); }; }; 92C474ED2795B57F00C26E27 /* AdMobMediationRewardedUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92C474EC2795B57E00C26E27 /* AdMobMediationRewardedUtils.swift */; }; 92C474F52795E1A600C26E27 /* PrebidAdMobMediationBaseAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92C474F42795E1A600C26E27 /* PrebidAdMobMediationBaseAdapter.swift */; }; - 92C474F92795ECDF00C26E27 /* PrebidAdMobEventExtras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92C474F82795ECDF00C26E27 /* PrebidAdMobEventExtras.swift */; }; - 92C7A867279A81EA000D31CB /* PrebidMediatedUnifiedNativeAd.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92C7A866279A81EA000D31CB /* PrebidMediatedUnifiedNativeAd.swift */; }; 92C7A869279AAEF2000D31CB /* AdMobMediationNativeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92C7A868279AAEF1000D31CB /* AdMobMediationNativeUtils.swift */; }; 92DDA43C278EE8ED0035F03E /* PrebidAdMobRewardedVideoAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92DDA43B278EE8EC0035F03E /* PrebidAdMobRewardedVideoAdapter.swift */; }; 92E924FB2769ED96002B57F3 /* PrebidAdMobBannerAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92E924FA2769ED96002B57F3 /* PrebidAdMobBannerAdapter.swift */; }; 92E924FD276A0FD8002B57F3 /* AdMobMediationBannerUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92E924FC276A0FD8002B57F3 /* AdMobMediationBannerUtils.swift */; }; 92E924FF276A193E002B57F3 /* AdMobAdaptersError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92E924FE276A193E002B57F3 /* AdMobAdaptersError.swift */; }; 92EB6DE52799FB4700470DEC /* PrebidAdMobNativeAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EB6DE42799FB4700470DEC /* PrebidAdMobNativeAdapter.swift */; }; - 92F182B3E3AC2C869402CDEE /* Pods_PrebidMobileGAMEventHandlersTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 492E16D3B90411A699792B3D /* Pods_PrebidMobileGAMEventHandlersTests.framework */; }; 92F4389E27688E8600FDC950 /* PrebidMobileAdMobAdapters.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92F4389627688E8600FDC950 /* PrebidMobileAdMobAdapters.framework */; }; 92F438A427688E8600FDC950 /* PrebidMobileAdMobAdapters.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F4389827688E8600FDC950 /* PrebidMobileAdMobAdapters.h */; settings = {ATTRIBUTES = (Public, ); }; }; 92F438BA276896FF00FDC950 /* PrebidMobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92F438B9276896FF00FDC950 /* PrebidMobile.framework */; }; C3E45723C24D15415F4FAB0C /* Pods_PrebidMobileGAMEventHandlers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC52FAF1C12304695E019A4D /* Pods_PrebidMobileGAMEventHandlers.framework */; }; - E3367CFE5A21B8F317CECC1A /* Pods_PrebidMobileMAXAdaptersTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57F41F8DFF5B0CB73E2815BB /* Pods_PrebidMobileMAXAdaptersTests.framework */; }; + D1059C00DE847D8091FB2541 /* Pods_PrebidMobileAdMobAdaptersTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75CB2A536AF6D4E751D46FBE /* Pods_PrebidMobileAdMobAdaptersTests.framework */; }; + D2FEF30160712DAAB98913EC /* Pods_PrebidMobileMAXAdaptersTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6E3D686EF908BFEAF1DF154 /* Pods_PrebidMobileMAXAdaptersTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -97,9 +97,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0380A405FEB3840C25F9898F /* Pods-PrebidMobileMoPubAdaptersTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMoPubAdaptersTests.release.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMoPubAdaptersTests/Pods-PrebidMobileMoPubAdaptersTests.release.xcconfig"; sourceTree = ""; }; - 0F60EA433BD40CBD44BA947E /* Pods_PrebidMobileMoPubAdaptersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileMoPubAdaptersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1CBDEDF7561DCC25D37722F5 /* Pods-PrebidMobileMoPubAdaptersTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMoPubAdaptersTests.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMoPubAdaptersTests/Pods-PrebidMobileMoPubAdaptersTests.debug.xcconfig"; sourceTree = ""; }; 237DEA65BB4F321230D3A510 /* Pods-PrebidMobileMAXAdaptersTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMAXAdaptersTests.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMAXAdaptersTests/Pods-PrebidMobileMAXAdaptersTests.debug.xcconfig"; sourceTree = ""; }; 240AB4FEB77E1AB79E9EC15A /* Pods_PrebidMobileAdMobAdapters.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileAdMobAdapters.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 329DD8224E4EC5A00AEA10F7 /* Pods-PrebidMobileMAXAdapters.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMAXAdapters.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMAXAdapters/Pods-PrebidMobileMAXAdapters.debug.xcconfig"; sourceTree = ""; }; @@ -113,11 +110,10 @@ 344A7F19250B8E5400743A93 /* GADRewardedAdWrapperTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GADRewardedAdWrapperTest.swift; sourceTree = ""; }; 34B64D5C24F7E41600FDD9F4 /* PrebidMobileGAMEventHandlers.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PrebidMobileGAMEventHandlers.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 34B64D5F24F7E41600FDD9F4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 39183ECBC4E402BC48B3691D /* Pods_PrebidMobileGAMEventHandlersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileGAMEventHandlersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 42CE6323AC67980202BFDE74 /* Pods-PrebidMobileAdMobAdapters.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileAdMobAdapters.release.xcconfig"; path = "Target Support Files/Pods-PrebidMobileAdMobAdapters/Pods-PrebidMobileAdMobAdapters.release.xcconfig"; sourceTree = ""; }; - 492E16D3B90411A699792B3D /* Pods_PrebidMobileGAMEventHandlersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileGAMEventHandlersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 52CBE87750DA32B6049DBA11 /* Pods_PrebidMobileMoPubAdapters.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileMoPubAdapters.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 553848D2FE06B31317288F97 /* Pods-PrebidMobileMoPubAdapters.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMoPubAdapters.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMoPubAdapters/Pods-PrebidMobileMoPubAdapters.debug.xcconfig"; sourceTree = ""; }; - 57F41F8DFF5B0CB73E2815BB /* Pods_PrebidMobileMAXAdaptersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileMAXAdaptersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 53632B23290BC57A00139EF3 /* AdMobGMATests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdMobGMATests.swift; sourceTree = ""; }; + 53632B2B290BE17300139EF3 /* GMATests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GMATests.swift; sourceTree = ""; }; 58B193FE14C1F3D7E795F7AC /* Pods-PrebidMobileMAXAdapters.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMAXAdapters.release.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMAXAdapters/Pods-PrebidMobileMAXAdapters.release.xcconfig"; sourceTree = ""; }; 5B36172526370A8700AFA1C2 /* GAMUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GAMUtils.swift; sourceTree = ""; }; 5B3617FB2638131A00AFA1C2 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; @@ -136,6 +132,7 @@ 5BF8E780263C363800341EE4 /* GAMRequestWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GAMRequestWrapper.swift; sourceTree = ""; }; 5BF8E788263C3B4000341EE4 /* GADNativeAdWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GADNativeAdWrapper.swift; sourceTree = ""; }; 5BF8E790263C400F00341EE4 /* GADCustomNativeAdWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GADCustomNativeAdWrapper.swift; sourceTree = ""; }; + 75CB2A536AF6D4E751D46FBE /* Pods_PrebidMobileAdMobAdaptersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileAdMobAdaptersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8E4C768ECDDB294B3CC3CF48 /* Pods-PrebidMobileMAXAdaptersTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMAXAdaptersTests.release.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMAXAdaptersTests/Pods-PrebidMobileMAXAdaptersTests.release.xcconfig"; sourceTree = ""; }; 914C447D75BBE960CE43225D /* Pods-PrebidMobileGAMEventHandlers.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileGAMEventHandlers.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileGAMEventHandlers/Pods-PrebidMobileGAMEventHandlers.debug.xcconfig"; sourceTree = ""; }; 92221CDC2804A0C3005DF671 /* PrebidMAXMediationAdapter+MAInterstitialAdapter+MARewardedAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PrebidMAXMediationAdapter+MAInterstitialAdapter+MARewardedAdapter.swift"; sourceTree = ""; }; @@ -164,8 +161,6 @@ 92C1346227FC6B4900F96387 /* PrebidMobileMAXAdaptersTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PrebidMobileMAXAdaptersTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 92C474EC2795B57E00C26E27 /* AdMobMediationRewardedUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdMobMediationRewardedUtils.swift; sourceTree = ""; }; 92C474F42795E1A600C26E27 /* PrebidAdMobMediationBaseAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidAdMobMediationBaseAdapter.swift; sourceTree = ""; }; - 92C474F82795ECDF00C26E27 /* PrebidAdMobEventExtras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidAdMobEventExtras.swift; sourceTree = ""; }; - 92C7A866279A81EA000D31CB /* PrebidMediatedUnifiedNativeAd.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidMediatedUnifiedNativeAd.swift; sourceTree = ""; }; 92C7A868279AAEF1000D31CB /* AdMobMediationNativeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdMobMediationNativeUtils.swift; sourceTree = ""; }; 92DDA43B278EE8EC0035F03E /* PrebidAdMobRewardedVideoAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidAdMobRewardedVideoAdapter.swift; sourceTree = ""; }; 92E924FA2769ED96002B57F3 /* PrebidAdMobBannerAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidAdMobBannerAdapter.swift; sourceTree = ""; }; @@ -178,10 +173,7 @@ 92F438B9276896FF00FDC950 /* PrebidMobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PrebidMobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9D58C5231BEDC27162AC3816 /* Pods-PrebidMobileAdMobAdaptersTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileAdMobAdaptersTests.release.xcconfig"; path = "Target Support Files/Pods-PrebidMobileAdMobAdaptersTests/Pods-PrebidMobileAdMobAdaptersTests.release.xcconfig"; sourceTree = ""; }; 9E2E8204E1C52CBA0D87C56C /* Pods-PrebidMobileAdMobAdapters.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileAdMobAdapters.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileAdMobAdapters/Pods-PrebidMobileAdMobAdapters.debug.xcconfig"; sourceTree = ""; }; - AC5A99A6267B63610064A2CA /* PrebidMobileRendering.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PrebidMobileRendering.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - AC5A99AA267B638C0064A2CA /* PrebidMobileRendering.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PrebidMobileRendering.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C5B3E8B0B44D8679109E1641 /* Pods-PrebidMobileMoPubAdapters.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileMoPubAdapters.release.xcconfig"; path = "Target Support Files/Pods-PrebidMobileMoPubAdapters/Pods-PrebidMobileMoPubAdapters.release.xcconfig"; sourceTree = ""; }; - CCB1E381265AD3A8E6AF13DA /* Pods_PrebidMobileAdMobAdaptersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileAdMobAdaptersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A6E3D686EF908BFEAF1DF154 /* Pods_PrebidMobileMAXAdaptersTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileMAXAdaptersTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D018605E7CEA3B29DC916A73 /* Pods_PrebidMobileMAXAdapters.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileMAXAdapters.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D1B77165045D380B64491D0E /* Pods-PrebidMobileGAMEventHandlersTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidMobileGAMEventHandlersTests.debug.xcconfig"; path = "Target Support Files/Pods-PrebidMobileGAMEventHandlersTests/Pods-PrebidMobileGAMEventHandlersTests.debug.xcconfig"; sourceTree = ""; }; EC52FAF1C12304695E019A4D /* Pods_PrebidMobileGAMEventHandlers.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidMobileGAMEventHandlers.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -195,7 +187,7 @@ buildActionMask = 2147483647; files = ( 3405F94A250A555800268A77 /* PrebidMobileGAMEventHandlers.framework in Frameworks */, - 92F182B3E3AC2C869402CDEE /* Pods_PrebidMobileGAMEventHandlersTests.framework in Frameworks */, + 12360E4989D626E58508B440 /* Pods_PrebidMobileGAMEventHandlersTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -222,7 +214,7 @@ buildActionMask = 2147483647; files = ( 92C1346327FC6B4900F96387 /* PrebidMobileMAXAdapters.framework in Frameworks */, - E3367CFE5A21B8F317CECC1A /* Pods_PrebidMobileMAXAdaptersTests.framework in Frameworks */, + D2FEF30160712DAAB98913EC /* Pods_PrebidMobileMAXAdaptersTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -240,7 +232,7 @@ buildActionMask = 2147483647; files = ( 92F4389E27688E8600FDC950 /* PrebidMobileAdMobAdapters.framework in Frameworks */, - 4061C58DCF0AD6DF117242EA /* Pods_PrebidMobileAdMobAdaptersTests.framework in Frameworks */, + D1059C00DE847D8091FB2541 /* Pods_PrebidMobileAdMobAdaptersTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -254,16 +246,12 @@ 92F438B9276896FF00FDC950 /* PrebidMobile.framework */, 5BCCF20F2732D1B10046CCFC /* PrebidMobile.framework */, 5BCCF2082732C6340046CCFC /* PrebidMobile.framework */, - AC5A99AA267B638C0064A2CA /* PrebidMobileRendering.framework */, - AC5A99A6267B63610064A2CA /* PrebidMobileRendering.framework */, EC52FAF1C12304695E019A4D /* Pods_PrebidMobileGAMEventHandlers.framework */, - 492E16D3B90411A699792B3D /* Pods_PrebidMobileGAMEventHandlersTests.framework */, - 52CBE87750DA32B6049DBA11 /* Pods_PrebidMobileMoPubAdapters.framework */, - 0F60EA433BD40CBD44BA947E /* Pods_PrebidMobileMoPubAdaptersTests.framework */, 240AB4FEB77E1AB79E9EC15A /* Pods_PrebidMobileAdMobAdapters.framework */, - CCB1E381265AD3A8E6AF13DA /* Pods_PrebidMobileAdMobAdaptersTests.framework */, D018605E7CEA3B29DC916A73 /* Pods_PrebidMobileMAXAdapters.framework */, - 57F41F8DFF5B0CB73E2815BB /* Pods_PrebidMobileMAXAdaptersTests.framework */, + 75CB2A536AF6D4E751D46FBE /* Pods_PrebidMobileAdMobAdaptersTests.framework */, + 39183ECBC4E402BC48B3691D /* Pods_PrebidMobileGAMEventHandlersTests.framework */, + A6E3D686EF908BFEAF1DF154 /* Pods_PrebidMobileMAXAdaptersTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -271,10 +259,11 @@ 3405F946250A555800268A77 /* PrebidMobileGAMEventHandlersTests */ = { isa = PBXGroup; children = ( + 3405F949250A555800268A77 /* Info.plist */, + 53632B2B290BE17300139EF3 /* GMATests.swift */, + 344A7F06250B73A700743A93 /* BoxTests */, 344A7F0A250B743900743A93 /* Extensions */, 344A7F07250B73BA00743A93 /* TestModels */, - 344A7F06250B73A700743A93 /* BoxTests */, - 3405F949250A555800268A77 /* Info.plist */, ); path = PrebidMobileGAMEventHandlersTests; sourceTree = ""; @@ -318,7 +307,6 @@ 34B64D5D24F7E41600FDD9F4 /* PrebidMobileGAMEventHandlers */, 3405F946250A555800268A77 /* PrebidMobileGAMEventHandlersTests */, 92C1345C27FC6B4900F96387 /* PrebidMobileMAXAdapters */, - 533101B72811478A00D95B5C /* PrebidMobileMAXAdaptersTests */, 34B64D4D24F7D95800FDD9F4 /* Products */, ); sourceTree = ""; @@ -349,13 +337,13 @@ isa = PBXGroup; children = ( 5B69677F2642A56A0042372E /* PrebidMobileGAMEventHandlers.h */, - 34C7C9E8250901410021C6D0 /* Boxes */, - 5B36172526370A8700AFA1C2 /* GAMUtils.swift */, 5B3617FB2638131A00AFA1C2 /* Constants.swift */, - 5B36182226384C7D00AFA1C2 /* GAMRewardedEventHandler.swift */, - 5BF8E6B6263AC32800341EE4 /* GAMInterstitialEventHandler.swift */, 5BF8E76D263BF4DF00341EE4 /* GAMBannerEventHandler.swift */, 5B69676F2642993B0042372E /* GAMEventHandlerError.swift */, + 5BF8E6B6263AC32800341EE4 /* GAMInterstitialEventHandler.swift */, + 5B36182226384C7D00AFA1C2 /* GAMRewardedEventHandler.swift */, + 5B36172526370A8700AFA1C2 /* GAMUtils.swift */, + 34C7C9E8250901410021C6D0 /* Boxes */, ); path = Sources; sourceTree = ""; @@ -373,13 +361,6 @@ path = Boxes; sourceTree = ""; }; - 533101B72811478A00D95B5C /* PrebidMobileMAXAdaptersTests */ = { - isa = PBXGroup; - children = ( - ); - path = PrebidMobileMAXAdaptersTests; - sourceTree = ""; - }; 927ADB28280583AF006EB8D5 /* Sources */ = { isa = PBXGroup; children = ( @@ -414,8 +395,6 @@ 92C474F42795E1A600C26E27 /* PrebidAdMobMediationBaseAdapter.swift */, 92EB6DE42799FB4700470DEC /* PrebidAdMobNativeAdapter.swift */, 92DDA43B278EE8EC0035F03E /* PrebidAdMobRewardedVideoAdapter.swift */, - 92C7A866279A81EA000D31CB /* PrebidMediatedUnifiedNativeAd.swift */, - 92C474F82795ECDF00C26E27 /* PrebidAdMobEventExtras.swift */, 9285B46527AAC5B1009BD3D3 /* PrebidAdMobVideoInterstitialAdapter.swift */, ); path = Sources; @@ -444,6 +423,7 @@ children = ( 928310072775FF7500D28142 /* PrebidMobileAdMobAdaptersTests-Bridging-Header.h */, 9281F68427A82C38004F18EC /* AdMobMediationUtilsTest.swift */, + 53632B23290BC57A00139EF3 /* AdMobGMATests.swift */, ); path = PrebidMobileAdMobAdaptersTests; sourceTree = ""; @@ -455,10 +435,6 @@ F06F98153B4FCC7F187B0A60 /* Pods-PrebidMobileGAMEventHandlers.release.xcconfig */, D1B77165045D380B64491D0E /* Pods-PrebidMobileGAMEventHandlersTests.debug.xcconfig */, 9258904A9C1DF637C07F290B /* Pods-PrebidMobileGAMEventHandlersTests.release.xcconfig */, - 553848D2FE06B31317288F97 /* Pods-PrebidMobileMoPubAdapters.debug.xcconfig */, - C5B3E8B0B44D8679109E1641 /* Pods-PrebidMobileMoPubAdapters.release.xcconfig */, - 1CBDEDF7561DCC25D37722F5 /* Pods-PrebidMobileMoPubAdaptersTests.debug.xcconfig */, - 0380A405FEB3840C25F9898F /* Pods-PrebidMobileMoPubAdaptersTests.release.xcconfig */, 9E2E8204E1C52CBA0D87C56C /* Pods-PrebidMobileAdMobAdapters.debug.xcconfig */, 42CE6323AC67980202BFDE74 /* Pods-PrebidMobileAdMobAdapters.release.xcconfig */, F7F666DB80A4C4141B6F1270 /* Pods-PrebidMobileAdMobAdaptersTests.debug.xcconfig */, @@ -934,6 +910,7 @@ 344A7F09250B73FA00743A93 /* PropertyTestModels.swift in Sources */, 344A7F0E250B749600743A93 /* GAMRequestWrapperTest.swift in Sources */, 5B7B133F26455C9600EBF42A /* GADCustomNativeAdWrapperTest.swift in Sources */, + 53632B2C290BE17300139EF3 /* GMATests.swift in Sources */, 344A7F1A250B8E5400743A93 /* GADRewardedAdWrapperTest.swift in Sources */, 5B7B134C26455E5400EBF42A /* GADNativeAdWrapperTest.swift in Sources */, 344A7F14250B823F00743A93 /* GAMInterstitialAdWrapperTest.swift in Sources */, @@ -993,9 +970,7 @@ files = ( 92DDA43C278EE8ED0035F03E /* PrebidAdMobRewardedVideoAdapter.swift in Sources */, 9267B400276FCF9300F1ADF1 /* AdMobConstants.swift in Sources */, - 92C474F92795ECDF00C26E27 /* PrebidAdMobEventExtras.swift in Sources */, 92C474F52795E1A600C26E27 /* PrebidAdMobMediationBaseAdapter.swift in Sources */, - 92C7A867279A81EA000D31CB /* PrebidMediatedUnifiedNativeAd.swift in Sources */, 92E924FD276A0FD8002B57F3 /* AdMobMediationBannerUtils.swift in Sources */, 9285B46627AAC5B1009BD3D3 /* PrebidAdMobVideoInterstitialAdapter.swift in Sources */, 92C7A869279AAEF2000D31CB /* AdMobMediationNativeUtils.swift in Sources */, @@ -1014,6 +989,7 @@ buildActionMask = 2147483647; files = ( 9281F68527A82C38004F18EC /* AdMobMediationUtilsTest.swift in Sources */, + 53632B24290BC57A00139EF3 /* AdMobGMATests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobAdaptersError.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobAdaptersError.swift index 7678a601d..c627aadfb 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobAdaptersError.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobAdaptersError.swift @@ -17,6 +17,7 @@ import Foundation enum AdMobAdaptersError { case emptyCustomEventExtras + case noTargetingInfoInEventExtras case noBidInEventExtras case noConfigIDInEventExtras case noServerParameter @@ -24,6 +25,7 @@ enum AdMobAdaptersError { case emptyUserKeywords case noAd case adNotValid + case adExpired } extension AdMobAdaptersError: LocalizedError { @@ -31,6 +33,7 @@ extension AdMobAdaptersError: LocalizedError { switch self { case .emptyCustomEventExtras : return "The custom event extras is empty" + case .noTargetingInfoInEventExtras : return "The targeting info dictionary is absent in the extras" case .noBidInEventExtras : return "The Bid object is absent in the extras" case .noConfigIDInEventExtras : return "The Config ID is absent in the extras" case .noServerParameter : return "Server parameter is absent in request" @@ -38,6 +41,7 @@ extension AdMobAdaptersError: LocalizedError { case .emptyUserKeywords : return "User keywords are empty" case .noAd : return "No ad available" case .adNotValid : return "Ad is not valid" + case .adExpired : return "Ad expired" } } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationBannerUtils.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationBannerUtils.swift index fd6921479..d4762a378 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationBannerUtils.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationBannerUtils.swift @@ -24,8 +24,6 @@ public class AdMobMediationBannerUtils: NSObject, PrebidMediationDelegate { public let bannerView: GADBannerView - private var eventExtras: [AnyHashable: Any]? - public init(gadRequest: GADRequest, bannerView: GADBannerView) { self.gadRequest = gadRequest self.bannerView = bannerView @@ -33,7 +31,9 @@ public class AdMobMediationBannerUtils: NSObject, PrebidMediationDelegate { } public func setUpAdObject(with values: [String: Any]) -> Bool { - eventExtras = values.isEmpty ? nil : values + let extras = GADCustomEventExtras() + extras.setExtras(values, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) gadRequest.keywords = AdMobUtils.buildKeywords(existingKeywords: gadRequest.keywords, targetingInfo: values[PBMMediationTargetingInfoKey] as? [String: String]) @@ -41,18 +41,16 @@ public class AdMobMediationBannerUtils: NSObject, PrebidMediationDelegate { } public func cleanUpAdObject() { - guard let gadKeywords = gadRequest.keywords as? [String] else { - return + if let gadKeywords = gadRequest.keywords { + gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) } - gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) - eventExtras = nil + + let extras = GADCustomEventExtras() + extras.setExtras(nil, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) } public func getAdView() -> UIView? { return bannerView } - - public func getEventExtras() -> [AnyHashable: Any]? { - return eventExtras - } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationInterstitialUtils.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationInterstitialUtils.swift index 450576edd..6a6ef2da1 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationInterstitialUtils.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationInterstitialUtils.swift @@ -22,34 +22,31 @@ public class AdMobMediationInterstitialUtils: NSObject, PrebidMediationDelegate public let gadRequest: GADRequest - private var eventExtras: [AnyHashable: Any]? - public init(gadRequest: GADRequest) { self.gadRequest = gadRequest super.init() } public func setUpAdObject(with values: [String: Any]) -> Bool { - eventExtras = values.isEmpty ? nil : values + let extras = GADCustomEventExtras() + extras.setExtras(values, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) gadRequest.keywords = AdMobUtils.buildKeywords(existingKeywords: gadRequest.keywords, targetingInfo: values[PBMMediationTargetingInfoKey] as? [String: String]) - return true } public func cleanUpAdObject() { - guard let gadKeywords = gadRequest.keywords as? [String] else { - return + if let gadKeywords = gadRequest.keywords { + gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) } - gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) - eventExtras = nil + + let extras = GADCustomEventExtras() + extras.setExtras(nil, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) } public func getAdView() -> UIView? { return nil } - - public func getEventExtras() -> [AnyHashable: Any]? { - return eventExtras - } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationNativeUtils.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationNativeUtils.swift index ab94e90a2..99365318d 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationNativeUtils.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationNativeUtils.swift @@ -22,15 +22,15 @@ public class AdMobMediationNativeUtils: NSObject, PrebidMediationDelegate { public let gadRequest: GADRequest - private var eventExtras: [AnyHashable: Any]? - public init(gadRequest: GADRequest) { self.gadRequest = gadRequest super.init() } public func setUpAdObject(with values: [String: Any]) -> Bool { - eventExtras = values.isEmpty ? nil : values + let extras = GADCustomEventExtras() + extras.setExtras(values, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) gadRequest.keywords = AdMobUtils.buildKeywords(existingKeywords: gadRequest.keywords, targetingInfo: values[PBMMediationTargetingInfoKey] as? [String: String]) @@ -38,30 +38,16 @@ public class AdMobMediationNativeUtils: NSObject, PrebidMediationDelegate { } public func cleanUpAdObject() { - guard let gadKeywords = gadRequest.keywords as? [String] else { - return + if let gadKeywords = gadRequest.keywords { + gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) } - gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) - eventExtras = nil + + let extras = GADCustomEventExtras() + extras.setExtras(nil, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) } public func getAdView() -> UIView? { return nil } - - public func getEventExtras() -> [AnyHashable: Any]? { - return eventExtras - } - - public static func findNative(_ extras: [AnyHashable : Any], - completion: @escaping (Result) -> Void) { - - switch MediationNativeUtils.findNative(in: extras) { - case .success(let nativeAd): - let admobUnifiedAd = PrebidMediatedUnifiedNativeAd(nativeAd: nativeAd) - completion(.success(admobUnifiedAd)) - case .failure(let error): - completion(.failure(error)) - } - } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationRewardedUtils.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationRewardedUtils.swift index 83b477554..4ff754c4f 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationRewardedUtils.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobMediationRewardedUtils.swift @@ -22,36 +22,31 @@ public class AdMobMediationRewardedUtils: NSObject, PrebidMediationDelegate { public let gadRequest: GADRequest - private var eventExtras: [AnyHashable: Any]? - public init(gadRequest: GADRequest) { self.gadRequest = gadRequest super.init() } public func setUpAdObject(with values: [String: Any]) -> Bool { - eventExtras = values.isEmpty ? nil : values + let extras = GADCustomEventExtras() + extras.setExtras(values, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) gadRequest.keywords = AdMobUtils.buildKeywords(existingKeywords: gadRequest.keywords, targetingInfo: values[PBMMediationTargetingInfoKey] as? [String: String]) - gadRequest.register(PrebidAdMobEventExtras(additionalParameters: eventExtras ?? [:])) - return true } public func cleanUpAdObject() { - guard let gadKeywords = gadRequest.keywords as? [String] else { - return + if let gadKeywords = gadRequest.keywords { + gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) } - gadRequest.keywords = AdMobUtils.removeHBKeywordsFrom(gadKeywords) - gadRequest.removeAdNetworkExtras(for: PrebidAdMobEventExtras.self) - eventExtras = nil + + let extras = GADCustomEventExtras() + extras.setExtras(nil, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) + gadRequest.register(extras) } public func getAdView() -> UIView? { return nil } - - public func getEventExtras() -> [AnyHashable: Any]? { - return eventExtras - } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobUtils.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobUtils.swift index 3f9348bf4..5368c5bc0 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobUtils.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/AdMobUtils.swift @@ -30,7 +30,7 @@ public class AdMobUtils: NSObject { .filter { !$0.hasPrefix(HBKeywordPrefix) } } - static func buildKeywords(existingKeywords: [Any]?, targetingInfo: [String: String]?) -> [Any]? { + static func buildKeywords(existingKeywords: [String]?, targetingInfo: [String: String]?) -> [String]? { guard let targetingInfo = targetingInfo else { return nil } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobBannerAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobBannerAdapter.swift index 01ee8393a..07822e3f3 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobBannerAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobBannerAdapter.swift @@ -19,56 +19,64 @@ import GoogleMobileAds @objc(PrebidAdMobBannerAdapter) public class PrebidAdMobBannerAdapter: - NSObject, - GADCustomEventBanner, + PrebidAdMobMediationBaseAdapter, + GADMediationBannerAd, DisplayViewLoadingDelegate, DisplayViewInteractionDelegate { - public weak var delegate: GADCustomEventBannerDelegate? + public var view: UIView { + return displayView ?? UIView() + } - public var displayView: PBMDisplayView? + var displayView: PBMDisplayView? - required public override init() { - super.init() - } + weak var delegate: GADMediationBannerAdEventDelegate? + var adConfiguration: GADMediationBannerAdConfiguration? + var completionHandler: GADMediationBannerLoadCompletionHandler? - public func requestAd(_ adSize: GADAdSize, parameter serverParameter: String?, label serverLabel: String?, request: GADCustomEventRequest) { - guard let keywords = request.userKeywords as? [String] else { - let error = AdMobAdaptersError.emptyUserKeywords - delegate?.customEventBanner(self, didFailAd: error) + public func loadBanner(for adConfiguration: GADMediationBannerAdConfiguration, + completionHandler: @escaping GADMediationBannerLoadCompletionHandler) { + self.adConfiguration = adConfiguration + self.completionHandler = completionHandler + + guard let serverParameter = adConfiguration.credentials.settings["parameter"] as? String else { + let error = AdMobAdaptersError.noServerParameter + delegate = completionHandler(nil, error) return } - guard let serverParameter = serverParameter else { - let error = AdMobAdaptersError.noServerParameter - delegate?.customEventBanner(self, didFailAd: error) + guard let eventExtras = adConfiguration.extras as? GADCustomEventExtras, + let eventExtrasDictionary = eventExtras.extras(forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel), + !eventExtrasDictionary.isEmpty else { + let error = AdMobAdaptersError.emptyCustomEventExtras + delegate = completionHandler(nil, error) return } - guard MediationUtils.isServerParameterInTargetingInfo(serverParameter, keywords) else { - let error = AdMobAdaptersError.wrongServerParameter - delegate?.customEventBanner(self, didFailAd: error) + guard let targetingInfo = eventExtrasDictionary[PBMMediationTargetingInfoKey] as? [String: String] else { + let error = AdMobAdaptersError.noTargetingInfoInEventExtras + delegate = completionHandler(nil, error) return } - guard let eventExtras = request.additionalParameters, !eventExtras.isEmpty else { - let error = AdMobAdaptersError.emptyCustomEventExtras - delegate?.customEventBanner(self, didFailAd: error) + guard MediationUtils.isServerParameterInTargetingInfoDict(serverParameter, targetingInfo) else { + let error = AdMobAdaptersError.wrongServerParameter + delegate = completionHandler(nil, error) return } - guard let bid = eventExtras[PBMMediationAdUnitBidKey] as? Bid else { + guard let bid = eventExtrasDictionary[PBMMediationAdUnitBidKey] as? Bid else { let error = AdMobAdaptersError.noBidInEventExtras - delegate?.customEventBanner(self, didFailAd: error) + delegate = completionHandler(nil, error) return } - guard let configId = eventExtras[PBMMediationConfigIdKey] as? String else { + guard let configId = eventExtrasDictionary[PBMMediationConfigIdKey] as? String else { let error = AdMobAdaptersError.noConfigIDInEventExtras - delegate?.customEventBanner(self, didFailAd: error) + delegate = completionHandler(nil, error) return } - + let frame = CGRect(origin: .zero, size: bid.size) displayView = PBMDisplayView(frame: frame, bid: bid, configId: configId) @@ -81,36 +89,37 @@ public class PrebidAdMobBannerAdapter: // MARK: - DisplayViewLoadingDelegate public func displayViewDidLoadAd(_ displayView: PBMDisplayView) { - delegate?.customEventBanner(self, didReceiveAd: displayView) + if let handler = completionHandler { + delegate = handler(self, nil) + } } - public func displayView(_ displayView: PBMDisplayView, didFailWithError error: Error) { - delegate?.customEventBanner(self, didFailAd: error) + if let handler = completionHandler { + delegate = handler(nil, error) + } } // MARK: - PBMDisplayViewInteractionDelegate public func trackImpression(forDisplayView: PBMDisplayView) { - //Impressions will be tracked automatically - //unless enableAutomaticImpressionAndClickTracking = NO + delegate?.reportImpression() } public func viewControllerForModalPresentation(fromDisplayView: PBMDisplayView) -> UIViewController? { - return delegate?.viewControllerForPresentingModalView + return adConfiguration?.topViewController ?? UIApplication.shared.windows.first?.rootViewController } public func didLeaveApp(from displayView: PBMDisplayView) { - delegate?.customEventBannerWillLeaveApplication(self) + delegate?.reportClick() } public func willPresentModal(from displayView: PBMDisplayView) { - delegate?.customEventBannerWillPresentModal(self) - delegate?.customEventBannerWasClicked(self) + delegate?.willPresentFullScreenView() } public func didDismissModal(from displayView: PBMDisplayView) { - delegate?.customEventBannerWillDismissModal(self) - delegate?.customEventBannerDidDismissModal(self) + delegate?.willDismissFullScreenView() + delegate?.didDismissFullScreenView() } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobEventExtras.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobEventExtras.swift deleted file mode 100644 index 2898fe339..000000000 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobEventExtras.swift +++ /dev/null @@ -1,25 +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 GoogleMobileAds - -public class PrebidAdMobEventExtras: NSObject, GADAdNetworkExtras { - public var additionalParameters: [AnyHashable: Any] - - public init(additionalParameters: [AnyHashable: Any]) { - self.additionalParameters = additionalParameters - } -} diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobInterstitialAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobInterstitialAdapter.swift index 9b79641dc..d7c796d05 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobInterstitialAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobInterstitialAdapter.swift @@ -19,58 +19,60 @@ import PrebidMobile @objc(PrebidAdMobInterstitialAdapter) public class PrebidAdMobInterstitialAdapter: - NSObject, - GADCustomEventInterstitial, + PrebidAdMobMediationBaseAdapter, + GADMediationInterstitialAd, InterstitialControllerLoadingDelegate, InterstitialControllerInteractionDelegate { - + // MARK: - Private Properties var interstitialController: InterstitialController? weak var rootViewController: UIViewController? var adAvailable = false - public weak var delegate: GADCustomEventInterstitialDelegate? - - required public override init() { - super.init() - } + public weak var delegate: GADMediationInterstitialAdEventDelegate? + var completionHandler: GADMediationInterstitialLoadCompletionHandler? - // MARK: - GADCustomEventInterstitial - public func requestAd(withParameter serverParameter: String?, label serverLabel: String?, request: GADCustomEventRequest) { - guard let keywords = request.userKeywords as? [String] else { - let error = AdMobAdaptersError.emptyUserKeywords - delegate?.customEventInterstitial(self, didFailAd: error) + public func loadInterstitial(for adConfiguration: GADMediationInterstitialAdConfiguration, + completionHandler: @escaping GADMediationInterstitialLoadCompletionHandler) { + + self.completionHandler = completionHandler + + guard let serverParameter = adConfiguration.credentials.settings["parameter"] as? String else { + let error = AdMobAdaptersError.noServerParameter + delegate = completionHandler(nil, error) return } - guard let serverParameter = serverParameter else { - let error = AdMobAdaptersError.noServerParameter - delegate?.customEventInterstitial(self, didFailAd: error) + guard let eventExtras = adConfiguration.extras as? GADCustomEventExtras, + let eventExtrasDictionary = eventExtras.extras(forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel), + !eventExtrasDictionary.isEmpty else { + let error = AdMobAdaptersError.emptyCustomEventExtras + delegate = completionHandler(nil, error) return } - guard MediationUtils.isServerParameterInTargetingInfo(serverParameter, keywords) else { - let error = AdMobAdaptersError.wrongServerParameter - delegate?.customEventInterstitial(self, didFailAd: error) + guard let targetingInfo = eventExtrasDictionary[PBMMediationTargetingInfoKey] as? [String: String] else { + let error = AdMobAdaptersError.noTargetingInfoInEventExtras + delegate = completionHandler(nil, error) return } - guard let eventExtras = request.additionalParameters, !eventExtras.isEmpty else { - let error = AdMobAdaptersError.emptyCustomEventExtras - delegate?.customEventInterstitial(self, didFailAd: error) + guard MediationUtils.isServerParameterInTargetingInfoDict(serverParameter, targetingInfo) else { + let error = AdMobAdaptersError.wrongServerParameter + delegate = completionHandler(nil, error) return } - guard let bid = eventExtras[PBMMediationAdUnitBidKey] as? Bid else { + guard let bid = eventExtrasDictionary[PBMMediationAdUnitBidKey] as? Bid else { let error = AdMobAdaptersError.noBidInEventExtras - delegate?.customEventInterstitial(self, didFailAd: error) + delegate = completionHandler(nil, error) return } - guard let configId = eventExtras[PBMMediationConfigIdKey] as? String else { + guard let configId = eventExtrasDictionary[PBMMediationConfigIdKey] as? String else { let error = AdMobAdaptersError.noConfigIDInEventExtras - delegate?.customEventInterstitial(self, didFailAd: error) + delegate = completionHandler(nil, error) return } @@ -81,15 +83,13 @@ public class PrebidAdMobInterstitialAdapter: interstitialController?.loadAd() } - public func present(fromRootViewController rootViewController: UIViewController) { - self.rootViewController = rootViewController - + public func present(from viewController: UIViewController) { if adAvailable { - self.rootViewController = rootViewController + rootViewController = viewController interstitialController?.show() } else { let error = AdMobAdaptersError.noAd - delegate?.customEventInterstitial(self, didFailAd: error) + delegate?.didFailToPresentWithError(error) } } @@ -97,43 +97,44 @@ public class PrebidAdMobInterstitialAdapter: public func interstitialControllerDidLoadAd(_ interstitialController: InterstitialController) { adAvailable = true - delegate?.customEventInterstitialDidReceiveAd(self) + + if let handler = completionHandler { + delegate = handler(self, nil) + } } public func interstitialController(_ interstitialController: InterstitialController, didFailWithError error: Error) { adAvailable = false - delegate?.customEventInterstitial(self, didFailAd: error) + + if let handler = completionHandler { + delegate = handler(nil, error) + } } // MARK: - InterstitialControllerInteractionDelegate public func trackImpression(forInterstitialController: InterstitialController) { - //Impressions will be tracked automatically - //unless enableAutomaticImpressionAndClickTracking = NO + delegate?.reportImpression() } public func viewControllerForModalPresentation(fromInterstitialController: InterstitialController) -> UIViewController? { - return rootViewController + rootViewController } public func interstitialControllerDidClickAd(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWasClicked(self) + delegate?.reportClick() } public func interstitialControllerDidCloseAd(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWillDismiss(self) - delegate?.customEventInterstitialDidDismiss(self) - } - - public func interstitialControllerDidLeaveApp(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWillLeaveApplication(self) + delegate?.willDismissFullScreenView() + delegate?.didDismissFullScreenView() } public func interstitialControllerDidDisplay(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWillPresent(self) + delegate?.willPresentFullScreenView() } - public func interstitialControllerDidComplete(_ interstitialController: InterstitialController) { - - } + public func interstitialControllerDidComplete(_ interstitialController: InterstitialController) {} + + public func interstitialControllerDidLeaveApp(_ interstitialController: InterstitialController) {} } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift index 7a6a4ba71..a13130e95 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift @@ -36,7 +36,12 @@ public class PrebidAdMobMediationBaseAdapter: NSObject, GADMediationAdapter { } public static func networkExtrasClass() -> GADAdNetworkExtras.Type? { - return PrebidAdMobEventExtras.self + return GADCustomEventExtras.self + } + + // Added for tests + static func latestTestedGMAVersion() -> GADVersionNumber { + return GADVersionNumber(majorVersion: 9, minorVersion: 12, patchVersion: 0) } required public override init() { diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift index b49e630e5..6f12784dd 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobNativeAdapter.swift @@ -19,51 +19,95 @@ import PrebidMobile @objc(PrebidAdMobNativeAdapter) public class PrebidAdMobNativeAdapter: - NSObject, - GADCustomEventNativeAd { + PrebidAdMobMediationBaseAdapter, + GADMediationNativeAd, + NativeAdEventDelegate { - public weak var delegate: GADCustomEventNativeAdDelegate? + public var headline: String? { + prebidNativeAd?.title + } + + public var images: [GADNativeAdImage]? + + public var body: String? { + prebidNativeAd?.text + } + + public var icon: GADNativeAdImage? + + public var callToAction: String? { + prebidNativeAd?.callToAction + } + + public var starRating: NSDecimalNumber? { + NSDecimalNumber(string: prebidNativeAd?.dataObjects(of: .rating).first?.value) + } + + public var store: String? - required public override init() { - super.init() + public var price: String? { + prebidNativeAd?.dataObjects(of: .salePrice).first?.value } - public func request(withParameter serverParameter: String, request: GADCustomEventRequest, adTypes: [Any], options: [Any], rootViewController: UIViewController) { - guard !serverParameter.isEmpty else { + public var advertiser: String? { + prebidNativeAd?.sponsoredBy + } + + public var extraAssets: [String: Any]? + + var prebidNativeAd: NativeAd? + + public weak var delegate: GADMediationNativeAdEventDelegate? + var completionHandler: GADMediationNativeLoadCompletionHandler? + + public func loadNativeAd(for adConfiguration: GADMediationNativeAdConfiguration, completionHandler: @escaping GADMediationNativeLoadCompletionHandler) { + self.completionHandler = completionHandler + + guard let serverParameter = adConfiguration.credentials.settings["parameter"] as? String else { let error = AdMobAdaptersError.noServerParameter - delegate?.customEventNativeAd(self, didFailToLoadWithError: error) + delegate = completionHandler(nil, error) return } - guard let keywords = request.userKeywords as? [String] else { - let error = AdMobAdaptersError.emptyUserKeywords - delegate?.customEventNativeAd(self, didFailToLoadWithError: error) + guard let eventExtras = adConfiguration.extras as? GADCustomEventExtras, + let eventExtrasDictionary = eventExtras.extras(forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel), + !eventExtrasDictionary.isEmpty else { + let error = AdMobAdaptersError.emptyCustomEventExtras + delegate = completionHandler(nil, error) return } - guard MediationUtils.isServerParameterInTargetingInfo(serverParameter, keywords) else { - let error = AdMobAdaptersError.wrongServerParameter - delegate?.customEventNativeAd(self, didFailToLoadWithError: error) + guard let targetingInfo = eventExtrasDictionary[PBMMediationTargetingInfoKey] as? [String: String] else { + let error = AdMobAdaptersError.noTargetingInfoInEventExtras + delegate = completionHandler(nil, error) return } - guard let eventExtras = request.additionalParameters, !eventExtras.isEmpty else { - let error = AdMobAdaptersError.emptyCustomEventExtras - delegate?.customEventNativeAd(self, didFailToLoadWithError: error) + guard MediationUtils.isServerParameterInTargetingInfoDict(serverParameter, targetingInfo) else { + let error = AdMobAdaptersError.wrongServerParameter + delegate = completionHandler(nil, error) return } - AdMobMediationNativeUtils.findNative(eventExtras) { [weak self] result in - guard let self = self else { return } - switch result { - case .success(let ad): - self.delegate?.customEventNativeAd(self, didReceive: ad) - case .failure(let error): - self.delegate?.customEventNativeAd(self, didFailToLoadWithError: error) + switch MediationNativeUtils.findNative(in: eventExtrasDictionary) { + case .success(let nativeAd): + prebidNativeAd = nativeAd + prebidNativeAd?.delegate = self + downloadImages { [weak self] in + // Images are downloaded; native ad is ready to be displayed + guard let self = self else { return } + self.delegate = completionHandler(self, nil) } + + case .failure(let error): + delegate?.didFailToPresentWithError(error) } } + public func didRender(in view: UIView, clickableAssetViews: [GADNativeAssetIdentifier : UIView], nonclickableAssetViews: [GADNativeAssetIdentifier : UIView], viewController: UIViewController) { + prebidNativeAd?.registerView(view: view, clickableViews: Array(clickableAssetViews.values)) + } + public func handlesUserClicks() -> Bool { return false } @@ -71,4 +115,38 @@ public class PrebidAdMobNativeAdapter: public func handlesUserImpressions() -> Bool { return false } + + // MARK: - NativeAdEventDelegate + + public func adDidExpire(ad: NativeAd) { + let error = AdMobAdaptersError.adExpired + if let handler = completionHandler { + delegate = handler(nil, error) + } + } + + public func adWasClicked(ad: NativeAd) { + delegate?.reportClick() + } + + public func adDidLogImpression(ad: NativeAd) { + delegate?.reportImpression() + } + + func downloadImages(completion: @escaping () -> Void) { + guard let imageUrl = prebidNativeAd?.imageUrl, let iconUrl = prebidNativeAd?.iconUrl else { return } + + ImageHelper.downloadImageAsync(imageUrl) { [weak self] result in + if case .success(let image) = result { + self?.images = [GADNativeAdImage(image: image)] + } + + ImageHelper.downloadImageAsync(iconUrl) { [weak self] result in + if case .success(let image) = result { + self?.icon = GADNativeAdImage(image: image) + completion() + } + } + } + } } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobRewardedVideoAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobRewardedVideoAdapter.swift index 95b53abc8..181e6cdbd 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobRewardedVideoAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobRewardedVideoAdapter.swift @@ -31,58 +31,63 @@ public class PrebidAdMobRewardedVideoAdapter: var adAvailable = false weak var delegate: GADMediationRewardedAdEventDelegate? + var completionHandler: GADMediationRewardedLoadCompletionHandler? // MARK: - GADMediationAdapter - public func loadRewardedAd(for adConfiguration: GADMediationRewardedAdConfiguration, completionHandler: @escaping GADMediationRewardedLoadCompletionHandler) { - guard let prebidExtras = adConfiguration.extras as? PrebidAdMobEventExtras else { - let error = AdMobAdaptersError.emptyCustomEventExtras - delegate?.didFailToPresentWithError(error) + + public func loadRewardedAd(for adConfiguration: GADMediationRewardedAdConfiguration, + completionHandler: @escaping GADMediationRewardedLoadCompletionHandler) { + self.completionHandler = completionHandler + + guard let serverParameter = adConfiguration.credentials.settings["parameter"] as? String else { + let error = AdMobAdaptersError.noServerParameter + delegate = completionHandler(nil, error) return } - guard let bid = prebidExtras.additionalParameters[PBMMediationAdUnitBidKey] as? Bid else { - let error = AdMobAdaptersError.noBidInEventExtras + guard let eventExtras = adConfiguration.extras as? GADCustomEventExtras, + let eventExtrasDictionary = eventExtras.extras(forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel), + !eventExtrasDictionary.isEmpty else { + let error = AdMobAdaptersError.emptyCustomEventExtras delegate = completionHandler(nil, error) return } - guard let keywords = bid.targetingInfo else { - let error = AdMobAdaptersError.emptyUserKeywords + guard let targetingInfo = eventExtrasDictionary[PBMMediationTargetingInfoKey] as? [String: String] else { + let error = AdMobAdaptersError.noTargetingInfoInEventExtras delegate = completionHandler(nil, error) return } - guard let serverParameter = adConfiguration.credentials.settings["parameter"] as? String else { - let error = AdMobAdaptersError.noServerParameter - delegate?.didFailToPresentWithError(error) + guard MediationUtils.isServerParameterInTargetingInfoDict(serverParameter, targetingInfo) else { + let error = AdMobAdaptersError.wrongServerParameter + delegate = completionHandler(nil, error) return } - guard MediationUtils.isServerParameterInTargetingInfoDict(serverParameter, keywords) else { - let error = AdMobAdaptersError.wrongServerParameter + guard let bid = eventExtrasDictionary[PBMMediationAdUnitBidKey] as? Bid else { + let error = AdMobAdaptersError.noBidInEventExtras delegate = completionHandler(nil, error) return } - guard let configId = prebidExtras.additionalParameters[PBMMediationConfigIdKey] as? String else { + guard let configId = eventExtrasDictionary[PBMMediationConfigIdKey] as? String else { let error = AdMobAdaptersError.noConfigIDInEventExtras delegate = completionHandler(nil, error) return } - delegate = completionHandler(self, nil) - interstitialController = InterstitialController(bid: bid, configId: configId) interstitialController?.loadingDelegate = self interstitialController?.interactionDelegate = self interstitialController?.adFormats = [.video] interstitialController?.isOptIn = true - if let videoAdConfig = prebidExtras.additionalParameters[PBMMediationVideoAdConfiguration] as? VideoControlsConfiguration { + if let videoAdConfig = eventExtrasDictionary[PBMMediationVideoAdConfiguration] as? VideoControlsConfiguration { interstitialController?.videoControlsConfig = videoAdConfig } - if let videoParameters = prebidExtras.additionalParameters[PBMMediationVideoParameters] as? VideoParameters { + if let videoParameters = eventExtrasDictionary[PBMMediationVideoParameters] as? VideoParameters { interstitialController?.videoParameters = videoParameters } @@ -90,6 +95,7 @@ public class PrebidAdMobRewardedVideoAdapter: } // MARK: - GADMediationRewardedAd + public func present(from viewController: UIViewController) { if adAvailable { rootViewController = viewController @@ -97,23 +103,31 @@ public class PrebidAdMobRewardedVideoAdapter: } else { let error = AdMobAdaptersError.noAd delegate?.didFailToPresentWithError(error) + + if let handler = completionHandler { + delegate = handler(nil, error) + } } } // MARK: - InterstitialControllerLoadingDelegate + public func interstitialControllerDidLoadAd(_ interstitialController: InterstitialController) { adAvailable = true + + if let handler = completionHandler { + delegate = handler(self, nil) + } } public func interstitialController(_ interstitialController: InterstitialController, didFailWithError error: Error) { adAvailable = false - delegate?.didFailToPresentWithError(error) } // MARK: - InterstitialControllerInteractionDelegate + public func trackImpression(forInterstitialController: InterstitialController) { - //Impressions will be tracked automatically - //unless enableAutomaticImpressionAndClickTracking = NO + delegate?.reportImpression() } public func interstitialControllerDidClickAd(_ interstitialController: InterstitialController) { @@ -125,11 +139,7 @@ public class PrebidAdMobRewardedVideoAdapter: delegate?.willDismissFullScreenView() delegate?.didDismissFullScreenView() } - - public func interstitialControllerDidLeaveApp(_ interstitialController: InterstitialController) { - } - public func interstitialControllerDidDisplay(_ interstitialController: InterstitialController) { delegate?.willPresentFullScreenView() delegate?.didStartVideo() @@ -138,13 +148,14 @@ public class PrebidAdMobRewardedVideoAdapter: public func interstitialControllerDidComplete(_ interstitialController: InterstitialController) { adAvailable = false - self.rootViewController = nil + rootViewController = nil - let reward = GADAdReward() - delegate?.didRewardUser(with: reward) + delegate?.didRewardUser() } public func viewControllerForModalPresentation(fromInterstitialController: InterstitialController) -> UIViewController? { - return rootViewController + rootViewController } + + public func interstitialControllerDidLeaveApp(_ interstitialController: InterstitialController) {} } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobVideoInterstitialAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobVideoInterstitialAdapter.swift index 564d2c72b..0613cc6b7 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobVideoInterstitialAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobVideoInterstitialAdapter.swift @@ -19,58 +19,59 @@ import PrebidMobile @objc(PrebidAdMobVideoInterstitialAdapter) public class PrebidAdMobVideoInterstitialAdapter: - NSObject, - GADCustomEventInterstitial, + PrebidAdMobMediationBaseAdapter, + GADMediationInterstitialAd, InterstitialControllerLoadingDelegate, InterstitialControllerInteractionDelegate { - + // MARK: - Private Properties var interstitialController: InterstitialController? weak var rootViewController: UIViewController? var adAvailable = false - public weak var delegate: GADCustomEventInterstitialDelegate? - - required public override init() { - super.init() - } + public weak var delegate: GADMediationInterstitialAdEventDelegate? + var completionHandler: GADMediationInterstitialLoadCompletionHandler? - // MARK: - GADCustomEventInterstitial - public func requestAd(withParameter serverParameter: String?, label serverLabel: String?, request: GADCustomEventRequest) { - guard let keywords = request.userKeywords as? [String] else { - let error = AdMobAdaptersError.emptyUserKeywords - delegate?.customEventInterstitial(self, didFailAd: error) + public func loadInterstitial(for adConfiguration: GADMediationInterstitialAdConfiguration, + completionHandler: @escaping GADMediationInterstitialLoadCompletionHandler) { + self.completionHandler = completionHandler + + guard let serverParameter = adConfiguration.credentials.settings["parameter"] as? String else { + let error = AdMobAdaptersError.noServerParameter + delegate = completionHandler(nil, error) return } - guard let serverParameter = serverParameter else { - let error = AdMobAdaptersError.noServerParameter - delegate?.customEventInterstitial(self, didFailAd: error) + guard let eventExtras = adConfiguration.extras as? GADCustomEventExtras, + let eventExtrasDictionary = eventExtras.extras(forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel), + !eventExtrasDictionary.isEmpty else { + let error = AdMobAdaptersError.emptyCustomEventExtras + delegate = completionHandler(nil, error) return } - guard MediationUtils.isServerParameterInTargetingInfo(serverParameter, keywords) else { - let error = AdMobAdaptersError.wrongServerParameter - delegate?.customEventInterstitial(self, didFailAd: error) + guard let targetingInfo = eventExtrasDictionary[PBMMediationTargetingInfoKey] as? [String: String] else { + let error = AdMobAdaptersError.noTargetingInfoInEventExtras + delegate = completionHandler(nil, error) return } - guard let eventExtras = request.additionalParameters, !eventExtras.isEmpty else { - let error = AdMobAdaptersError.emptyCustomEventExtras - delegate?.customEventInterstitial(self, didFailAd: error) + guard MediationUtils.isServerParameterInTargetingInfoDict(serverParameter, targetingInfo) else { + let error = AdMobAdaptersError.wrongServerParameter + delegate = completionHandler(nil, error) return } - guard let bid = eventExtras[PBMMediationAdUnitBidKey] as? Bid else { + guard let bid = eventExtrasDictionary[PBMMediationAdUnitBidKey] as? Bid else { let error = AdMobAdaptersError.noBidInEventExtras - delegate?.customEventInterstitial(self, didFailAd: error) + delegate = completionHandler(nil, error) return } - guard let configId = eventExtras[PBMMediationConfigIdKey] as? String else { + guard let configId = eventExtrasDictionary[PBMMediationConfigIdKey] as? String else { let error = AdMobAdaptersError.noConfigIDInEventExtras - delegate?.customEventInterstitial(self, didFailAd: error) + delegate = completionHandler(nil, error) return } @@ -79,26 +80,24 @@ public class PrebidAdMobVideoInterstitialAdapter: interstitialController?.interactionDelegate = self interstitialController?.adFormats = [.video] - if let videoAdConfig = eventExtras[PBMMediationVideoAdConfiguration] as? VideoControlsConfiguration { + if let videoAdConfig = eventExtrasDictionary[PBMMediationVideoAdConfiguration] as? VideoControlsConfiguration { interstitialController?.videoControlsConfig = videoAdConfig } - if let videoParameters = eventExtras[PBMMediationVideoParameters] as? VideoParameters { + if let videoParameters = eventExtrasDictionary[PBMMediationVideoParameters] as? VideoParameters { interstitialController?.videoParameters = videoParameters } interstitialController?.loadAd() } - public func present(fromRootViewController rootViewController: UIViewController) { - self.rootViewController = rootViewController - + public func present(from viewController: UIViewController) { if adAvailable { - self.rootViewController = rootViewController + rootViewController = viewController interstitialController?.show() } else { let error = AdMobAdaptersError.noAd - delegate?.customEventInterstitial(self, didFailAd: error) + delegate?.didFailToPresentWithError(error) } } @@ -106,43 +105,44 @@ public class PrebidAdMobVideoInterstitialAdapter: public func interstitialControllerDidLoadAd(_ interstitialController: InterstitialController) { adAvailable = true - delegate?.customEventInterstitialDidReceiveAd(self) + + if let handler = completionHandler { + delegate = handler(self, nil) + } } public func interstitialController(_ interstitialController: InterstitialController, didFailWithError error: Error) { adAvailable = false - delegate?.customEventInterstitial(self, didFailAd: error) + + if let handler = completionHandler { + delegate = handler(nil, error) + } } // MARK: - InterstitialControllerInteractionDelegate public func trackImpression(forInterstitialController: InterstitialController) { - //Impressions will be tracked automatically - //unless enableAutomaticImpressionAndClickTracking = NO + delegate?.reportImpression() } public func viewControllerForModalPresentation(fromInterstitialController: InterstitialController) -> UIViewController? { - return rootViewController + rootViewController } public func interstitialControllerDidClickAd(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWasClicked(self) + delegate?.reportClick() } public func interstitialControllerDidCloseAd(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWillDismiss(self) - delegate?.customEventInterstitialDidDismiss(self) - } - - public func interstitialControllerDidLeaveApp(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWillLeaveApplication(self) + delegate?.willDismissFullScreenView() + delegate?.didDismissFullScreenView() } public func interstitialControllerDidDisplay(_ interstitialController: InterstitialController) { - delegate?.customEventInterstitialWillPresent(self) + delegate?.willPresentFullScreenView() } - public func interstitialControllerDidComplete(_ interstitialController: InterstitialController) { - - } + public func interstitialControllerDidLeaveApp(_ interstitialController: InterstitialController) {} + + public func interstitialControllerDidComplete(_ interstitialController: InterstitialController) {} } diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidMediatedUnifiedNativeAd.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidMediatedUnifiedNativeAd.swift deleted file mode 100644 index 1d67d9ba4..000000000 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidMediatedUnifiedNativeAd.swift +++ /dev/null @@ -1,100 +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 GoogleMobileAds - -public class PrebidMediatedUnifiedNativeAd: NSObject { - - var nativeAd: NativeAd? - var mappedImages = [GADNativeAdImage]() - var mappedIcon: GADNativeAdImage? - - public init(nativeAd: NativeAd) { - self.nativeAd = nativeAd - super.init() - - if let imageUrl = nativeAd.imageUrl { - if case .success(let image) = ImageHelper.downloadImageSync(imageUrl) { - mappedImages = [GADNativeAdImage(image: image)] - } - } - - if let iconUrl = nativeAd.iconUrl { - if case .success(let icon) = ImageHelper.downloadImageSync(iconUrl) { - mappedIcon = GADNativeAdImage(image: icon) - } - } - } -} - -extension PrebidMediatedUnifiedNativeAd: GADMediatedUnifiedNativeAd { - public var headline: String? { - nativeAd?.title - } - - public var images: [GADNativeAdImage]? { - mappedImages - } - - public var body: String? { - nativeAd?.text - } - - public var icon: GADNativeAdImage? { - mappedIcon - } - - public var callToAction: String? { - nativeAd?.callToAction - } - - public var starRating: NSDecimalNumber? { - NSDecimalNumber(string: nativeAd?.dataObjects(of: .rating).first?.value) - } - - public var store: String? { - nil - } - - public var price: String? { - nativeAd?.dataObjects(of: .salePrice).first?.value - } - - public var advertiser: String? { - nativeAd?.sponsoredBy - } - - public var extraAssets: [String : Any]? { - nil - } - - public func didRender(in view: UIView, clickableAssetViews: [GADNativeAssetIdentifier : UIView], nonclickableAssetViews: [GADNativeAssetIdentifier : UIView], viewController: UIViewController) { - nativeAd?.registerView(view: view, clickableViews: Array(clickableAssetViews.values)) - } - - public func didRecordClickOnAsset(withName assetName: GADNativeAssetIdentifier, view: UIView, viewController: UIViewController) { - - } - - public func didRecordImpression() { - - } - - public func didUntrackView(_ view: UIView?) { - - } -} diff --git a/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobGMATests.swift b/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobGMATests.swift new file mode 100644 index 000000000..c98724d8d --- /dev/null +++ b/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobGMATests.swift @@ -0,0 +1,38 @@ +/*   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 XCTest +import GoogleMobileAds +import PrebidMobile +@testable import PrebidMobileAdMobAdapters + +final class AdMobGMATests: XCTestCase { + + func testGMAVersion() { + let latestTestedGMAVersion = PrebidAdMobMediationBaseAdapter.latestTestedGMAVersion() + let latestTestedGMAVersionString = "\(latestTestedGMAVersion.majorVersion).\(latestTestedGMAVersion.minorVersion).\(latestTestedGMAVersion.patchVersion)" + let currentGMAVersion = GADMobileAds.sharedInstance().sdkVersion + + if GADMobileAds.sharedInstance().isSDKVersionAtLeast(major: latestTestedGMAVersion.majorVersion, + minor: latestTestedGMAVersion.minorVersion, + patch: latestTestedGMAVersion.patchVersion) { + if !currentGMAVersion.contains(latestTestedGMAVersionString) { + XCTFail("There is a new version of GMA SDK!") + } + } else { + Log.info("Current GMA SDK version is lower than latest tested.") + } + } +} diff --git a/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobMediationUtilsTest.swift b/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobMediationUtilsTest.swift index 2e494213e..beee947ea 100644 --- a/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobMediationUtilsTest.swift +++ b/EventHandlers/PrebidMobileAdMobAdaptersTests/AdMobMediationUtilsTest.swift @@ -38,8 +38,7 @@ class AdMobMediationUtilsTest: XCTestCase { testInitialKeywords.forEach { keyword in if !mediationDelegate.gadRequest.keywords!.contains(where: { value in - let stringValue = value as? String - return stringValue == keyword + return value == keyword }) { XCTFail() } @@ -62,8 +61,7 @@ class AdMobMediationUtilsTest: XCTestCase { testInitialKeywords.forEach { keyword in if !mediationDelegate.gadRequest.keywords!.contains(where: { value in - let stringValue = value as? String - return stringValue == keyword + return value == keyword }) { XCTFail() } @@ -87,8 +85,7 @@ class AdMobMediationUtilsTest: XCTestCase { testInitialKeywords.forEach { keyword in if !mediationDelegate.gadRequest.keywords!.contains(where: { value in - let stringValue = value as? String - return stringValue == keyword + return value == keyword }) { XCTFail() } @@ -112,8 +109,7 @@ class AdMobMediationUtilsTest: XCTestCase { testInitialKeywords.forEach { keyword in if !mediationDelegate.gadRequest.keywords!.contains(where: { value in - let stringValue = value as? String - return stringValue == keyword + return value == keyword }) { XCTFail() } diff --git a/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift b/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift index b96a1f123..9f5173b42 100644 --- a/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift +++ b/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift @@ -53,6 +53,11 @@ public class GAMUtils: NSObject { Log.error(error.localizedDescription) } + // Added for tests + static func latestTestedGMAVersion() -> GADVersionNumber { + return GADVersionNumber(majorVersion: 9, minorVersion: 12, patchVersion: 0) + } + // MARK: Private Methods private func getPrebidTargeting(from request: GAMRequestWrapper) -> [String: String] { diff --git a/EventHandlers/PrebidMobileGAMEventHandlersTests/BoxTests/GAMBannerViewWrapperTest.swift b/EventHandlers/PrebidMobileGAMEventHandlersTests/BoxTests/GAMBannerViewWrapperTest.swift index 7cd6d99d5..051c58449 100644 --- a/EventHandlers/PrebidMobileGAMEventHandlersTests/BoxTests/GAMBannerViewWrapperTest.swift +++ b/EventHandlers/PrebidMobileGAMEventHandlersTests/BoxTests/GAMBannerViewWrapperTest.swift @@ -32,13 +32,13 @@ class GAMBannerViewWrapperTest: XCTestCase { func testProperties() { let propTests: [BasePropTest] = [ PropTest(keyPath: \.adUnitID, value: "144"), - PropTest(keyPath: \.validAdSizes, value: [NSValueFromGADAdSize(kGADAdSizeBanner)]), + PropTest(keyPath: \.validAdSizes, value: [NSValueFromGADAdSize(GADAdSizeBanner)]), PropTest(keyPath: \.rootViewController, value: UIViewController()), RefPropTest(keyPath: \.delegate, value: DummyDelegate()), RefPropTest(keyPath: \.appEventDelegate, value: DummyEventDelegate()), RefPropTest(keyPath: \.adSizeDelegate, value: DummySizeDelegate()), PropTest(keyPath: \.enableManualImpressions, value: true), - PropTest(keyPath: \.adSize, value: kGADAdSizeBanner), + PropTest(keyPath: \.adSize, value: GADAdSizeBanner), ] guard let banner = GAMBannerViewWrapper() else { diff --git a/EventHandlers/PrebidMobileGAMEventHandlersTests/GMATests.swift b/EventHandlers/PrebidMobileGAMEventHandlersTests/GMATests.swift new file mode 100644 index 000000000..2ece2061a --- /dev/null +++ b/EventHandlers/PrebidMobileGAMEventHandlersTests/GMATests.swift @@ -0,0 +1,38 @@ +/*   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 XCTest +import GoogleMobileAds +import PrebidMobile +@testable import PrebidMobileGAMEventHandlers + +final class GMATests: XCTestCase { + + func testGMAVersion() { + let latestTestedGMAVersion = GAMUtils.latestTestedGMAVersion() + let latestTestedGMAVersionString = "\(latestTestedGMAVersion.majorVersion).\(latestTestedGMAVersion.minorVersion).\(latestTestedGMAVersion.patchVersion)" + let currentGMAVersion = GADMobileAds.sharedInstance().sdkVersion + + if GADMobileAds.sharedInstance().isSDKVersionAtLeast(major: latestTestedGMAVersion.majorVersion, + minor: latestTestedGMAVersion.minorVersion, + patch: latestTestedGMAVersion.patchVersion) { + if !currentGMAVersion.contains(latestTestedGMAVersionString) { + XCTFail("There is a new version of GMA SDK!") + } + } else { + Log.info("Current GMA SDK version is lower than latest tested.") + } + } +} diff --git a/Example/PrebidDemo/PrebidDemo.xcodeproj/project.pbxproj b/Example/PrebidDemo/PrebidDemo.xcodeproj/project.pbxproj index dac6d0bd3..e93409dc1 100644 --- a/Example/PrebidDemo/PrebidDemo.xcodeproj/project.pbxproj +++ b/Example/PrebidDemo/PrebidDemo.xcodeproj/project.pbxproj @@ -394,17 +394,17 @@ FA12E4B5231EB04100CAA05B /* PrebidDemoSwift */ = { isa = PBXGroup; children = ( + FA12E4C2231EB04200CAA05B /* Info.plist */, FA12E4B6231EB04100CAA05B /* AppDelegate.swift */, - FA12E4BD231EB04200CAA05B /* Assets.xcassets */, FA12E4CE231EB3F000CAA05B /* BannerController.swift */, FA12E4CD231EB3F000CAA05B /* IndexController.swift */, - FA12E4C2231EB04200CAA05B /* Info.plist */, 6069716B25224655000EE732 /* InstreamVideoViewController.swift */, FA12E4CB231EB3F000CAA05B /* InterstitialViewController.swift */, + FA7E552F239E87FA0063B028 /* RewardedVideoController.swift */, + FA12E4BD231EB04200CAA05B /* Assets.xcassets */, FA12E4BF231EB04200CAA05B /* LaunchScreen.storyboard */, FA12E4BA231EB04100CAA05B /* Main.storyboard */, 38018902255AC4DE0089CA84 /* NativeAd */, - FA7E552F239E87FA0063B028 /* RewardedVideoController.swift */, ); path = PrebidDemoSwift; sourceTree = ""; @@ -983,7 +983,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = PrebidDemoSwift/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1003,7 +1003,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = PrebidDemoSwift/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Example/PrebidDemo/PrebidDemoObjectiveC/AppDelegate.m b/Example/PrebidDemo/PrebidDemoObjectiveC/AppDelegate.m index 8c2273d75..0d7fde4bb 100644 --- a/Example/PrebidDemo/PrebidDemoObjectiveC/AppDelegate.m +++ b/Example/PrebidDemo/PrebidDemoObjectiveC/AppDelegate.m @@ -42,6 +42,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( Prebid.shared.externalUserIdArray = externalUserIdArray; + GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ GADSimulatorID ]; + [[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus * _Nonnull status) {}]; + [GAMUtils.shared initializeGAM]; [AdMobUtils initializeGAD]; diff --git a/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingBannerViewController.m b/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingBannerViewController.m index 0bc7088bc..2d6a75266 100644 --- a/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingBannerViewController.m +++ b/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingBannerViewController.m @@ -141,7 +141,7 @@ - (void)loadGAMRenderingBanner { - (void)loadAdMobRenderingBanner { self.gadRequest = [GADRequest new]; if(self.integrationAdFormat == IntegrationAdFormat_Banner) { - self.gadBannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner]; + self.gadBannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeBanner]; self.admobMediationDelegate = [[AdMobMediationBannerUtils alloc] initWithGadRequest:self.gadRequest bannerView:self.gadBannerView]; self.admobBannerAdUnit = [[MediationBannerAdUnit alloc] initWithConfigID:ObjCDemoConstants.kBannerDisplayStoredImpression @@ -170,11 +170,6 @@ - (void)loadAdMobRenderingBanner { } [self.admobBannerAdUnit fetchDemandWithCompletion:^(ResultCode result) { - GADCustomEventExtras *extras = [GADCustomEventExtras new]; - NSDictionary *prebidExtras = [self.admobMediationDelegate getEventExtras]; - NSString *prebidExtrasLabel = AdMobConstants.PrebidAdMobEventExtrasLabel; - [extras setExtras:prebidExtras forLabel: prebidExtrasLabel]; - [self.gadRequest registerAdNetworkExtras:extras]; [self.adView addSubview:self.gadBannerView]; [self.gadBannerView loadRequest:self.gadRequest]; }]; diff --git a/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingInterstitialViewController.m b/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingInterstitialViewController.m index 6164767fa..ed527d03b 100644 --- a/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingInterstitialViewController.m +++ b/Example/PrebidDemo/PrebidDemoObjectiveC/RenderingVC/RenderingInterstitialViewController.m @@ -142,11 +142,6 @@ - (void)loadAdMobRenderingInterstitial { } [self.admobInterstitialAdUnit fetchDemandWithCompletion:^(ResultCode result) { - GADCustomEventExtras *extras = [GADCustomEventExtras new]; - NSDictionary *prebidExtras = [mediationDelegate getEventExtras]; - NSString *prebidExtrasLabel = AdMobConstants.PrebidAdMobEventExtrasLabel; - [extras setExtras:prebidExtras forLabel: prebidExtrasLabel]; - [request registerAdNetworkExtras:extras]; [GADInterstitialAd loadWithAdUnitID:ObjCDemoConstants.kAdMobInterstitialAdUnitId request:request completionHandler:^(GADInterstitialAd * _Nullable interstitialAd, NSError * _Nullable error) { diff --git a/Example/PrebidDemo/PrebidDemoObjectiveC/ViewController.m b/Example/PrebidDemo/PrebidDemoObjectiveC/ViewController.m index d64bf5b1e..43796d24e 100644 --- a/Example/PrebidDemo/PrebidDemoObjectiveC/ViewController.m +++ b/Example/PrebidDemo/PrebidDemoObjectiveC/ViewController.m @@ -222,7 +222,7 @@ -(void)loadDFPPrebidNative { dispatch_async(dispatch_get_main_queue(), ^{ self.adLoader = [[GADAdLoader alloc] initWithAdUnitID:ObjCDemoConstants.kGAMNativeAdUnitId rootViewController:self - adTypes:@[kGADAdLoaderAdTypeCustomNative] + adTypes:@[GADAdLoaderAdTypeCustomNative] options:@[]]; self.adLoader.delegate = self; [self.adLoader loadRequest:dfpRequest]; @@ -315,7 +315,7 @@ - (void)adLoader:(GADAdLoader *)adLoader didFailToReceiveAdWithError:(NSError *) } - (NSArray *)validBannerSizesForAdLoader:(GADAdLoader *)adLoader { - return @[NSValueFromGADAdSize(kGADAdSizeBanner)]; + return @[NSValueFromGADAdSize(GADAdSizeBanner)]; } #pragma mark : GADCustomNativeAdLoaderDelegate diff --git a/Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift b/Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift index 70c095b16..573b62be2 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift @@ -50,7 +50,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { externalUserIdArray.append(ExternalUserId(source: "sharedid.org", identifier: "111111111111", atype: 1, ext: ["third" : "01ERJWE5FS4RAZKG6SKQ3ZYSKV"])) Prebid.shared.externalUserIdArray = externalUserIdArray - GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ (kGADSimulatorID as! String), "da5a5e025d9ee432afc53f9fc1273f4e"] + GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ GADSimulatorID, "fa7ff8af558fb08a04c94453647e54a1"] GADMobileAds.sharedInstance().start() AdMobUtils.initializeGAD() diff --git a/Example/PrebidDemo/PrebidDemoSwift/BannerController.swift b/Example/PrebidDemo/PrebidDemoSwift/BannerController.swift index f10c5700a..2b7f37128 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/BannerController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/BannerController.swift @@ -329,7 +329,7 @@ class BannerController: let size = CGSize(width: 320, height: 50) let eventHandler = GAMBannerEventHandler(adUnitID: gamAdUnitDisplayBannerRendering, - validGADAdSizes: [kGADAdSizeBanner].map(NSValueFromGADAdSize)) + validGADAdSizes: [GADAdSizeBanner].map(NSValueFromGADAdSize)) prebidBannerView = BannerView(frame: CGRect(origin: .zero, size: size), configID: storedImpDisplayBanner, @@ -351,7 +351,7 @@ class BannerController: setupPrebidServer(storedResponse: storedResponseRenderingVideoBanner) - let eventHandler = GAMBannerEventHandler(adUnitID: gamAdUnitVideoBannerRendering, validGADAdSizes: [kGADAdSizeBanner].map(NSValueFromGADAdSize)) + let eventHandler = GAMBannerEventHandler(adUnitID: gamAdUnitVideoBannerRendering, validGADAdSizes: [GADAdSizeBanner].map(NSValueFromGADAdSize)) prebidBannerView = BannerView(frame: CGRect(origin: .zero, size: size), configID: storedImpVideoBanner, adSize: CGSize(width: 300, height: 250), @@ -378,10 +378,6 @@ class BannerController: prebidAdMobMediaitonAdUnit = MediationBannerAdUnit(configID: storedImpDisplayBanner, size: size, mediationDelegate: mediationDelegate) prebidAdMobMediaitonAdUnit.fetchDemand { [weak self] result in - let extras = GADCustomEventExtras() - let prebidExtras = self?.mediationDelegate.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self?.gadRequest.register(extras) self?.gadBanner.load(self?.gadRequest) } } @@ -396,10 +392,6 @@ class BannerController: prebidAdMobMediaitonAdUnit = MediationBannerAdUnit(configID: storedImpVideoBanner, size: size, mediationDelegate: mediationDelegate) prebidAdMobMediaitonAdUnit.fetchDemand { [weak self] result in - let extras = GADCustomEventExtras() - let prebidExtras = self?.mediationDelegate.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self?.gadRequest.register(extras) self?.gadBanner.load(self?.gadRequest) } } diff --git a/Example/PrebidDemo/PrebidDemoSwift/InstreamVideoViewController.swift b/Example/PrebidDemo/PrebidDemoSwift/InstreamVideoViewController.swift index 67daf522f..32151dc8c 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/InstreamVideoViewController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/InstreamVideoViewController.swift @@ -96,7 +96,10 @@ class InstreamVideoViewController: UIViewController, IMAAdsLoaderDelegate, IMAAd appInstreamView.layer.addSublayer(playerLayer!) // Set up our content playhead and contentComplete callback. - contentPlayhead = IMAAVPlayerContentPlayhead(avPlayer: contentPlayer) + if let contentPlayer = contentPlayer { + contentPlayhead = IMAAVPlayerContentPlayhead(avPlayer: contentPlayer) + } + NotificationCenter.default.addObserver( self, selector: #selector(InstreamVideoViewController.contentDidFinishPlaying(_:)), diff --git a/Example/PrebidDemo/PrebidDemoSwift/InterstitialViewController.swift b/Example/PrebidDemo/PrebidDemoSwift/InterstitialViewController.swift index 82656922a..5e2e4841a 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/InterstitialViewController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/InterstitialViewController.swift @@ -224,11 +224,6 @@ class InterstitialViewController: mediationDelegate = AdMobMediationInterstitialUtils(gadRequest: self.gadRequest) admobAdUnit = MediationInterstitialAdUnit(configId: storedImpDisplayInterstitial, mediationDelegate: mediationDelegate!) admobAdUnit?.fetchDemand(completion: { [weak self]result in - let extras = GADCustomEventExtras() - let prebidExtras = self?.mediationDelegate!.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self?.gadRequest.register(extras) - GADInterstitialAd.load(withAdUnitID: adMobAdUnitDisplayInterstitial, request: self?.gadRequest) { [weak self] ad, error in guard let self = self else { return } if let error = error { @@ -247,12 +242,7 @@ class InterstitialViewController: mediationDelegate = AdMobMediationInterstitialUtils(gadRequest: self.gadRequest) admobAdUnit = MediationInterstitialAdUnit(configId: storedImpVideoInterstitial, mediationDelegate: mediationDelegate!) - admobAdUnit?.fetchDemand(completion: { [weak self]result in - let extras = GADCustomEventExtras() - let prebidExtras = self?.mediationDelegate!.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self?.gadRequest.register(extras) - + admobAdUnit?.fetchDemand(completion: { [weak self]result in GADInterstitialAd.load(withAdUnitID: adMobAdUnitDisplayInterstitial, request: self?.gadRequest) { [weak self] ad, error in guard let self = self else { return } if let error = error { @@ -366,10 +356,6 @@ class InterstitialViewController: Log.error(error.localizedDescription) } - func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { - Log.info("adDidPresentFullScreenContent called") - } - func adWillDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { Log.info("adWillDismissFullScreenContent called") } diff --git a/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeInAppViewController.swift b/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeInAppViewController.swift index e191bd42f..e9f9c0d9c 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeInAppViewController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeInAppViewController.swift @@ -205,11 +205,6 @@ class NativeInAppViewController: UIViewController { admobMediationNativeAdUnit.fetchDemand { [weak self] result in guard let self = self else { return } - let prebidExtras = self.mediationDelegate.getEventExtras() - let extras = GADCustomEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self.gadRequest.register(extras) - self.adLoader = GADAdLoader(adUnitID: admobRenderingNativeAdUnitId, rootViewController: self, adTypes: [ .native ], diff --git a/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeViewController.swift b/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeViewController.swift index 9f76f5f49..f3f74763a 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeViewController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/NativeAd/NativeViewController.swift @@ -65,7 +65,7 @@ class NativeViewController: UIViewController, GADBannerViewDelegate { } func loadDFPNative() { - dfpNativeAdUnit = GAMBannerView(adSize: kGADAdSizeFluid) + dfpNativeAdUnit = GAMBannerView(adSize: GADAdSizeFluid) dfpNativeAdUnit.adUnitID = "/21808260008/unified_native_ad_unit" dfpNativeAdUnit.rootViewController = self dfpNativeAdUnit.delegate = self diff --git a/Example/PrebidDemo/PrebidDemoSwift/RewardedVideoController.swift b/Example/PrebidDemo/PrebidDemoSwift/RewardedVideoController.swift index 0669bd201..f89316347 100644 --- a/Example/PrebidDemo/PrebidDemoSwift/RewardedVideoController.swift +++ b/Example/PrebidDemo/PrebidDemoSwift/RewardedVideoController.swift @@ -227,10 +227,6 @@ class RewardedVideoController: print("adDidRecordImpression") } - func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { - print("adDidPresentFullScreenContent") - } - func adWillDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("adWillDismissFullScreenContent") } diff --git a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj index e2e8d1035..62eb52615 100644 --- a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj +++ b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj @@ -541,11 +541,11 @@ 5B3C2A9C2100BC4900BD733C /* PrebidMobileDemoRendering */ = { isa = PBXGroup; children = ( - D551B96D21491A6F00FFF51D /* Singletons and Managers */, - 5B3EEDE32101FB6C00BAA0C4 /* Model */, 5B3C2AAE2100BC4900BD733C /* AppDelegate.swift */, 34215B0E25C4598E00C74A09 /* ProcessArgumentsParser.swift */, + 5B3EEDE32101FB6C00BAA0C4 /* Model */, 5B1BDB782100D59000B46B43 /* Resources */, + D551B96D21491A6F00FFF51D /* Singletons and Managers */, 5B3EEDCD2101D2A100BAA0C4 /* Utilities */, 5B3EEDB12101D1AF00BAA0C4 /* ViewControllers */, ); @@ -1042,7 +1042,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-InternalTestApp/Pods-InternalTestApp-resources.sh", - "${PODS_ROOT}/AppLovinSDK/applovin-ios-sdk-11.3.2/AppLovinSDKResources.bundle", + "${PODS_ROOT}/AppLovinSDK/applovin-ios-sdk-11.5.3/AppLovinSDKResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -1156,7 +1156,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-InternalTestAppTests/Pods-InternalTestAppTests-resources.sh", - "${PODS_ROOT}/AppLovinSDK/applovin-ios-sdk-11.3.2/AppLovinSDKResources.bundle", + "${PODS_ROOT}/AppLovinSDK/applovin-ios-sdk-11.5.3/AppLovinSDKResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( diff --git a/InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift b/InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift index 035a1e3e4..657343c6f 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift @@ -57,6 +57,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { break } } + processArgumentsParser.addOption("AD_POSITION", paramsCount: 1, fireOnce: true) { params in if let adPositionInt = Int(params[0]), let adPosition = AdPosition(rawValue: adPositionInt) { AppConfiguration.shared.adPosition = adPosition @@ -78,6 +79,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { processArgumentsParser.addOption("BIDDER_ACCESS_CONTROL_LIST", acceptedParamsRange: (min: 1, max: nil)) { params in params.forEach(Targeting.shared.addBidderToAccessControlList(_:)) } + processArgumentsParser.addOption("ADD_ADUNIT_CONTEXT", paramsCount: 2) { params in let appConfig = AppConfiguration.shared appConfig.adUnitContext = (appConfig.adUnitContext ?? []) + [(key: params[0], value: params[1])] @@ -104,7 +106,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { processArgumentsParser.parseProcessArguments(ProcessInfo.processInfo.arguments) // AdMob - GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [kGADSimulatorID as! String] + GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [GADSimulatorID] GADMobileAds.sharedInstance().start { (status) in //Registered so that DownloadHelper gets covered by this GlobalVars.reactiveGAMInitFlag.markSdkInitialized() diff --git a/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift b/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift index a1d625db3..3349ce022 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift @@ -516,7 +516,7 @@ struct TestCaseManager { } let gamBannerController = PrebidGAMBannerController(rootController: adapterVC) gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] gamBannerController.prebidConfigId = "imp-prebid-banner-320-50" gamBannerController.storedAuctionResponse = "response-prebid-banner-320-50" @@ -538,7 +538,7 @@ struct TestCaseManager { let gamBannerController = PrebidGAMBannerController(rootController: adapterVC) gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] gamBannerController.prebidConfigId = "imp-prebid-banner-320-50" gamBannerController.storedAuctionResponse = "response-prebid-banner-320-50" @@ -559,7 +559,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-320-50" gamBannerController.storedAuctionResponse = "response-prebid-banner-320-50" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner_static" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -577,7 +577,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-no-bids" gamBannerController.storedAuctionResponse = "response-prebid-no-bids" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner_static" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -594,7 +594,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-320-50" gamBannerController.storedAuctionResponse = "response-prebid-banner-320-50" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner_random" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -611,7 +611,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-320-50" gamBannerController.storedAuctionResponse = "response-prebid-banner-320-50" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -628,7 +628,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-300-250" gamBannerController.storedAuctionResponse = "response-prebid-banner-300-250" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_300x250_banner" - gamBannerController.validAdSizes = [kGADAdSizeMediumRectangle] + gamBannerController.validAdSizes = [GADAdSizeMediumRectangle] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -645,7 +645,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-728-90" gamBannerController.storedAuctionResponse = "response-prebid-banner-728-90" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_728x90_banner" - gamBannerController.validAdSizes = [kGADAdSizeLeaderboard] + gamBannerController.validAdSizes = [GADAdSizeLeaderboard] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -662,7 +662,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-multisize" gamBannerController.storedAuctionResponse = "response-prebid-banner-multisize" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_multisize_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner, kGADAdSizeLeaderboard] + gamBannerController.validAdSizes = [GADAdSizeBanner, GADAdSizeLeaderboard] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -680,7 +680,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-banner-320-50" gamBannerController.storedAuctionResponse = "response-prebid-banner-320-50" gamBannerController.gamAdUnitId = "/21808260008/prebid_android_300x250_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeMediumRectangle] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -1563,7 +1563,7 @@ struct TestCaseManager { } let gamBannerController = PrebidGAMBannerController(rootController: adapterVC) gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_300x250_banner" - gamBannerController.validAdSizes = [kGADAdSizeMediumRectangle] + gamBannerController.validAdSizes = [GADAdSizeMediumRectangle] gamBannerController.adFormat = .video gamBannerController.prebidConfigId = "imp-prebid-video-outstream" gamBannerController.storedAuctionResponse = "response-prebid-video-outstream" @@ -1582,7 +1582,7 @@ struct TestCaseManager { } let gamBannerController = PrebidGAMBannerController(rootController: adapterVC) gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_300x250_banner" - gamBannerController.validAdSizes = [kGADAdSizeMediumRectangle] + gamBannerController.validAdSizes = [GADAdSizeMediumRectangle] gamBannerController.adFormat = .video gamBannerController.prebidConfigId = "imp-prebid-video-outstream-with-end-card" gamBannerController.storedAuctionResponse = "response-prebid-video-outstream-with-end-card" @@ -1603,7 +1603,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-video-outstream" gamBannerController.storedAuctionResponse = "response-prebid-video-outstream-with-end-card" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_outstream_video_reandom" - gamBannerController.validAdSizes = [kGADAdSizeMediumRectangle] + gamBannerController.validAdSizes = [GADAdSizeMediumRectangle] gamBannerController.adFormat = .video adapterVC.setup(adapter: gamBannerController) @@ -1621,7 +1621,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-no-bids" gamBannerController.storedAuctionResponse = "response-prebid-no-bids" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_outsream_video" - gamBannerController.validAdSizes = [kGADAdSizeMediumRectangle] + gamBannerController.validAdSizes = [GADAdSizeMediumRectangle] gamBannerController.adFormat = .video adapterVC.setup(adapter: gamBannerController) @@ -1656,7 +1656,7 @@ struct TestCaseManager { var prebidConfigId = "imp-prebid-video-outstream" var storedAuctionResponse = "response-prebid-video-outstream" let gamAdUnitId = "/21808260008/prebid_oxb_outstream_video_reandom" - let validAdSize = kGADAdSizeMediumRectangle + let validAdSize = GADAdSizeMediumRectangle let adSize = validAdSize.size let adEventHandler = GAMBannerEventHandler(adUnitID: gamAdUnitId, validGADAdSizes: [NSValueFromGADAdSize(validAdSize)]) let adBannerView = BannerView(configID: prebidConfigId,eventHandler: adEventHandler) @@ -2080,7 +2080,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-mraid-expand-1-part" gamBannerController.storedAuctionResponse = "response-prebid-mraid-expand-1-part" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) @@ -2098,7 +2098,7 @@ struct TestCaseManager { gamBannerController.prebidConfigId = "imp-prebid-mraid-resize" gamBannerController.storedAuctionResponse = "response-prebid-mraid-resize" gamBannerController.gamAdUnitId = "/21808260008/prebid_oxb_320x50_banner" - gamBannerController.validAdSizes = [kGADAdSizeBanner] + gamBannerController.validAdSizes = [GADAdSizeBanner] adapterVC.setup(adapter: gamBannerController) setupCustomParams(for: gamBannerController.prebidConfigId) diff --git a/InternalTestApp/PrebidMobileDemoRendering/Resources/UnifiedNativeAdView.xib b/InternalTestApp/PrebidMobileDemoRendering/Resources/UnifiedNativeAdView.xib index 29ec6f873..7be3cc0db 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/Resources/UnifiedNativeAdView.xib +++ b/InternalTestApp/PrebidMobileDemoRendering/Resources/UnifiedNativeAdView.xib @@ -1,9 +1,9 @@ - + - - + + diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobBannerViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobBannerViewController.swift index cf21e9d67..e86d1786d 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobBannerViewController.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobBannerViewController.swift @@ -1,17 +1,17 @@ /*   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. - */ + +  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 GoogleMobileAds @@ -25,16 +25,16 @@ enum GADAdSizeType { } class PrebidAdMobBannerViewController: - NSObject, - AdaptedController, - PrebidConfigurableBannerController, - GADBannerViewDelegate { + NSObject, + AdaptedController, + PrebidConfigurableBannerController, + GADBannerViewDelegate { var refreshInterval: TimeInterval = 0 var prebidConfigId = "" var storedAuctionResponse = "" - + var adMobAdUnitId = "" var adUnitSize = CGSize() var additionalAdSizes = [CGSize]() @@ -64,7 +64,7 @@ class PrebidAdMobBannerViewController: private var adUnit: MediationBannerAdUnit? private var mediationDelegate: AdMobMediationBannerUtils? - + // MARK: - AdaptedController required init(rootController:AdapterViewController) { @@ -103,14 +103,15 @@ class PrebidAdMobBannerViewController: if (refreshInterval > 0) { adUnit?.refreshInterval = refreshInterval } + if additionalAdSizes.count > 0 { adUnit?.additionalSizes = additionalAdSizes } + if let adFormat = adFormat { adUnit?.adFormat = adFormat } - if let adUnitContext = AppConfiguration.shared.adUnitContext { for dataPair in adUnitContext { adUnit?.addContextData(dataPair.value, forKey: dataPair.key) @@ -126,7 +127,7 @@ class PrebidAdMobBannerViewController: } if let appData = AppConfiguration.shared.appContentData { - for dataPair in appData { + for dataPair in appData { let appData = PBMORTBContentData() appData.ext = [dataPair.key: dataPair.value] adUnit?.addAppContentData([appData]) @@ -140,6 +141,7 @@ class PrebidAdMobBannerViewController: else { return } + adBannerView.translatesAutoresizingMaskIntoConstraints = false let widthConstraint = NSLayoutConstraint(item: adBannerView, attribute: .width, @@ -158,11 +160,6 @@ class PrebidAdMobBannerViewController: container.addConstraints([widthConstraint, heightConstraint]) container.layoutSubviews() - let extras = GADCustomEventExtras() - let prebidExtras = self.mediationDelegate?.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self.request.register(extras) - let sizeWithMaxWidth = self.additionalAdSizes.max { $0.width < $1.width } @@ -173,7 +170,7 @@ class PrebidAdMobBannerViewController: case .adaptiveAnchored: adBannerView.adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(sizeWithMaxWidth?.width ?? self.adUnitSize.width) } - + adBannerView.load(self.request) } @@ -195,7 +192,7 @@ class PrebidAdMobBannerViewController: resetEvents() reloadButton.isEnabled = true self.adViewDidFailButton.isEnabled = true - + adUnit?.adObjectDidFailToLoadAd(adObject: adBannerView!, with: error) } @@ -233,7 +230,7 @@ class PrebidAdMobBannerViewController: rootController?.setupAction(willPresentScreenButton, "willPresentScreen called") rootController?.setupAction(willDismissScreenButton, "willDismissScreen called") rootController?.setupAction(didDismissScreenButton, "didDismissScreen called") - + rootController?.setupAction(reloadButton, "[Reload]") rootController?.setupAction(stopRefreshButton, "[Stop Refresh]") @@ -256,10 +253,6 @@ class PrebidAdMobBannerViewController: resetEvents() adUnit?.fetchDemand { [weak self] result in - let extras = GADCustomEventExtras() - let prebidExtras = self?.mediationDelegate?.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self?.request.register(extras) self?.adBannerView?.load(self?.request) } } diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobInterstitialViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobInterstitialViewController.swift index 85bcb8f30..3283264db 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobInterstitialViewController.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobInterstitialViewController.swift @@ -34,7 +34,6 @@ class PrebidAdMobInterstitialViewController: NSObject, AdaptedController, Prebid private let adDidReceiveButton = EventReportContainer() private let adDidFailToReceiveButton = EventReportContainer() private let adDidFailToPresentFullScreenContentWithErrorButton = EventReportContainer() - private let adDidPresentFullScreenContentButton = EventReportContainer() private let adWillDismissFullScreenContentButton = EventReportContainer() private let adDidDismissFullScreenContentButton = EventReportContainer() private let adDidRecordImpressionButton = EventReportContainer() @@ -132,10 +131,6 @@ class PrebidAdMobInterstitialViewController: NSObject, AdaptedController, Prebid adUnit?.fetchDemand { [weak self] result in guard let self = self else { return } - let extras = GADCustomEventExtras() - let prebidExtras = self.mediationDelegate?.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self.request.register(extras) GADInterstitialAd.load(withAdUnitID: self.adMobAdUnitId, request: self.request) { [weak self] ad, error in guard let self = self else { return } if let error = error { @@ -159,10 +154,6 @@ class PrebidAdMobInterstitialViewController: NSObject, AdaptedController, Prebid adDidFailToPresentFullScreenContentWithErrorButton.isEnabled = true } - func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { - adDidPresentFullScreenContentButton.isEnabled = true - } - func adWillDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { adWillDismissFullScreenContentButton.isEnabled = true } @@ -196,7 +187,6 @@ class PrebidAdMobInterstitialViewController: NSObject, AdaptedController, Prebid adapterViewController?.setupAction(adDidReceiveButton, "adDidReceiveButton called") adapterViewController?.setupAction(adDidFailToReceiveButton, "adDidFailToReceiveButton called") adapterViewController?.setupAction(adDidFailToPresentFullScreenContentWithErrorButton, "adDidFailToPresentFullScreenContentWithError called") - adapterViewController?.setupAction(adDidPresentFullScreenContentButton, "adDidPresentFullScreenContent called") adapterViewController?.setupAction(adWillDismissFullScreenContentButton, "adWillDismissFullScreenContent called") adapterViewController?.setupAction(adDidDismissFullScreenContentButton, "adDidDismissFullScreenContent called") adapterViewController?.setupAction(adDidRecordImpressionButton, "adDidRecordImpression called") @@ -206,7 +196,6 @@ class PrebidAdMobInterstitialViewController: NSObject, AdaptedController, Prebid adDidReceiveButton.isEnabled = false adDidFailToReceiveButton.isEnabled = false adDidFailToPresentFullScreenContentWithErrorButton.isEnabled = false - adDidPresentFullScreenContentButton.isEnabled = false adWillDismissFullScreenContentButton.isEnabled = false adDidDismissFullScreenContentButton.isEnabled = false adDidRecordImpressionButton.isEnabled = false diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobNativeViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobNativeViewController.swift index c38a1aa73..cc029ad43 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobNativeViewController.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobNativeViewController.swift @@ -82,10 +82,7 @@ class PrebidAdMobNativeViewController: NSObject, AdaptedController, GADNativeAdL nativeAdUnit.fetchDemand { [weak self] result in guard let self = self else { return } - let extras = GADCustomEventExtras() - let prebidExtras = self.mediationDelegate?.getEventExtras() - extras.setExtras(prebidExtras, forLabel: AdMobConstants.PrebidAdMobEventExtrasLabel) - self.gadRequest.register(extras) + self.adLoader = GADAdLoader(adUnitID: self.adMobAdUnitId!, rootViewController: self.rootController, adTypes: [ .native ], diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobRewardedViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobRewardedViewController.swift index 53038b35d..a7e12b3e2 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobRewardedViewController.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/AdMob/PrebidAdMobRewardedViewController.swift @@ -32,7 +32,6 @@ class PrebidAdMobRewardedViewController: NSObject, AdaptedController, PrebidConf private let adDidReceiveButton = EventReportContainer() private let adDidFailToReceiveButton = EventReportContainer() private let adDidFailToPresentFullScreenContentWithErrorButton = EventReportContainer() - private let adDidPresentFullScreenContentButton = EventReportContainer() private let adWillDismissFullScreenContentButton = EventReportContainer() private let adDidDismissFullScreenContentButton = EventReportContainer() private let adDidRecordImpressionButton = EventReportContainer() @@ -112,10 +111,6 @@ class PrebidAdMobRewardedViewController: NSObject, AdaptedController, PrebidConf adDidFailToPresentFullScreenContentWithErrorButton.isEnabled = true } - func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { - adDidPresentFullScreenContentButton.isEnabled = true - } - func adWillDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { adWillDismissFullScreenContentButton.isEnabled = true } @@ -149,7 +144,6 @@ class PrebidAdMobRewardedViewController: NSObject, AdaptedController, PrebidConf adapterViewController?.setupAction(adDidReceiveButton, "adDidReceiveButton called") adapterViewController?.setupAction(adDidFailToReceiveButton, "adDidFailToReceiveButton called") adapterViewController?.setupAction(adDidFailToPresentFullScreenContentWithErrorButton, "adDidFailToPresentFullScreenContentWithError called") - adapterViewController?.setupAction(adDidPresentFullScreenContentButton, "adDidPresentFullScreenContent called") adapterViewController?.setupAction(adWillDismissFullScreenContentButton, "adWillDismissFullScreenContent called") adapterViewController?.setupAction(adDidDismissFullScreenContentButton, "adDidDismissFullScreenContent called") adapterViewController?.setupAction(adDidRecordImpressionButton, "adDidRecordImpression called") @@ -159,7 +153,6 @@ class PrebidAdMobRewardedViewController: NSObject, AdaptedController, PrebidConf adDidReceiveButton.isEnabled = false adDidFailToReceiveButton.isEnabled = false adDidFailToPresentFullScreenContentWithErrorButton.isEnabled = false - adDidPresentFullScreenContentButton.isEnabled = false adWillDismissFullScreenContentButton.isEnabled = false adDidDismissFullScreenContentButton.isEnabled = false adDidRecordImpressionButton.isEnabled = false @@ -168,6 +161,7 @@ class PrebidAdMobRewardedViewController: NSObject, AdaptedController, PrebidConf @IBAction func showButtonClicked() { guard let adapterViewController = adapterViewController else { return } if rewardedAd != nil { + adapterViewController.showButton.isEnabled = false rewardedAd?.present(fromRootViewController: adapterViewController, userDidEarnRewardHandler: { print("User rewarded") }) diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/TestCasesViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/TestCasesViewController.swift index f6b26ee18..07f793fbe 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/TestCasesViewController.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/TestCasesViewController.swift @@ -96,6 +96,8 @@ class TestCasesViewController: UIViewController, UITableViewDelegate, UITableVie } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + searchBar.endEditing(true) //Create and configure the ViewController diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/UtilitiesViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/UtilitiesViewController.swift index 59390f3fd..31d473666 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/UtilitiesViewController.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/UtilitiesViewController.swift @@ -60,19 +60,21 @@ class UtilitiesViewController: FormViewController { } } - @available(iOS 14, *) + lazy var attRequestButton = ButtonRow() { $0.title = "Request Tracking Authorization" } .onCellSelection { [weak self] cell, row in - ATTrackingManager.requestTrackingAuthorization { [weak self] status in - var dialogMessage = UIAlertController(title: "AT Tracking", - message: "Authorization status: \(status.rawValue)", - preferredStyle: .alert) - let ok = UIAlertAction(title: "OK", style: .default, handler: nil) - dialogMessage.addAction(ok) - DispatchQueue.main.async { [weak self] in - self?.present(dialogMessage, animated: true, completion: nil) + if #available(iOS 14, *) { + ATTrackingManager.requestTrackingAuthorization { [weak self] status in + var dialogMessage = UIAlertController(title: "AT Tracking", + message: "Authorization status: \(status.rawValue)", + preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: nil) + dialogMessage.addAction(ok) + DispatchQueue.main.async { [weak self] in + self?.present(dialogMessage, animated: true, completion: nil) + } } } } diff --git a/Podfile b/Podfile index e5943f681..d51d2974a 100644 --- a/Podfile +++ b/Podfile @@ -1,4 +1,3 @@ -# Uncomment the next line to define a global platform for your project platform :ios, '10.0' workspace 'PrebidMobile' @@ -21,6 +20,22 @@ def event_handlers_project use_frameworks! end +def prebid_demo_pods + use_frameworks! + + pod 'GoogleAds-IMA-iOS-SDK' + gma_pods + applovin_pods +end + +def internalTestApp_pods + pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git', :branch => 'xcode12' + pod 'SVProgressHUD' + + applovin_pods + gma_pods +end + target 'PrebidMobileGAMEventHandlers' do event_handlers_project gma_pods @@ -52,15 +67,6 @@ target 'PrebidMobileMAXAdaptersTests' do applovin_pods end -def prebid_demo_pods - use_frameworks! - - pod 'GoogleAds-IMA-iOS-SDK' - - gma_pods - applovin_pods -end - target 'PrebidDemoSwift' do project 'Example/PrebidDemo/PrebidDemo.xcodeproj' @@ -83,14 +89,6 @@ target 'Dr.Prebid' do prebid_demo_pods end -def internalTestApp_pods - pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git', :branch => 'xcode12' - pod 'SVProgressHUD' - - applovin_pods - gma_pods -end - target 'InternalTestApp' do use_frameworks! project 'InternalTestApp/InternalTestApp.xcodeproj' diff --git a/Podfile.lock b/Podfile.lock index 4a558ed45..893b53121 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,49 +1,56 @@ PODS: - Alamofire (4.9.1) - - AppLovinSDK (11.3.2) + - AppLovinSDK (11.5.3) - Eureka (5.2.1) - - Google-Mobile-Ads-SDK (8.5.0): - - GoogleAppMeasurement (< 9.0, >= 7.0) + - Google-Mobile-Ads-SDK (9.12.0): + - GoogleAppMeasurement (< 11.0, >= 7.0) - GoogleUserMessagingPlatform (>= 1.1) - - GoogleAds-IMA-iOS-SDK (3.14.3) - - GoogleAppMeasurement (8.1.0): - - GoogleAppMeasurement/AdIdSupport (= 8.1.0) - - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - - GoogleUtilities/MethodSwizzler (~> 7.4) - - GoogleUtilities/Network (~> 7.4) - - "GoogleUtilities/NSData+zlib (~> 7.4)" - - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (8.1.0): - - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - - GoogleUtilities/MethodSwizzler (~> 7.4) - - GoogleUtilities/Network (~> 7.4) - - "GoogleUtilities/NSData+zlib (~> 7.4)" - - nanopb (~> 2.30908.0) - - GoogleUserMessagingPlatform (2.0.0) - - GoogleUtilities/AppDelegateSwizzler (7.4.1): + - GoogleAds-IMA-iOS-SDK (3.16.3) + - GoogleAppMeasurement (10.1.0): + - GoogleAppMeasurement/AdIdSupport (= 10.1.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.8) + - GoogleUtilities/MethodSwizzler (~> 7.8) + - GoogleUtilities/Network (~> 7.8) + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (10.1.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.1.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.8) + - GoogleUtilities/MethodSwizzler (~> 7.8) + - GoogleUtilities/Network (~> 7.8) + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (10.1.0): + - GoogleUtilities/AppDelegateSwizzler (~> 7.8) + - GoogleUtilities/MethodSwizzler (~> 7.8) + - GoogleUtilities/Network (~> 7.8) + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleUserMessagingPlatform (2.0.1) + - GoogleUtilities/AppDelegateSwizzler (7.8.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.4.1): - - PromisesObjC (~> 1.2) - - GoogleUtilities/Logger (7.4.1): + - GoogleUtilities/Environment (7.8.0): + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.8.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.4.1): + - GoogleUtilities/MethodSwizzler (7.8.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.4.1): + - GoogleUtilities/Network (7.8.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.4.1)" - - GoogleUtilities/Reachability (7.4.1): + - "GoogleUtilities/NSData+zlib (7.8.0)" + - GoogleUtilities/Reachability (7.8.0): - GoogleUtilities/Logger - - nanopb (2.30908.0): - - nanopb/decode (= 2.30908.0) - - nanopb/encode (= 2.30908.0) - - nanopb/decode (2.30908.0) - - nanopb/encode (2.30908.0) - - PromisesObjC (1.2.12) - - RxSwift (6.2.0) + - nanopb (2.30909.0): + - nanopb/decode (= 2.30909.0) + - nanopb/encode (= 2.30909.0) + - nanopb/decode (2.30909.0) + - nanopb/encode (2.30909.0) + - PromisesObjC (2.1.1) + - RxSwift (6.5.0) - SVProgressHUD (2.2.5) DEPENDENCIES: @@ -81,18 +88,18 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 - AppLovinSDK: e0bf2984979b082f7c167e4babc3290b4eac5f24 + AppLovinSDK: 6b10288343b15b31f7037ecd7aa630d6ea117585 Eureka: c883105488e05bc65539f583246ecf9657cabbfe - Google-Mobile-Ads-SDK: 6f5c41bf73db1656e5b203ba9c31e3d0899a128d - GoogleAds-IMA-iOS-SDK: 2a9b7b14bda4993306f05287f952dce41b5be4ad - GoogleAppMeasurement: 9ff7b9e23cced93a5a41736c09bdeb5b5b7fb111 - GoogleUserMessagingPlatform: ab890ce5f6620f293a21b6bdd82e416a2c73aeca - GoogleUtilities: f8a43108b38a68eebe8b3540e1f4f2d28843ce20 - nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 - PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97 - RxSwift: d356ab7bee873611322f134c5f9ef379fa183d8f + Google-Mobile-Ads-SDK: b4e9efb765ef1693ae9dd94c527b6c1d91ee5052 + GoogleAds-IMA-iOS-SDK: 1aba71fa5b58dc463cc5b752f06e970ec7c739c1 + GoogleAppMeasurement: e490e248af3da95afe8fa8e7baac232dc8d020b7 + GoogleUserMessagingPlatform: 5f8b30daf181805317b6b985bb51c1ff3beca054 + GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7 + nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 + PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb + RxSwift: 5710a9e6b17f3c3d6e40d6e559b9fa1e813b2ef8 SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 -PODFILE CHECKSUM: 5812afa461fa52589abde35888a38186816c1c6f +PODFILE CHECKSUM: 7609b46c294c5675d252c4f9512d71bc6d75bada COCOAPODS: 1.11.3 diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index 4d8ba8158..71192a88a 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -3138,19 +3138,19 @@ FAEE4CE7262DC2B200AD9966 /* AdUnits */ = { isa = PBXGroup; children = ( - FAEE4CE8262DC2B200AD9966 /* RewardedVideoAdUnit.swift */, FAEE4CE9262DC2B200AD9966 /* AdUnit.swift */, + FAEE4CF4262DC2B200AD9966 /* BannerAdUnit.swift */, FAEE4CEA262DC2B200AD9966 /* BannerBaseAdUnit.swift */, - FAEE4CEB262DC2B200AD9966 /* Native */, + 53E45A0227FCD09C0095C0B2 /* BannerParameters.swift */, FAEE4CF2262DC2B200AD9966 /* InterstitialAdUnit.swift */, - FAEE4CF3262DC2B200AD9966 /* VideoAdUnit.swift */, - FAEE4CF4262DC2B200AD9966 /* BannerAdUnit.swift */, - FAEE4CF5262DC2B200AD9966 /* VideoInterstitialAdUnit.swift */, - FAEE4CF6262DC2B200AD9966 /* Utils.swift */, + FAEE4CE8262DC2B200AD9966 /* RewardedVideoAdUnit.swift */, FAEE4CF7262DC2B200AD9966 /* Signals.swift */, + FAEE4CF6262DC2B200AD9966 /* Utils.swift */, + FAEE4CF3262DC2B200AD9966 /* VideoAdUnit.swift */, FAEE4CF8262DC2B200AD9966 /* VideoBaseAdUnit.swift */, - 53E45A0227FCD09C0095C0B2 /* BannerParameters.swift */, + FAEE4CF5262DC2B200AD9966 /* VideoInterstitialAdUnit.swift */, 53E3910D27FCD60800DBA2F7 /* VideoParameters.swift */, + FAEE4CEB262DC2B200AD9966 /* Native */, ); path = AdUnits; sourceTree = ""; diff --git a/PrebidMobile/PrebidMobileRendering/Prebid/Integrations/MediationAPI/MediationUtils.swift b/PrebidMobile/PrebidMobileRendering/Prebid/Integrations/MediationAPI/MediationUtils.swift index d28c8d852..f0be0a088 100644 --- a/PrebidMobile/PrebidMobileRendering/Prebid/Integrations/MediationAPI/MediationUtils.swift +++ b/PrebidMobile/PrebidMobileRendering/Prebid/Integrations/MediationAPI/MediationUtils.swift @@ -24,7 +24,8 @@ public class MediationUtils: NSObject { return isServerParameterInTargetingInfoDict(serverParameter, targetingInfoDictionary) } - public static func isServerParameterInTargetingInfoDict(_ serverParameter: String, _ targetingInfoDictionary: [String: String]) -> Bool { + public static func isServerParameterInTargetingInfoDict(_ serverParameter: String, + _ targetingInfoDictionary: [String: String]) -> Bool { guard let serverParametersDictionary = stringToDictionary(dataString: serverParameter) else { Log.warn("Wrong server parameter format.") return false @@ -33,7 +34,8 @@ public class MediationUtils: NSObject { return isServerParameterDictInTargetingInfoDict(serverParametersDictionary, targetingInfoDictionary) } - public static func isServerParameterDictInTargetingInfoDict(_ serverParametersDictionary: [String: String], _ targetingInfoDictionary: [String: String]) -> Bool { + public static func isServerParameterDictInTargetingInfoDict(_ serverParametersDictionary: [String: String], + _ targetingInfoDictionary: [String: String]) -> Bool { guard !serverParametersDictionary.isEmpty else { Log.warn("Server parameters dictionary is empty") diff --git a/PrebidMobile/PrebidMobileRendering/Utilities/PBMLocationManager.m b/PrebidMobile/PrebidMobileRendering/Utilities/PBMLocationManager.m index b43e3f552..fdef69073 100644 --- a/PrebidMobile/PrebidMobileRendering/Utilities/PBMLocationManager.m +++ b/PrebidMobile/PrebidMobileRendering/Utilities/PBMLocationManager.m @@ -161,10 +161,6 @@ - (void)startLocationUpdates { return; } - if (![[self.locationManager class] locationServicesEnabled]) { - return; - } - if (![self isAuthorizedStatus:[[self.locationManager class] authorizationStatus]]) { return; } diff --git a/PrebidMobileAdMobAdapters.podspec b/PrebidMobileAdMobAdapters.podspec index 89185def4..7b737a0c1 100644 --- a/PrebidMobileAdMobAdapters.podspec +++ b/PrebidMobileAdMobAdapters.podspec @@ -44,6 +44,6 @@ Pod::Spec.new do |s| s.static_framework = true s.dependency 'PrebidMobile', '2.0.3' - s.dependency 'Google-Mobile-Ads-SDK', '8.5.0' + s.dependency 'Google-Mobile-Ads-SDK' end diff --git a/tools/PrebidValidator/Dr.Prebid.xcodeproj/project.pbxproj b/tools/PrebidValidator/Dr.Prebid.xcodeproj/project.pbxproj index 90f2542b0..055ccdf65 100644 --- a/tools/PrebidValidator/Dr.Prebid.xcodeproj/project.pbxproj +++ b/tools/PrebidValidator/Dr.Prebid.xcodeproj/project.pbxproj @@ -647,7 +647,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Dr.Prebid/Pods-Dr.Prebid-resources.sh", - "${PODS_ROOT}/AppLovinSDK/applovin-ios-sdk-11.3.2/AppLovinSDKResources.bundle", + "${PODS_ROOT}/AppLovinSDK/applovin-ios-sdk-11.5.3/AppLovinSDKResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -668,7 +668,7 @@ "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", - "${PODS_ROOT}/GoogleAds-IMA-iOS-SDK/GoogleInteractiveMediaAds.framework", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/GoogleAds-IMA-iOS-SDK/GoogleInteractiveMediaAds.framework/GoogleInteractiveMediaAds", ); name = "[CP] Embed Pods Frameworks"; outputPaths = (