Skip to content

Commit

Permalink
Fix that test ads be shown on devices registered with TestDevice
Browse files Browse the repository at this point in the history
* Regardless of whether 'isDevelop' is true or false
  • Loading branch information
ko2ic committed May 13, 2019
1 parent cd7f907 commit 21caf86
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.0

* Fix that test ads be shown on devices registered with TestDevice regardless of ```isDevelop```.

## 0.7.0

* Implement onAdViewCreated callback.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,16 @@ class BannerView(private val context: Context, id: Int, messenger: BinaryMesseng

if (isDevelop) {
publisherAdView?.adUnitId = "/6499/example/banner"
builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
val testDevices = arguments["testDevices"] as? List<*>
if (testDevices != null) {
testDevices.filterIsInstance<String>().forEach { testDevice ->
builder.addTestDevice(testDevice)
}
}
} else {
publisherAdView?.adUnitId = adUnitId
}

builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
val testDevices = arguments["testDevices"] as? List<*>
testDevices?.filterIsInstance<String>()?.forEach { testDevice ->
builder.addTestDevice(testDevice)
}

publisherAdView?.setAdSizes(*adSizes)
publisherAdView?.visibility = View.VISIBLE
publisherAdView?.adListener = BannerListener(channel, publisherAdView)
Expand Down
7 changes: 4 additions & 3 deletions ios/Classes/BannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ class BannerView: NSObject, FlutterPlatformView {
let request = DFPRequest()
if isDevelop {
bannerView.adUnitID = "/6499/example/banner"
if let testDevices = testDevices {
request.testDevices = testDevices
}
} else {
bannerView.adUnitID = adUnitId
}

if let testDevices = testDevices {
request.testDevices = testDevices
}

bannerView.delegate = self

bannerView.rootViewController = UIApplication.shared.delegate!.window!!.rootViewController!
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_google_ad_manager
description: Flutter plugin for Google Ad Manager(DoubleClick for Publishers).
version: 0.7.0
version: 0.8.0
author: koji ishii <ko2ic.dev@gmail.com>
homepage: https://github.com/ko2ic/flutter_google_ad_manager

Expand Down

0 comments on commit 21caf86

Please sign in to comment.