Skip to content

Commit

Permalink
fix(cordova/ios): update API
Browse files Browse the repository at this point in the history
  • Loading branch information
ratson committed Mar 3, 2024
1 parent e80bb55 commit da95f24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
6 changes: 3 additions & 3 deletions packages/cordova/src/ios/AMBCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ extension AMBCoreContext {
requestConfiguration.maxAdContentRating = maxAdContentRating
}
if let tag = optChildDirectedTreatmentTag() {
requestConfiguration.tag(forChildDirectedTreatment: tag)
requestConfiguration.tagForChildDirectedTreatment = NSNumber(value: tag)
}
if let tag = optUnderAgeOfConsentTag() {
requestConfiguration.tagForUnderAge(ofConsent: tag)
requestConfiguration.tagForUnderAgeOfConsent = NSNumber(value: tag)
}
if let testDevices = optTestDeviceIds() {
requestConfiguration.testDeviceIdentifiers = testDevices
}
if let sameAppKey = optBool("sameAppKey") {
requestConfiguration.setSameAppKeyEnabled(sameAppKey)
requestConfiguration.setPublisherFirstPartyIDEnabled(sameAppKey)
}
if let
publisherFirstPartyIDEnabled = optBool("publisherFirstPartyIDEnabled") {
Expand Down
23 changes: 2 additions & 21 deletions packages/cordova/src/ios/AMBPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,7 @@ class AMBPlugin: CDVPlugin {

@objc func configRequest(_ command: CDVInvokedUrlCommand) {
let ctx = AMBContext(command)
let requestConfiguration = GADMobileAds.sharedInstance().requestConfiguration

if let maxAdContentRating = ctx.optMaxAdContentRating() {
requestConfiguration.maxAdContentRating = maxAdContentRating
}

if let tag = ctx.optChildDirectedTreatmentTag() {
requestConfiguration.tag(forChildDirectedTreatment: tag)
}

if let tag = ctx.optUnderAgeOfConsentTag() {
requestConfiguration.tagForUnderAge(ofConsent: tag)
}

if let testDevices = ctx.optTestDeviceIds() {
requestConfiguration.testDeviceIdentifiers = testDevices
}

ctx.resolve()
ctx.configure()
}

@objc func requestTrackingAuthorization(_ command: CDVInvokedUrlCommand) {
Expand All @@ -76,9 +58,8 @@ class AMBPlugin: CDVPlugin {

@objc func start(_ command: CDVInvokedUrlCommand) {
let ctx = AMBContext(command)

GADMobileAds.sharedInstance().start(completionHandler: { _ in
ctx.resolve(["version": GADMobileAds.sharedInstance().sdkVersion])
ctx.resolve(["version": GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)])
})
}

Expand Down

0 comments on commit da95f24

Please sign in to comment.