diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index ed03bee..360e302 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up JDK 11 + - name: set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 79c43e8..2a85375 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -14,10 +14,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up JDK 11 + - name: set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 564df1a..ee12e71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up JDK 11 + - name: set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed4255..1a74284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. +### 5.1.0.1.0 +- This version of the adapter supports Chartboost Mediation SDK version 5.+. + ### 4.1.0.1.2 - Added setting to return oversized banner ads. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdb3176..d60b66d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ Follow these guides to create a detailed and effective report for us to understa * **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened. ### Pull Requests -In order to submit pull requests, you are required to review and sign the [Contribution License Agreement (CLA)](https://developers.chartboost.com/docs/mediation-contribution-license-agreement) which is available on the Chartboost website to view. Once you have read the agreement, sign the appropriate form depending on whether you are an individual an employer contributor. +In order to submit pull requests, you are required to review and sign the [Contribution License Agreement (CLA)](https://docs.chartboost.com/en/partners/contribution-license-agreement/) which is available on the Chartboost website to view. Once you have read the agreement, sign the appropriate form depending on whether you are an individual an employer contributor. - [Individual contributor license agreement form](https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=159c66e8-610c-4afc-9330-15bc2217c291&env=na3&acct=9c982e12-8675-45df-9d81-95fe3656e695&v=2). _You wish to contribute on your own behalf as an individual._ @@ -43,7 +43,7 @@ _You wish to contribute on behalf of your employer._ #### Submitting a Pull Request Follow these steps to have your contribution considered by the maintainers: -1. Review and sign the [Contribution License Agreement (CLA)](https://developers.chartboost.com/docs/mediation-contribution-license-agreement). +1. Review and sign the [Contribution License Agreement (CLA)](https://docs.chartboost.com/en/partners/contribution-license-agreement/). 2. Identify the issue related to your fix. If an issue doesn't exist, then create a new issue. 3. Create a pull request. 4. Format the title starting with the issue number, followed by a brief description of the fox. _Example: `[ISSUE-60] Fix null pointer exception`._ diff --git a/README.md b/README.md index 5e102d6..f922a17 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,15 @@ The Chartboost Mediation Reference adapter mediates the Reference SDK via the Ch ## Minimum Requirements | Plugin | Version | -| ------------------------ | ------- | -| Chartboost Mediation SDK | 4.0.0+ | +| ------------------------ |---------| +| Chartboost Mediation SDK | 5.0.0+ | | Android API | 21+ | ## Integration In your `build.gradle`, add the following entry: ``` - implementation "com.chartboost:chartboost-mediation-adapter-reference:4.1.0.1.2" + implementation "com.chartboost:chartboost-mediation-adapter-reference:5.1.0.1.0" ``` ## Chartboost Mediation Custom Adapter Implementation Guidelines diff --git a/ReferenceAdapter/build.gradle.kts b/ReferenceAdapter/build.gradle.kts index 566ce44..8149af2 100644 --- a/ReferenceAdapter/build.gradle.kts +++ b/ReferenceAdapter/build.gradle.kts @@ -1,6 +1,6 @@ /* * Copyright 2022-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ @@ -17,24 +17,31 @@ plugins { repositories { google() mavenCentral() + maven("https://cboost.jfrog.io/artifactory/private-chartboost-core/") { + credentials { + username = System.getenv("JFROG_USER") + password = System.getenv("JFROG_PASS") + } + } maven("https://cboost.jfrog.io/artifactory/private-chartboost-mediation/") { credentials { username = System.getenv("JFROG_USER") password = System.getenv("JFROG_PASS") } } + maven("https://cboost.jfrog.io/artifactory/chartboost-core/") maven("https://cboost.jfrog.io/artifactory/chartboost-mediation/") } android { namespace = "com.chartboost.mediation.referenceadapter" - compileSdk = 33 + compileSdk = 34 defaultConfig { minSdk = 21 - targetSdk = 33 + targetSdk = 34 // If you touch the following line, don't forget to update scripts/get_rc_version.zsh - android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "4.1.0.1.2" + android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "5.1.0.1.0" buildConfigField("String", "CHARTBOOST_MEDIATION_REFERENCE_ADAPTER_VERSION", "\"${android.defaultConfig.versionName}\"") testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -44,6 +51,7 @@ android { productFlavors { create("local") create("remote") + create("candidate") } buildTypes { @@ -58,15 +66,26 @@ android { buildFeatures { viewBinding = true + buildConfig = true + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" } } dependencies { - "localImplementation"(project(":Helium")) + "localImplementation"(project(":ChartboostMediation")) // For external usage, please use the following production dependency. // You may choose a different release version. - "remoteImplementation"("com.chartboost:chartboost-mediation-sdk:4.0.0") + "remoteImplementation"("com.chartboost:chartboost-mediation-sdk:5.0.0") + "candidateImplementation"("com.chartboost:chartboost-mediation-sdk:5.0.0") // Reference Partner implementation("androidx.activity:activity-ktx:1.6.1") diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapter.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapter.kt index ab27194..0bab2e1 100644 --- a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapter.kt +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapter.kt @@ -1,22 +1,48 @@ /* * Copyright 2023-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ package com.chartboost.mediation.referenceadapter.adapter +import android.app.Activity import android.content.Context import android.util.Size -import com.chartboost.heliumsdk.domain.* -import com.chartboost.heliumsdk.utils.LogController -import com.chartboost.heliumsdk.utils.PartnerLogController -import com.chartboost.heliumsdk.utils.PartnerLogController.PartnerAdapterEvents.* -import com.chartboost.mediation.referenceadapter.BuildConfig +import com.chartboost.chartboostmediationsdk.ad.ChartboostMediationBannerAdView.ChartboostMediationBannerSize.Companion.asSize +import com.chartboost.chartboostmediationsdk.domain.* +import com.chartboost.chartboostmediationsdk.utils.LogController +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.BIDDER_INFO_FETCH_FAILED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.BIDDER_INFO_FETCH_STARTED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.BIDDER_INFO_FETCH_SUCCEEDED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.CUSTOM +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.DID_CLICK +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.DID_DISMISS +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.DID_EXPIRE +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.DID_REWARD +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.DID_TRACK_IMPRESSION +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.INVALIDATE_STARTED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.INVALIDATE_SUCCEEDED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.LOAD_FAILED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.LOAD_STARTED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.LOAD_SUCCEEDED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.SETUP_FAILED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.SETUP_STARTED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.SETUP_SUCCEEDED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.SHOW_FAILED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.SHOW_STARTED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.SHOW_SUCCEEDED +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.USER_IS_NOT_UNDERAGE +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.USER_IS_UNDERAGE +import com.chartboost.core.consent.ConsentKey +import com.chartboost.core.consent.ConsentValue import com.chartboost.mediation.referenceadapter.sdk.ReferenceBanner import com.chartboost.mediation.referenceadapter.sdk.ReferenceFullscreenAd -import com.chartboost.mediation.referenceadapter.sdk.ReferenceFullscreenAd.ReferenceFullscreenAdFormat.* +import com.chartboost.mediation.referenceadapter.sdk.ReferenceFullscreenAd.ReferenceFullscreenAdFormat.INTERSTITIAL +import com.chartboost.mediation.referenceadapter.sdk.ReferenceFullscreenAd.ReferenceFullscreenAdFormat.REWARDED +import com.chartboost.mediation.referenceadapter.sdk.ReferenceFullscreenAd.ReferenceFullscreenAdFormat.REWARDED_INTERSTITIAL import com.chartboost.mediation.referenceadapter.sdk.ReferenceSdk import kotlinx.coroutines.delay import kotlinx.coroutines.suspendCancellableCoroutine @@ -33,42 +59,14 @@ import kotlin.coroutines.resume */ class ReferenceAdapter : PartnerAdapter { /** - * A map of Chartboost Mediation's listeners for the corresponding load identifier. - */ - private val listeners = mutableMapOf() - - /** - * Override this value to return the version of the partner SDK. - */ - override val partnerSdkVersion: String - get() = ReferenceSdk.REFERENCE_SDK_VERSION - - /** - * Override this value to return the version of the mediation adapter. - * - * You may version the adapter using any preferred convention, but it is recommended to apply the - * following format if the adapter will be published by Chartboost Mediation: - * - * Chartboost Mediation.Partner.Adapter - * - * "Chartboost Mediation" represents the Chartboost Mediation SDK’s major version that is compatible with this adapter. This must be 1 digit. - * "Partner" represents the partner SDK’s major.minor.patch.x (where x is optional) version that is compatible with this adapter. This can be 3-4 digits. - * "Adapter" represents this adapter’s version (starting with 0), which resets to 0 when the partner SDK’s version changes. This must be 1 digit. - */ - override val adapterVersion: String - get() = BuildConfig.CHARTBOOST_MEDIATION_REFERENCE_ADAPTER_VERSION - - /** - * Override this value to return the name of the partner SDK. + * The Reference adapter configuration. */ - override val partnerId: String - get() = "reference" + override var configuration: PartnerAdapterConfiguration = ReferenceAdapterConfiguration /** - * Override this value to return the display name of the partner SDK. + * A map of Chartboost Mediation's listeners for the corresponding load identifier. */ - override val partnerDisplayName: String - get() = "Reference" + private val listeners = mutableMapOf() /** * Override this method to initialize the partner SDK so that it's ready to request and display ads. @@ -81,12 +79,13 @@ class ReferenceAdapter : PartnerAdapter { override suspend fun setUp( context: Context, partnerConfiguration: PartnerConfiguration, - ): Result { + ): Result> { PartnerLogController.log(SETUP_STARTED) return ReferenceSdk.initialize().fold( onSuccess = { - Result.success(PartnerLogController.log(SETUP_SUCCEEDED)) + PartnerLogController.log(SETUP_SUCCEEDED) + Result.success(emptyMap()) }, onFailure = { PartnerLogController.log(SETUP_FAILED) @@ -116,18 +115,14 @@ class ReferenceAdapter : PartnerAdapter { delay(1000L) - return when (request.format.key) { - AdFormat.BANNER.key, "adaptive_banner" -> { + return when (request.format) { + PartnerAdFormats.BANNER -> { loadBannerAd(context, request) } - AdFormat.INTERSTITIAL.key, AdFormat.REWARDED.key -> loadFullscreenAd(context, request) + PartnerAdFormats.INTERSTITIAL, PartnerAdFormats.REWARDED, PartnerAdFormats.REWARDED_INTERSTITIAL -> loadFullscreenAd(context, request) else -> { - if (request.format.key == "rewarded_interstitial") { - loadFullscreenAd(context, request) - } else { - PartnerLogController.log(LOAD_FAILED) - Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_LOAD_FAILURE_UNSUPPORTED_AD_FORMAT)) - } + PartnerLogController.log(LOAD_FAILED) + Result.failure(ChartboostMediationAdException(ChartboostMediationError.LoadError.UnsupportedAdFormat)) } } } @@ -152,38 +147,47 @@ class ReferenceAdapter : PartnerAdapter { return Result.success(partnerAd) } + override fun setConsents( + context: Context, + consents: Map, + modifiedKeys: Set + ) { + consents.forEach { + PartnerLogController.log( + CUSTOM, + "${PartnerLogController.PRIVACY_TAG} ${it.key}: ${it.value}", + ) + } + } + /** * Override this method to show the partner ad. * - * @param context The current Context. + * @param activity The current [Activity]. * @param partnerAd The partner ad to be shown. * * @return Result.success(PartnerAd) if the ad was successfully shown, Result.failure(Exception) otherwise. */ override suspend fun show( - context: Context, + activity: Activity, partnerAd: PartnerAd, ): Result { PartnerLogController.log(SHOW_STARTED) - return when (partnerAd.request.format.key) { - AdFormat.BANNER.key, "adaptive_banner" -> { + return when (partnerAd.request.format) { + PartnerAdFormats.BANNER -> { // Banners do not have a "show" mechanism. PartnerLogController.log(SHOW_SUCCEEDED) Result.success(partnerAd) } - AdFormat.INTERSTITIAL.key, AdFormat.REWARDED.key -> { + PartnerAdFormats.INTERSTITIAL, PartnerAdFormats.REWARDED, PartnerAdFormats.REWARDED_INTERSTITIAL -> { showFullscreenAd(partnerAd) } else -> { - if (partnerAd.request.format.key == "rewarded_interstitial") { - showFullscreenAd(partnerAd) - } else { - PartnerLogController.log(SHOW_FAILED) - Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_SHOW_FAILURE_UNSUPPORTED_AD_FORMAT)) - } + PartnerLogController.log(SHOW_FAILED) + Result.failure(ChartboostMediationAdException(ChartboostMediationError.ShowError.UnsupportedAdFormat)) } } } @@ -198,84 +202,31 @@ class ReferenceAdapter : PartnerAdapter { */ override suspend fun fetchBidderInformation( context: Context, - request: PreBidRequest, - ): Map { + request: PartnerAdPreBidRequest, + ): Result> { PartnerLogController.log(BIDDER_INFO_FETCH_STARTED) val token = ReferenceSdk.getBidToken() PartnerLogController.log(if (token.isNotEmpty()) BIDDER_INFO_FETCH_SUCCEEDED else BIDDER_INFO_FETCH_FAILED) - return mapOf("bid_token" to token) - } - - /** - * Override this method to notify your partner SDK of GDPR applicability as determined by - * the Chartboost Mediation SDK. - * - * @param context The current [Context]. - * @param applies True if GDPR applies, false otherwise. - * @param gdprConsentStatus The user's GDPR consent status. - */ - override fun setGdpr( - context: Context, - applies: Boolean?, - gdprConsentStatus: GdprConsentStatus, - ) { - PartnerLogController.log( - when (applies) { - true -> GDPR_APPLICABLE - false -> GDPR_NOT_APPLICABLE - else -> GDPR_UNKNOWN - }, - ) - - PartnerLogController.log( - when (gdprConsentStatus) { - GdprConsentStatus.GDPR_CONSENT_UNKNOWN -> GDPR_CONSENT_UNKNOWN - GdprConsentStatus.GDPR_CONSENT_GRANTED -> GDPR_CONSENT_GRANTED - GdprConsentStatus.GDPR_CONSENT_DENIED -> GDPR_CONSENT_DENIED - }, - ) + return Result.success(mapOf("bid_token" to token)) } /** - * Override this method to notify your partner SDK of the CCPA privacy String as supplied by - * the Chartboost Mediation SDK. + * Override this method to notify your partner SDK if the user is underage. * * @param context The current [Context]. - * @param hasGrantedCcpaConsent True if the user has granted CCPA consent, false otherwise. - * @param privacyString The CCPA privacy String. + * @param isUserUnderage True if the user is underage, false otherwise. */ - override fun setCcpaConsent( + override fun setIsUserUnderage( context: Context, - hasGrantedCcpaConsent: Boolean, - privacyString: String, + isUserUnderage: Boolean, ) { PartnerLogController.log( - if (hasGrantedCcpaConsent) { - CCPA_CONSENT_GRANTED + if (isUserUnderage) { + USER_IS_UNDERAGE } else { - CCPA_CONSENT_DENIED - }, - ) - } - - /** - * Override this method to notify your partner SDK of the COPPA subjectivity as determined by - * the Chartboost Mediation SDK. - * - * @param context The current [Context]. - * @param isSubjectToCoppa True if the user is subject to COPPA, false otherwise. - */ - override fun setUserSubjectToCoppa( - context: Context, - isSubjectToCoppa: Boolean, - ) { - PartnerLogController.log( - if (isSubjectToCoppa) { - COPPA_SUBJECT - } else { - COPPA_NOT_SUBJECT + USER_IS_NOT_UNDERAGE }, ) } @@ -297,7 +248,7 @@ class ReferenceAdapter : PartnerAdapter { ReferenceBanner( context, request.partnerPlacement, - chartboostMediationToReferenceBannerSize(request.size), + chartboostMediationToReferenceBannerSize(request.bannerSize?.asSize()), ) return ad.load( @@ -371,18 +322,15 @@ class ReferenceAdapter : PartnerAdapter { context = context, adUnitId = request.partnerPlacement, adFormat = - when (request.format.key) { - AdFormat.INTERSTITIAL.key -> INTERSTITIAL - AdFormat.REWARDED.key -> REWARDED + when (request.format) { + PartnerAdFormats.INTERSTITIAL -> INTERSTITIAL + PartnerAdFormats.REWARDED -> REWARDED + PartnerAdFormats.REWARDED_INTERSTITIAL -> REWARDED_INTERSTITIAL else -> { - if (request.format.key == "rewarded_interstitial") { - REWARDED_INTERSTITIAL - } else { - PartnerLogController.log(LOAD_FAILED) - return Result.failure( - ChartboostMediationAdException(ChartboostMediationError.CM_LOAD_FAILURE_UNSUPPORTED_AD_FORMAT), - ) - } + PartnerLogController.log(LOAD_FAILED) + return Result.failure( + ChartboostMediationAdException(ChartboostMediationError.LoadError.UnsupportedAdFormat), + ) } }, ) @@ -437,7 +385,7 @@ class ReferenceAdapter : PartnerAdapter { resumeOnce( Result.failure( ChartboostMediationAdException( - ChartboostMediationError.CM_SHOW_FAILURE_UNKNOWN, + ChartboostMediationError.ShowError.Unknown, ), ), ) @@ -490,11 +438,11 @@ class ReferenceAdapter : PartnerAdapter { } } else { PartnerLogController.log(SHOW_FAILED, "Ad is not a ReferenceFullscreenAd.") - return Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_SHOW_FAILURE_WRONG_RESOURCE_TYPE)) + return Result.failure(ChartboostMediationAdException(ChartboostMediationError.ShowError.WrongResourceType)) } } ?: run { PartnerLogController.log(SHOW_FAILED, "Ad is null.") - return Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_SHOW_FAILURE_AD_NOT_FOUND)) + return Result.failure(ChartboostMediationAdException(ChartboostMediationError.ShowError.AdNotFound)) } } @@ -523,7 +471,7 @@ class ReferenceAdapter : PartnerAdapter { ad: Any, request: PartnerAdLoadRequest, ): PartnerAd { - val adSize = ReferenceSdk.getOversizedAdSize(request.size ?: Size(1, 1)) + val adSize = ReferenceSdk.getOversizedAdSize(request.bannerSize?.asSize() ?: Size(1, 1)) return PartnerAd( ad, mapOf( diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapterConfiguration.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapterConfiguration.kt new file mode 100644 index 0000000..6d72d36 --- /dev/null +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/adapter/ReferenceAdapterConfiguration.kt @@ -0,0 +1,36 @@ +package com.chartboost.mediation.referenceadapter.adapter + +import com.chartboost.chartboostmediationsdk.domain.PartnerAdapterConfiguration +import com.chartboost.mediation.referenceadapter.BuildConfig +import com.chartboost.mediation.referenceadapter.sdk.ReferenceSdk + +object ReferenceAdapterConfiguration : PartnerAdapterConfiguration { + /** + * The partner name for internal uses. + */ + override val partnerId = "reference" + + /** + * The partner name for external uses. + */ + override val partnerDisplayName = "Reference" + + /** + * The partner SDK version. + */ + override val partnerSdkVersion = ReferenceSdk.REFERENCE_SDK_VERSION + + /** + * The partner adapter version. + * + * You may version the adapter using any preferred convention, but it is recommended to apply the + * following format if the adapter will be published by Chartboost Mediation: + * + * Chartboost Mediation.Partner.Adapter + * + * "Chartboost Mediation" represents the Chartboost Mediation SDK’s major version that is compatible with this adapter. This must be 1 digit. + * "Partner" represents the partner SDK’s major.minor.patch.x (where x is optional) version that is compatible with this adapter. This can be 3-4 digits. + * "Adapter" represents this adapter’s version (starting with 0), which resets to 0 when the partner SDK’s version changes. This must be 1 digit. + */ + override val adapterVersion = BuildConfig.CHARTBOOST_MEDIATION_REFERENCE_ADAPTER_VERSION +} diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceBanner.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceBanner.kt index 38ed37c..bcc3e8a 100644 --- a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceBanner.kt +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceBanner.kt @@ -1,6 +1,6 @@ /* * Copyright 2023-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ @@ -16,10 +16,10 @@ import android.view.View import android.view.ViewConfiguration import android.webkit.WebView import android.widget.LinearLayout -import com.chartboost.heliumsdk.domain.ChartboostMediationAdException -import com.chartboost.heliumsdk.domain.ChartboostMediationError -import com.chartboost.heliumsdk.utils.PartnerLogController -import com.chartboost.heliumsdk.utils.PartnerLogController.PartnerAdapterEvents.CUSTOM +import com.chartboost.chartboostmediationsdk.domain.ChartboostMediationAdException +import com.chartboost.chartboostmediationsdk.domain.ChartboostMediationError +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.CUSTOM /** * INTERNAL. FOR DEMO AND TESTING PURPOSES ONLY. DO NOT USE DIRECTLY. @@ -58,7 +58,7 @@ class ReferenceBanner( onAdClicked: () -> Unit, ): Result { return if (!ReferenceSettings.adLoadShouldSucceed) { - Result.failure(ChartboostMediationAdException(ChartboostMediationError.CM_LOAD_FAILURE_UNKNOWN)) + Result.failure(ChartboostMediationAdException(ChartboostMediationError.LoadError.Unknown)) } else { PartnerLogController.log( CUSTOM, diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenActivity.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenActivity.kt index 9d116c2..c78b38e 100644 --- a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenActivity.kt +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenActivity.kt @@ -1,6 +1,6 @@ /* * Copyright 2023-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ @@ -27,8 +27,8 @@ import android.widget.TextView import android.widget.VideoView import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity -import com.chartboost.heliumsdk.domain.ChartboostMediationAdException -import com.chartboost.heliumsdk.domain.ChartboostMediationError +import com.chartboost.chartboostmediationsdk.domain.ChartboostMediationAdException +import com.chartboost.chartboostmediationsdk.domain.ChartboostMediationError import com.chartboost.mediation.referenceadapter.R import com.chartboost.mediation.referenceadapter.databinding.ActivityReferenceFullscreenBinding import com.chartboost.mediation.referenceadapter.sdk.ReferenceFullscreenAd.Companion.FULLSCREEN_AD_TYPE @@ -209,7 +209,7 @@ class ReferenceFullscreenActivity : AppCompatActivity() { } else { onAdDismissed( ChartboostMediationAdException( - ChartboostMediationError.CM_INTERNAL_ERROR, + ChartboostMediationError.OtherError.InternalError, ), ) } @@ -367,7 +367,7 @@ class ReferenceFullscreenActivity : AppCompatActivity() { if (ReferenceSettings.adCloseShouldSucceed) { onAdDismissed(null) } else { - onAdDismissed(ChartboostMediationAdException(ChartboostMediationError.CM_INTERNAL_ERROR)) + onAdDismissed(ChartboostMediationAdException(ChartboostMediationError.OtherError.InternalError)) } adDismissTracked = true } diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenAd.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenAd.kt index 8d71a4f..4ed4c96 100644 --- a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenAd.kt +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceFullscreenAd.kt @@ -1,6 +1,6 @@ /* * Copyright 2023-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ @@ -11,10 +11,10 @@ import android.annotation.SuppressLint import android.content.Context import android.content.Intent import androidx.appcompat.app.AppCompatActivity -import com.chartboost.heliumsdk.domain.ChartboostMediationAdException -import com.chartboost.heliumsdk.domain.ChartboostMediationError -import com.chartboost.heliumsdk.utils.PartnerLogController -import com.chartboost.heliumsdk.utils.PartnerLogController.PartnerAdapterEvents.* +import com.chartboost.chartboostmediationsdk.domain.ChartboostMediationAdException +import com.chartboost.chartboostmediationsdk.domain.ChartboostMediationError +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController +import com.chartboost.chartboostmediationsdk.utils.PartnerLogController.PartnerAdapterEvents.* import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers.Main @@ -59,7 +59,7 @@ class ReferenceFullscreenAd( onFullScreenAdLoadFailed: (ChartboostMediationAdException) -> Unit, ) { if (!ReferenceSettings.adLoadShouldSucceed) { - onFullScreenAdLoadFailed(ChartboostMediationAdException(ChartboostMediationError.CM_LOAD_FAILURE_UNKNOWN)) + onFullScreenAdLoadFailed(ChartboostMediationAdException(ChartboostMediationError.LoadError.Unknown)) } else { PartnerLogController.log( CUSTOM, diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSdk.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSdk.kt index 015048f..b8931a6 100644 --- a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSdk.kt +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSdk.kt @@ -1,6 +1,6 @@ /* * Copyright 2023-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ diff --git a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSettings.kt b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSettings.kt index 3755427..506b688 100644 --- a/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSettings.kt +++ b/ReferenceAdapter/src/main/java/com/chartboost/mediation/referenceadapter/sdk/ReferenceSettings.kt @@ -1,6 +1,6 @@ /* * Copyright 2023-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ diff --git a/build.gradle.kts b/build.gradle.kts index c5df207..510feeb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ /* * Copyright 2022-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ @@ -13,9 +13,9 @@ buildscript { } plugins { - id("com.android.application") version "7.4.1" apply false - id("com.android.library") version "7.4.1" apply false - id("org.jetbrains.kotlin.android") version "1.7.20" apply false + id("com.android.application") version "8.2.2" apply false + id("com.android.library") version "8.2.2" apply false + id("org.jetbrains.kotlin.android") version "1.9.21" apply false } task("clean") { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8e47e68..b01990d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Jun 23 19:36:48 EDT 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle.kts b/settings.gradle.kts index a4b2be8..c7ac1f2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ /* * Copyright 2022-2024 Chartboost, Inc. - * + * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file. */ @@ -16,4 +16,4 @@ pluginManagement { rootProject.name = "ReferenceAdapter" include(":ReferenceAdapter") include(":android-helium-sdk") -include(":Helium") +include(":ChartboostMediation")