From 68931b5d9cd5e2bf92ea37c8eefe56a45daa95ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=AD=90=E7=BB=B4?= Date: Mon, 25 Mar 2024 15:35:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B9=BF=E5=91=8A=E4=BD=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=AC=AC=E4=B8=89=E6=96=B9=E5=B9=BF=E5=91=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BC=98=E5=8C=96=E2=80=94=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=20https://jira.shanqu.cc/browse/GHZS-4959?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/gh/ad/AdDelegateHelper.kt | 13 ++++++++----- .../main/java/com/gh/gamecenter/entity/AdConfig.kt | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/gh/ad/AdDelegateHelper.kt b/app/src/main/java/com/gh/ad/AdDelegateHelper.kt index a3890d307c..22897e5c73 100644 --- a/app/src/main/java/com/gh/ad/AdDelegateHelper.kt +++ b/app/src/main/java/com/gh/ad/AdDelegateHelper.kt @@ -192,7 +192,8 @@ object AdDelegateHelper { /** * 热启动是否需要显示开屏广告 */ - private fun shouldShowStartUpAdWhenHotLaunch() = mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK + private fun shouldShowStartUpAdWhenHotLaunch() = + mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK && mSplashAd?.hotStartThirdPartyAd != null /** * 是否需要显示下载管理广告 @@ -386,8 +387,10 @@ object AdDelegateHelper { } } + val thirdPartyAd = if (isHotLaunch) mSplashAd?.hotStartThirdPartyAd else mSplashAd?.thirdPartyAd + // 第三方广告的数据为空,按加载失败处理 - if (mSplashAd == null || mSplashAd?.thirdPartyAd == null) { + if (mSplashAd == null || thirdPartyAd == null) { sdkSplashCallback.invoke(false) return } @@ -398,14 +401,14 @@ object AdDelegateHelper { ((mSplashAd?.displayRule?.timeout ?: 3.5F) * 1000).toInt() } - if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_BEIZI) { + if (thirdPartyAd.sourceName == AD_SDK_BEIZI) { sdkStartAdContainer.visibility = View.VISIBLE requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, timeout.toLong(), sdkSplashCallback) - } else if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_CSJ) { + } else if (thirdPartyAd.sourceName == AD_SDK_CSJ) { sdkStartAdContainer.visibility = View.VISIBLE requestCsjSplashAd( activity, - mSplashAd?.thirdPartyAd?.slotId ?: "unknown", + thirdPartyAd.slotId, adViewWidthInPx, adViewHeightInPx, adViewWidthInDp, diff --git a/app/src/main/java/com/gh/gamecenter/entity/AdConfig.kt b/app/src/main/java/com/gh/gamecenter/entity/AdConfig.kt index a949bc4dbe..873be69cf8 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/AdConfig.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/AdConfig.kt @@ -13,6 +13,8 @@ class AdConfig( val displayRule: DisplayRule, @SerializedName("third_party_ads") val thirdPartyAd: ThirdPartyAd? = null, + @SerializedName("third_party_ads_1") + val hotStartThirdPartyAd: ThirdPartyAd? = null, // 热启动开屏广告 @SerializedName("owner_ads") val ownerAd: OwnerAdEntity? = null, ) {