From 34327d505cfd7c1a9c8ff9f9c46508f245b106c8 Mon Sep 17 00:00:00 2001 From: mobile-ads-github Date: Wed, 29 May 2024 11:31:38 +0300 Subject: [PATCH] some comments --- Adapters/Yandex/ISYandexAdapter/build.gradle | 4 +--- .../com/ironsource/adapters/yandex/YandexAdapter.kt | 12 ++++++++++-- .../adapters/yandex/banner/YandexBannerAdapter.kt | 3 ++- .../interstitial/YandexInterstitialAdListener.kt | 4 +++- .../yandex/interstitial/YandexInterstitialAdapter.kt | 5 ++++- .../rewardedvideo/YandexRewardedVideoAdListener.kt | 2 ++ .../rewardedvideo/YandexRewardedVideoAdapter.kt | 7 ++++++- 7 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Adapters/Yandex/ISYandexAdapter/build.gradle b/Adapters/Yandex/ISYandexAdapter/build.gradle index b5d2d9b4..4ca6ba17 100644 --- a/Adapters/Yandex/ISYandexAdapter/build.gradle +++ b/Adapters/Yandex/ISYandexAdapter/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' ext { - adapterVersion = '4.3.0' + adapterVersion = '4.3.0' // We recommend using the version based on the Yandex SDK version like '7.0.1.0' or '7.0.1' } def getGitHash = { -> @@ -71,5 +71,3 @@ task createAAR(type: Copy,group:'buildTasks') { fileName.replace('release', adapterVersion) } } - - diff --git a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/YandexAdapter.kt b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/YandexAdapter.kt index bd8f0756..f8cb0d67 100644 --- a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/YandexAdapter.kt +++ b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/YandexAdapter.kt @@ -47,7 +47,7 @@ class YandexAdapter(providerName: String) : AbstractAdapter(providerName), private const val GitHash: String = BuildConfig.GitHash // Yandex keys - private const val MEDIATION_NAME: String = "ironSource" + private const val MEDIATION_NAME: String = "ironSource" // We recommend using only lowercase like "ironsource" private const val APP_ID_KEY: String = "appId" private const val AD_UNIT_ID_KEY: String = "adUnitId" @@ -157,10 +157,18 @@ class YandexAdapter(providerName: String) : AbstractAdapter(providerName), MobileAds.setUserConsent(consent) } + override fun setMetaData(p0: String?, p1: MutableList?) { + super.setMetaData(p0, p1) + // Yandex SDK supports COPPA using MobileAds::setAgeRestrictedUser + // Please use it if you have that information + } + //endregion // region Helpers fun collectBiddingData(biddingDataCallback: BiddingDataCallback, bidderTokenRequest: BidderTokenRequestConfiguration) { + + // This check is not necessary, the SDK will be initialized automatically if it has not already been if (mInitState != InitState.INIT_STATE_SUCCESS) { val error = "returning null as token since init isn't completed" IronLog.INTERNAL.verbose(error) @@ -195,4 +203,4 @@ class YandexAdapter(providerName: String) : AbstractAdapter(providerName), //endregion -} \ No newline at end of file +} diff --git a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/banner/YandexBannerAdapter.kt b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/banner/YandexBannerAdapter.kt index 04f1db17..f103650e 100644 --- a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/banner/YandexBannerAdapter.kt +++ b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/banner/YandexBannerAdapter.kt @@ -127,6 +127,7 @@ class YandexBannerAdapter (adapter: YandexAdapter) : val adRequest: AdRequest = AdRequest.Builder() .setBiddingData(serverData) + .setParameters(adapter.getConfigParams()) // Please pass these params in AdRequest .build() bannerAdView.setBannerAdEventListener(mYandexAdListener) @@ -215,4 +216,4 @@ class YandexBannerAdapter (adapter: YandexAdapter) : } //endregion -} \ No newline at end of file +} diff --git a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdListener.kt b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdListener.kt index 430f5d27..f2aa469a 100644 --- a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdListener.kt +++ b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdListener.kt @@ -44,6 +44,8 @@ class YandexInterstitialAdListener( override fun onAdImpression(impressionData: ImpressionData?) { IronLog.ADAPTER_CALLBACK.verbose() + // Yandex SDK provide ::onAdShown callback for the ad opening event + // Is this actually the correct place to call ::onInterstitialAdOpened and ::onInterstitialAdShowSucceeded? mListener.onInterstitialAdOpened() mListener.onInterstitialAdShowSucceeded() } @@ -67,4 +69,4 @@ class YandexInterstitialAdListener( mListener.onInterstitialAdClosed() mAdapter.get()?.destroyInterstitialAd() } -} \ No newline at end of file +} diff --git a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdapter.kt b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdapter.kt index 33dca853..6ac856e3 100644 --- a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdapter.kt +++ b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/interstitial/YandexInterstitialAdapter.kt @@ -102,6 +102,8 @@ AbstractInterstitialAdapter(adapter) { val adUnitIdKey = YandexAdapter.getAdUnitIdKey() val adUnitId = getConfigStringValueFromKey(config, adUnitIdKey) + // If a single adapter instance is used for multiple ad requests + // a loader can be created only once to improve performance val interstitialAdLoader = InterstitialAdLoader(ContextProvider.getInstance().applicationContext).apply { setAdLoadListener(mYandexAdListener) } @@ -110,6 +112,7 @@ AbstractInterstitialAdapter(adapter) { val adRequest: AdRequestConfiguration = AdRequestConfiguration.Builder(adUnitId) .setBiddingData(serverData) + .setParameters(adapter.getConfigParams()) // Please pass these params in AdRequestConfiguration .build() postOnUIThread { @@ -183,4 +186,4 @@ AbstractInterstitialAdapter(adapter) { //endregion -} \ No newline at end of file +} diff --git a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdListener.kt b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdListener.kt index 527d5749..b883451a 100644 --- a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdListener.kt +++ b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdListener.kt @@ -47,6 +47,8 @@ class YandexRewardedVideoAdListener ( override fun onAdImpression(impressionData: ImpressionData?) { IronLog.ADAPTER_CALLBACK.verbose() + // Yandex SDK provide ::onAdShown callback for the ad opening event + // Is this actually the correct place to call ::onRewardedVideoAdOpened and :: onRewardedVideoAdStarted? mListener.onRewardedVideoAdOpened() mListener.onRewardedVideoAdStarted() } diff --git a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdapter.kt b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdapter.kt index a3d580f1..2a9301f6 100644 --- a/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdapter.kt +++ b/Adapters/Yandex/ISYandexAdapter/src/main/java/com/ironsource/adapters/yandex/rewardedvideo/YandexRewardedVideoAdapter.kt @@ -102,6 +102,9 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) : val adUnitIdKey = YandexAdapter.getAdUnitIdKey() val adUnitId = config.optString(adUnitIdKey) + + // If a single adapter instance is used for multiple ad requests + // a loader can be created only once to improve performance val rewardedVideoAdLoader = RewardedAdLoader(ContextProvider.getInstance().applicationContext).apply { setAdLoadListener(mYandexAdListener) } @@ -110,6 +113,7 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) : val adRequest: AdRequestConfiguration = AdRequestConfiguration.Builder(adUnitId) .setBiddingData(serverData) + .setParameters(adapter.getConfigParams()) // Please pass these params in AdRequestConfiguration .build() postOnUIThread { @@ -156,6 +160,7 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) : override fun releaseMemory(adUnit: IronSource.AD_UNIT, config: JSONObject?) { IronLog.INTERNAL.verbose("adUnit = $adUnit") + // Is this check only required for RewardedVideo? Why it absent in other formats? if (adUnit == IronSource.AD_UNIT.REWARDED_VIDEO) { destroyRewardedVideoAd() mYandexAdListener = null @@ -184,4 +189,4 @@ class YandexRewardedVideoAdapter(adapter: YandexAdapter) : //endregion -} \ No newline at end of file +}