Skip to content

Commit

Permalink
Committing changes for adaptive ad format (#48)
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 179c14c commit eb17a67
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 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.9.4.1.2
- Updated to handle recent AdFormat changes.

### 4.9.4.1.1
- Guard against multiple continuation resumes.

Expand Down
2 changes: 1 addition & 1 deletion ChartboostAdapter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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.9.4.1.1"
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "4.9.4.1.2"
buildConfigField("String", "CHARTBOOST_MEDIATION_CHARTBOOST_ADAPTER_VERSION", "\"${android.defaultConfig.versionName}\"")

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

return when (request.format) {
AdFormat.BANNER -> loadBannerAd(context, request, partnerAdListener)
AdFormat.INTERSTITIAL -> loadInterstitialAd(request, partnerAdListener)
AdFormat.REWARDED -> loadRewardedAd(request, partnerAdListener)
return when (request.format.key) {
AdFormat.BANNER.key, "adaptive_banner" -> loadBannerAd(context, request, partnerAdListener)
AdFormat.INTERSTITIAL.key -> loadInterstitialAd(request, partnerAdListener)
AdFormat.REWARDED.key -> loadRewardedAd(request, partnerAdListener)
else -> {
PartnerLogController.log(LOAD_FAILED)
Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_LOAD_FAILURE_UNSUPPORTED_AD_FORMAT))
Expand All @@ -308,14 +308,14 @@ class ChartboostAdapter : PartnerAdapter {
override suspend fun show(context: Context, partnerAd: PartnerAd): Result<PartnerAd> {
PartnerLogController.log(SHOW_STARTED)

return when (partnerAd.request.format) {
AdFormat.BANNER -> {
return when (partnerAd.request.format.key) {
AdFormat.BANNER.key, "adaptive_banner" -> {
// Banner ads do not have a separate "show" mechanism.
PartnerLogController.log(SHOW_SUCCEEDED)
Result.success(partnerAd)
}
AdFormat.INTERSTITIAL -> showInterstitialAd(partnerAd)
AdFormat.REWARDED -> showRewardedAd(partnerAd)
AdFormat.INTERSTITIAL.key -> showInterstitialAd(partnerAd)
AdFormat.REWARDED.key -> showRewardedAd(partnerAd)
else -> {
PartnerLogController.log(SHOW_FAILED)
Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_SHOW_FAILURE_UNSUPPORTED_AD_FORMAT))
Expand All @@ -333,9 +333,9 @@ class ChartboostAdapter : PartnerAdapter {
override suspend fun invalidate(partnerAd: PartnerAd): Result<PartnerAd> {
PartnerLogController.log(INVALIDATE_STARTED)

return when (partnerAd.request.format) {
AdFormat.BANNER -> destroyBannerAd(partnerAd)
AdFormat.INTERSTITIAL, AdFormat.REWARDED -> {
return when (partnerAd.request.format.key) {
AdFormat.BANNER.key, "adaptive_banner" -> destroyBannerAd(partnerAd)
AdFormat.INTERSTITIAL.key, AdFormat.REWARDED.key -> {
// Chartboost does not have destroy methods for their fullscreen ads.
PartnerLogController.log(INVALIDATE_SUCCEEDED)
Result.success(partnerAd)
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 Chartboost adapter mediates Chartboost via the Chartboo

In your `build.gradle`, add the following entry:
```
implementation "com.chartboost:chartboost-mediation-adapter-chartboost:4.9.4.1.1"
implementation "com.chartboost:chartboost-mediation-adapter-chartboost:4.9.4.1.2"
```

## Contributions
Expand Down

0 comments on commit eb17a67

Please sign in to comment.