Skip to content

Commit

Permalink
fix(ios): address deprecated methods (#1)
Browse files Browse the repository at this point in the history
* fix(ios): removed/replaced depreciated methods

* fix(ios): moved testDeviceIdentifiers & setTagForChildDirectedTreatment to admob module

* doc: fix docs

Co-authored-by: Vikas Goyal <38314488+vikas-goyal-syncplicity@users.noreply.github.com>
  • Loading branch information
vikas-goyal-axway and vikas-goyal-axway authored Jul 2, 2020
1 parent 4d88f13 commit b8d4f1d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
19 changes: 19 additions & 0 deletions docs/admob-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ Debug geography. Used for debug devices only.
Indicates whether the user is tagged for under age of consent.

---

### testDeviceIdentifiers

> `testDeviceIdentifiers :Array<String>`
Test ads will be returned for devices with device IDs specified in this array. Use AdMob.SIMULATOR_ID to add the simulator.

## Methods

### createBannerView
Expand Down Expand Up @@ -179,6 +187,17 @@ Resets consent information to default state and clears ad providers.

---

### setTagForChildDirectedTreatment
> `setTagForChildDirectedTreatment(value) → void`
This option allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA) - https//business.ftc.gov/privacy-and-security/childrens-privacy.

| Name | Type | Description |
| --- | --- | --- |
| `value` | `Boolean` | |

---

### setTagForUnderAgeOfConsent

> `setTagForUnderAgeOfConsent(value) → void`
Expand Down
2 changes: 0 additions & 2 deletions docs/banner-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ Starts loading the ad. You can customize the request by specifiying any of the f
| `options.keywords` | `Array<String>` | Keywords for targeting purposes. |
| `options.extras` | `Object` | Extra parameters to pass to a specific ad network adapter. |
| `options.contentUrl` | `Object` | Content URL for targeting purposes. |
| `options.tagForChildDirectedTreatment` | `Boolean` | This option allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA) - https//business.ftc.gov/privacy-and-security/childrens-privacy. |
| `options.requestAgent` | `String` | Request agent string to identify the ad request's origin. |
| `options.testDevices` | `Array<String>` | Test ads will be returned for devices with device IDs specified in this array. Use AdMob.SIMULATOR_ID to add the simulator. |

## Events

Expand Down
2 changes: 0 additions & 2 deletions docs/interstitial-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ Starts loading the ad. You can customize the request by specifiying any of the f
| `options.keywords` | `Array<String>` | Keywords for targeting purposes. |
| `options.extras` | `Object` | Extra parameters to pass to a specific ad network adapter. |
| `options.contentUrl` | `Object` | Content URL for targeting purposes. |
| `options.tagForChildDirectedTreatment` | `Boolean` | This option allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA) - https//business.ftc.gov/privacy-and-security/childrens-privacy. |
| `options.requestAgent` | `String` | Request agent string to identify the ad request's origin. |
| `options.testDevices` | `Array<String>` | Test ads will be returned for devices with device IDs specified in this array. Use AdMob.SIMULATOR_ID to add the simulator. |

---

Expand Down
7 changes: 0 additions & 7 deletions ios/Classes/AdProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,9 @@ extension AdProxy {
if let contentUrl = options["contentUrl"] as? String {
request.contentURL = contentUrl
}
if let tagForChildDirectedTreatment = options["tagForChildDirectedTreatment"] as? NSNumber {
request.tag(forChildDirectedTreatment: tagForChildDirectedTreatment.boolValue)
}
if let requestAgent = options["requestAgent"] as? String {
request.requestAgent = requestAgent
}
if let testDevices = options["testDevices"] as? [String] {
request.testDevices = testDevices
}

return request
}
}
23 changes: 20 additions & 3 deletions ios/Classes/TiAdmobModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,17 @@ extension TiAdmobModule {
PACConsentInformation.sharedInstance.debugGeography = PACDebugGeography(rawValue: newValue.intValue) ?? PACDebugGeography.disabled
}
}


@objc
public var testDeviceIdentifiers: [String] {
get {
return GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers ?? []
}
set {
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = newValue
}
}

@objc(setTagForUnderAgeOfConsent:)
public func setTagForUnderAgeOfConsent(arg: Any?) {
if let value = arg as? NSNumber {
Expand Down Expand Up @@ -173,18 +183,25 @@ extension TiAdmobModule {
})
}
}

@objc(setTagForChildDirectedTreatment:)
public func setTagForChildDirectedTreatment(arg: Any?) {
if let value = arg as? NSNumber {
GADMobileAds.sharedInstance().requestConfiguration.tag(forChildDirectedTreatment: value.boolValue)
}
}
}

// MARK: Reporting options

extension TiAdmobModule {
@objc
public func disableAutomatedInAppPurchaseReporting() {
GADMobileAds.disableAutomatedInAppPurchaseReporting()
GADMobileAds.sharedInstance().disableAutomatedInAppPurchaseReporting()
}

@objc
public func disableSDKCrashReporting() {
GADMobileAds.disableSDKCrashReporting()
GADMobileAds.sharedInstance().disableSDKCrashReporting()
}
}

0 comments on commit b8d4f1d

Please sign in to comment.