Skip to content

Commit 90be2dd

Browse files
committed
AdmobAdapterExtra migration to TeadsAdSettings
1 parent ca20062 commit 90be2dd

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ DerivedData
2323
# you should judge for yourself, the pros and cons are mentioned at:
2424
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
2525
#
26-
# Pods/
26+
Pods/

TeadsDemoApp/Controllers/adMobController/AdMobController.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import GoogleMobileAds
99
import TeadsAdMobAdapter
10+
import TeadsSDK
1011
import UIKit
1112

1213
class AdMobController: UIViewController, GADBannerViewDelegate {
@@ -36,19 +37,19 @@ class AdMobController: UIViewController, GADBannerViewDelegate {
3637

3738
// 3. Load a new ad (this will call AdMob and Teads afterward)
3839
let request = GADRequest()
39-
let teadsExtras = GADMAdapterTeadsExtras()
40-
teadsExtras.adContainer = self.view
41-
teadsExtras.debugMode = true
42-
teadsExtras.reportLocation = false
43-
// Needed by european regulation
44-
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
45-
// teadsExtras.subjectToGDPR = "1"
46-
// teadsExtras.consent = "0001100101010101"
40+
let adSettings = TeadsAdSettings { (settings) in
41+
settings.enableDebug()
42+
settings.disableLocation()
43+
44+
// Needed by european regulation
45+
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
46+
//settings.userConsent(subjectToGDPR: "1", consent: "0001100101010101")
47+
48+
// The article url if you are a news publisher
49+
//settings.pageUrl("http://page.com/article1")
50+
}
4751

48-
// The article url if you are a news publisher
49-
//teadsExtras.pageUrl = "http://page.com/article1"
50-
51-
request.register(teadsExtras.getCustomEventExtras(forCustomEventLabel: "Teads"))
52+
request.register(teadsAdSettings: adSettings, for: "Teads")
5253

5354
bannerView.load(request)
5455
}

TeadsDemoApp/Controllers/adMobController/AdMobInWebViewController.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import UIKit
1010
import WebKit
1111
import GoogleMobileAds
1212
import TeadsAdMobAdapter
13+
import TeadsSDK
1314

1415
class AdMobInWebViewController: UIViewController, WKNavigationDelegate, GADBannerViewDelegate {
1516

@@ -37,16 +38,17 @@ class AdMobInWebViewController: UIViewController, WKNavigationDelegate, GADBanne
3738
self.bannerView.delegate = self
3839

3940
let request = GADRequest()
40-
let teadsExtras = GADMAdapterTeadsExtras()
41-
// Needed by european regulation
42-
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
43-
// teadsExtras.subjectToGDPR = "1"
44-
// teadsExtras.consent = "0001100101010101"
45-
46-
// The article url if you are a news publisher
47-
//teadsExtras.pageUrl = "http://page.com/article1"
41+
let adSettings = TeadsAdSettings { (settings) in
42+
// Needed by european regulation
43+
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
44+
//settings.userConsent(subjectToGDPR: "1", consent: "0001100101010101")
45+
46+
// The article url if you are a news publisher
47+
//settings.pageUrl("http://page.com/article1")
48+
}
4849

49-
request.register(teadsExtras.getCustomEventExtras(forCustomEventLabel: "Teads"))
50+
request.register(teadsAdSettings: adSettings, for: "Teads")
51+
5052
self.bannerView.load(request)
5153
self.webSync = SyncWebViewAdView(webView: self.webView, selector: "#my-placement-id", adView: self.bannerView)
5254
}

0 commit comments

Comments
 (0)