Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adaptive ad format #42

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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