Skip to content

Commit

Permalink
AdmobAdapterExtra migration to TeadsAdSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
elneruda committed May 26, 2020
1 parent ca20062 commit 90be2dd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ DerivedData
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/
Pods/
25 changes: 13 additions & 12 deletions TeadsDemoApp/Controllers/adMobController/AdMobController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import GoogleMobileAds
import TeadsAdMobAdapter
import TeadsSDK
import UIKit

class AdMobController: UIViewController, GADBannerViewDelegate {
Expand Down Expand Up @@ -36,19 +37,19 @@ class AdMobController: UIViewController, GADBannerViewDelegate {

// 3. Load a new ad (this will call AdMob and Teads afterward)
let request = GADRequest()
let teadsExtras = GADMAdapterTeadsExtras()
teadsExtras.adContainer = self.view
teadsExtras.debugMode = true
teadsExtras.reportLocation = false
// Needed by european regulation
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
// teadsExtras.subjectToGDPR = "1"
// teadsExtras.consent = "0001100101010101"
let adSettings = TeadsAdSettings { (settings) in
settings.enableDebug()
settings.disableLocation()

// Needed by european regulation
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
//settings.userConsent(subjectToGDPR: "1", consent: "0001100101010101")

// The article url if you are a news publisher
//settings.pageUrl("http://page.com/article1")
}

// The article url if you are a news publisher
//teadsExtras.pageUrl = "http://page.com/article1"

request.register(teadsExtras.getCustomEventExtras(forCustomEventLabel: "Teads"))
request.register(teadsAdSettings: adSettings, for: "Teads")

bannerView.load(request)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit
import WebKit
import GoogleMobileAds
import TeadsAdMobAdapter
import TeadsSDK

class AdMobInWebViewController: UIViewController, WKNavigationDelegate, GADBannerViewDelegate {

Expand Down Expand Up @@ -37,16 +38,17 @@ class AdMobInWebViewController: UIViewController, WKNavigationDelegate, GADBanne
self.bannerView.delegate = self

let request = GADRequest()
let teadsExtras = GADMAdapterTeadsExtras()
// Needed by european regulation
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
// teadsExtras.subjectToGDPR = "1"
// teadsExtras.consent = "0001100101010101"

// The article url if you are a news publisher
//teadsExtras.pageUrl = "http://page.com/article1"
let adSettings = TeadsAdSettings { (settings) in
// Needed by european regulation
// See https://mobile.teads.tv/sdk/documentation/ios/gdpr-consent
//settings.userConsent(subjectToGDPR: "1", consent: "0001100101010101")

// The article url if you are a news publisher
//settings.pageUrl("http://page.com/article1")
}

request.register(teadsExtras.getCustomEventExtras(forCustomEventLabel: "Teads"))
request.register(teadsAdSettings: adSettings, for: "Teads")

self.bannerView.load(request)
self.webSync = SyncWebViewAdView(webView: self.webView, selector: "#my-placement-id", adView: self.bannerView)
}
Expand Down

0 comments on commit 90be2dd

Please sign in to comment.