From ea0aea54a89016fd27ba55d530dd23925f165e0c Mon Sep 17 00:00:00 2001 From: Justin Malandruccolo Date: Thu, 10 Aug 2023 14:27:50 -0700 Subject: [PATCH] Added UMP SDK integration to Adaptive Banner Objective-C & Swift samples PiperOrigin-RevId: 555655077 --- .../project.pbxproj | 14 +++ .../AdaptiveBannerExample/AppDelegate.h | 2 +- .../AdaptiveBannerExample/AppDelegate.m | 9 +- .../Base.lproj/Main.storyboard | 35 ++++++- .../GoogleMobileAdsConsentManager.h | 44 +++++++++ .../GoogleMobileAdsConsentManager.m | 80 ++++++++++++++++ .../AdaptiveBannerExample/ViewController.h | 4 +- .../AdaptiveBannerExample/ViewController.m | 70 ++++++++++++-- .../project.pbxproj | 14 +++ .../AdaptiveBannerExample/AppDelegate.h | 2 +- .../AdaptiveBannerExample/AppDelegate.m | 10 +- .../Base.lproj/Main.storyboard | 41 +++++++-- .../GoogleMobileAdsConsentManager.h | 44 +++++++++ .../GoogleMobileAdsConsentManager.m | 80 ++++++++++++++++ .../AdaptiveBannerExample/ViewController.h | 3 +- .../AdaptiveBannerExample/ViewController.m | 91 +++++++++++++++++-- .../project.pbxproj | 13 +++ .../AdaptiveBannerExample/AppDelegate.swift | 12 +-- .../Base.lproj/Main.storyboard | 35 ++++++- .../GoogleMobileAdsConsentManager.swift | 73 +++++++++++++++ .../ViewController.swift | 58 ++++++++++-- .../project.pbxproj | 12 +++ .../AdaptiveBannerExample/AppDelegate.swift | 12 +-- .../Base.lproj/Main.storyboard | 41 +++++++-- .../GoogleMobileAdsConsentManager.swift | 73 +++++++++++++++ .../ViewController.swift | 71 +++++++++++++-- 26 files changed, 849 insertions(+), 94 deletions(-) create mode 100644 Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/GoogleMobileAdsConsentManager.h create mode 100644 Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/GoogleMobileAdsConsentManager.m create mode 100644 Objective-C/admob/AdaptiveBannerExample/AdaptiveBannerExample/GoogleMobileAdsConsentManager.h create mode 100644 Objective-C/admob/AdaptiveBannerExample/AdaptiveBannerExample/GoogleMobileAdsConsentManager.m create mode 100644 Swift/admanager/AdaptiveBannerExample/AdaptiveBannerExample/GoogleMobileAdsConsentManager.swift create mode 100644 Swift/admob/AdaptiveBannerExample/AdaptiveBannerExample/GoogleMobileAdsConsentManager.swift diff --git a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample.xcodeproj/project.pbxproj b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample.xcodeproj/project.pbxproj index bb728f0e..5c842799 100644 --- a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample.xcodeproj/project.pbxproj +++ b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + A8369D7B2A84216100F125DE /* GoogleMobileAdsConsentManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A8369D792A84216100F125DE /* GoogleMobileAdsConsentManager.m */; }; CF86EE1D19787E6B00411520 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CF86EE1C19787E6B00411520 /* main.m */; }; CF86EE2019787E6B00411520 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CF86EE1F19787E6B00411520 /* AppDelegate.m */; }; CF86EE2319787E6B00411520 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CF86EE2219787E6B00411520 /* ViewController.m */; }; @@ -15,6 +16,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + A8369D792A84216100F125DE /* GoogleMobileAdsConsentManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleMobileAdsConsentManager.m; sourceTree = ""; }; + A8369D7A2A84216100F125DE /* GoogleMobileAdsConsentManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoogleMobileAdsConsentManager.h; sourceTree = ""; }; CF86EE1719787E6B00411520 /* AdaptiveBannerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdaptiveBannerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; CF86EE1B19787E6B00411520 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; CF86EE1C19787E6B00411520 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -37,11 +40,19 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 76596DC8E8109CB3E49DD466 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + path = Pods; + sourceTree = ""; + }; CF86EE0E19787E6B00411520 = { isa = PBXGroup; children = ( CF86EE1919787E6B00411520 /* AdaptiveBannerExample */, CF86EE1819787E6B00411520 /* Products */, + 76596DC8E8109CB3E49DD466 /* Pods */, ); sourceTree = ""; }; @@ -58,6 +69,8 @@ children = ( CF86EE1E19787E6B00411520 /* AppDelegate.h */, CF86EE1F19787E6B00411520 /* AppDelegate.m */, + A8369D7A2A84216100F125DE /* GoogleMobileAdsConsentManager.h */, + A8369D792A84216100F125DE /* GoogleMobileAdsConsentManager.m */, CF86EE2119787E6B00411520 /* ViewController.h */, CF86EE2219787E6B00411520 /* ViewController.m */, CF86EE2419787E6B00411520 /* Main.storyboard */, @@ -146,6 +159,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + A8369D7B2A84216100F125DE /* GoogleMobileAdsConsentManager.m in Sources */, CF86EE2319787E6B00411520 /* ViewController.m in Sources */, CF86EE2019787E6B00411520 /* AppDelegate.m in Sources */, CF86EE1D19787E6B00411520 /* main.m in Sources */, diff --git a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.h b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.h index 0e06127b..04e0f5ed 100644 --- a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.h +++ b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2019 Google, Inc. +// Copyright (C) 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.m b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.m index cf484431..6e4b1a90 100644 --- a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.m +++ b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/AppDelegate.m @@ -1,5 +1,5 @@ // -// Copyright (C) 2019 Google, Inc. +// Copyright (C) 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ // #import "AppDelegate.h" -#import @interface AppDelegate () @@ -25,12 +24,6 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Add the iOS simulator as a test device (this is default behavior but included for - // demonstration purposes). - GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ GADSimulatorID ]; - - // Initialize Google Mobile Ads SDK - [GADMobileAds.sharedInstance startWithCompletionHandler:nil]; return YES; } diff --git a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/Base.lproj/Main.storyboard b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/Base.lproj/Main.storyboard index e480a18b..71cffed2 100644 --- a/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/Base.lproj/Main.storyboard +++ b/Objective-C/admanager/AdaptiveBannerExample/AdaptiveBannerExample/Base.lproj/Main.storyboard @@ -1,12 +1,28 @@ - + - + + + + + + + + + + + + + + + + + @@ -20,7 +36,7 @@