Skip to content

Commit

Permalink
Add adaptive ad format (#42)
Browse files Browse the repository at this point in the history
* Committing changes for adaptive ad format

* Fixing the way adaptive_banner is used

* Update version
  • Loading branch information
CB-RyanMcCormick authored Sep 8, 2023
1 parent 0210574 commit 348f854
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Note the first digit of every adapter version corresponds to the major version of the Chartboost Mediation SDK compatible with that adapter.
Adapters are compatible with any Chartboost Mediation SDK version within that major version.

### 4.6.12.1.6
- Updated to handle recent AdFormat changes.

### 4.6.12.1.5
- Guard against multiple continuation resumes during ad load and show.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Chartboost Mediation Vungle adapter mediates Vungle via the Chartboost Media

In your `build.gradle`, add the following entry:
```
implementation "com.chartboost:chartboost-mediation-adapter-vungle:4.6.12.1.5"
implementation "com.chartboost:chartboost-mediation-adapter-vungle:4.6.12.1.6"
```

## Contributions
Expand Down
2 changes: 1 addition & 1 deletion VungleAdapter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {
minSdk = 21
targetSdk = 33
// If you touch the following line, don't forget to update scripts/get_rc_version.zsh
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "4.6.12.1.5"
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "4.6.12.1.6"
buildConfigField("String", "CHARTBOOST_MEDIATION_VUNGLE_ADAPTER_VERSION", "\"${android.defaultConfig.versionName}\"")

consumerProguardFiles("proguard-rules.pro")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,11 @@ class VungleAdapter : PartnerAdapter {
): Result<PartnerAd> {
PartnerLogController.log(LOAD_STARTED)

return when (request.format) {
AdFormat.BANNER -> {
return when (request.format.key) {
AdFormat.BANNER.key, "adaptive_banner" -> {
loadBannerAd(request, partnerAdListener)
}
AdFormat.INTERSTITIAL, AdFormat.REWARDED -> {
AdFormat.INTERSTITIAL.key, AdFormat.REWARDED.key -> {
loadFullscreenAd(request, partnerAdListener)
}
else -> {
Expand All @@ -396,13 +396,13 @@ class VungleAdapter : PartnerAdapter {

val listener = listeners.remove(partnerAd.request.identifier)

return when (partnerAd.request.format) {
return when (partnerAd.request.format.key) {
// Banner ads do not have a separate "show" mechanism.
AdFormat.BANNER -> {
AdFormat.BANNER.key, "adaptive_banner" -> {
PartnerLogController.log(SHOW_SUCCEEDED)
Result.success(partnerAd)
}
AdFormat.INTERSTITIAL, AdFormat.REWARDED -> showFullscreenAd(
AdFormat.INTERSTITIAL.key, AdFormat.REWARDED.key -> showFullscreenAd(
partnerAd,
listener
)
Expand Down Expand Up @@ -430,13 +430,13 @@ class VungleAdapter : PartnerAdapter {
listeners.remove(partnerAd.request.identifier)
adms.remove(partnerAd.request.partnerPlacement)

return when (partnerAd.request.format) {
return when (partnerAd.request.format.key) {
/**
* Only invalidate banner ads.
* For fullscreen ads, since Vungle does not provide an ad in the load callback, we don't
* have an ad in PartnerAd to invalidate.
*/
AdFormat.BANNER -> destroyBannerAd(partnerAd)
AdFormat.BANNER.key, "adaptive_banner" -> destroyBannerAd(partnerAd)
else -> {
PartnerLogController.log(INVALIDATE_SUCCEEDED)
Result.success(partnerAd)
Expand Down

0 comments on commit 348f854

Please sign in to comment.