diff --git a/app/src/internal/res/xml/network_security_config.xml b/app/src/internal/res/xml/network_security_config.xml index c87ab1208b..30884c7ca2 100644 --- a/app/src/internal/res/xml/network_security_config.xml +++ b/app/src/internal/res/xml/network_security_config.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt index c4e7ae5d55..950c5f978c 100644 --- a/app/src/main/java/com/gh/common/util/DirectUtils.kt +++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt @@ -311,13 +311,14 @@ object DirectUtils { name = linkEntity.name, display = linkEntity.display ?: Display() ), - entrance + entrance, + exposureEvent ) } "column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance) - "server", "game_server", "开服表" -> directToGameServers(context, entrance, path) + "server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent) "top_game_comment" -> directToAmway(context, null, entrance, path) @@ -439,11 +440,28 @@ object DirectUtils { "game_list" -> directToGameCollectionSquare(context, entrance, "", "", "") - "game_list_detail" -> directToGameCollectionDetail(context, linkEntity.link ?: "", entrance) + "game_list_detail" -> directToGameCollectionDetail( + context, + linkEntity.link ?: "", + entrance, + exposureEvent = exposureEvent + ) - "explore_column", "game_explore" -> context.startActivity(DiscoveryActivity.getIntent(context, entrance)) + "explore_column", "game_explore" -> context.startActivity( + DiscoveryActivity.getIntent( + context, + entrance, + exposureEvent + ) + ) - "column_test_v2" -> context.startActivity(GameServerTestV2Activity.getIntent(context, entrance)) + "column_test_v2" -> context.startActivity( + GameServerTestV2Activity.getIntent( + context, + entrance, + exposureEvent + ) + ) "" -> { // do nothing @@ -1356,11 +1374,17 @@ object DirectUtils { * 跳转到板块 */ @JvmStatic - fun directToBlock(context: Context, blockData: SubjectRecommendEntity, entrance: String) { + fun directToBlock( + context: Context, + blockData: SubjectRecommendEntity, + entrance: String, + exposureEvent: ExposureEvent? = null + ) { val bundle = Bundle() bundle.putString(KEY_TO, BlockActivity::class.java.name) bundle.putParcelable(KEY_BLOCK_DATA, blockData) bundle.putString(KEY_ENTRANCE, entrance) + exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) } jumpActivity(context, bundle) } @@ -1368,10 +1392,11 @@ object DirectUtils { * 跳转到开服表 */ @JvmStatic - fun directToGameServers(context: Context, entrance: String, path: String) { + fun directToGameServers(context: Context, entrance: String, path: String, exposureEvent: ExposureEvent? = null) { val bundle = Bundle() bundle.putString(KEY_TO, GameServersActivity::class.java.name) bundle.putString(KEY_ENTRANCE, ToolBarActivity.mergeEntranceAndPath(entrance, path)) + exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) } jumpActivity(context, bundle) } @@ -1821,7 +1846,8 @@ object DirectUtils { collectionId: String, blockId: String = "", blockName: String = "", - entrance: String = "" + entrance: String = "", + exposureEvent: ExposureEvent? = null ) { if (collectionId.isEmpty()) return val bundle = Bundle() @@ -1830,6 +1856,7 @@ object DirectUtils { bundle.putString(KEY_BLOCK_NAME, blockName) bundle.putString(KEY_ENTRANCE, entrance) bundle.putString(KEY_COLLECTION_ID, collectionId) + exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) } jumpActivity(context, bundle) } @@ -1865,13 +1892,20 @@ object DirectUtils { * 跳转至游戏单详情 */ @JvmStatic - fun directToGameCollectionDetail(context: Context, id: String, entrance: String? = null, path: String? = null) { + fun directToGameCollectionDetail( + context: Context, + id: String, + entrance: String? = null, + path: String? = null, + exposureEvent: ExposureEvent? = null + ) { if (id.isEmpty()) return val bundle = Bundle() bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER) bundle.putString(KEY_PATH, path) bundle.putString(KEY_TO, GameCollectionDetailActivity::class.java.name) bundle.putString(KEY_GAME_COLLECTION_ID, id) + exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) } jumpActivity(context, bundle) } diff --git a/app/src/main/java/com/gh/common/util/DownloadObserver.kt b/app/src/main/java/com/gh/common/util/DownloadObserver.kt index 3c17681f91..593447eea0 100644 --- a/app/src/main/java/com/gh/common/util/DownloadObserver.kt +++ b/app/src/main/java/com/gh/common/util/DownloadObserver.kt @@ -384,7 +384,9 @@ object DownloadObserver { "game_name", downloadEntity.name, "game_id", downloadEntity.gameId ) - } else if (downloadEntity.gameId != "62bd412bbbf04747cd3de539") { + } else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) { + SensorsBridge.trackEvent("HaloFunDownloadDone") + } else if (downloadEntity.gameId != Constants.GHZS_GAME_ID && downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD) { SensorsBridge.trackEvent( "DownloadProcessFinish", "game_id", downloadEntity.gameId, diff --git a/app/src/main/java/com/gh/common/xapk/XapkDialogHelper.kt b/app/src/main/java/com/gh/common/xapk/XapkDialogHelper.kt index a03312c735..0b5e1f0ff5 100644 --- a/app/src/main/java/com/gh/common/xapk/XapkDialogHelper.kt +++ b/app/src/main/java/com/gh/common/xapk/XapkDialogHelper.kt @@ -1,6 +1,7 @@ package com.gh.common.xapk import android.app.Activity +import android.app.Dialog import android.content.Context import android.content.Intent import android.graphics.Color @@ -20,13 +21,26 @@ import com.gh.gamecenter.core.utils.SPUtils import com.gh.gamecenter.help.HelpAndFeedbackBridge import com.lightgame.download.DownloadEntity import com.lightgame.utils.Utils +import java.lang.ref.WeakReference object XapkDialogHelper { + private var mUnzipFailureDialogRef: WeakReference? = null + fun showUnzipFailureDialog(context: Context, downloadEntity: DownloadEntity, isManualAction: Boolean) { val trigger = if (isManualAction) "手动触发" else "自动触发" NewFlatLogUtils.logXApkUnzipFailedDialogShowed(trigger, downloadEntity.gameId, downloadEntity.name) - DialogHelper.showGuideDialog( + + val previousShowedDialog = mUnzipFailureDialogRef?.get() + + if (previousShowedDialog != null + && previousShowedDialog.isShowing + && context == previousShowedDialog.ownerActivity) { + // 上一个解压失败弹窗还在显示,当前 activity 不用再显示新的弹窗了 + return + } + + val dialog = DialogHelper.showGuideDialog( context = context, title = "", content = "未授权允许未知来源安装、数据包格式、设备兼容性…等均可能导致解压失败。\n如果开启权限后仍未能解决,请提交反馈帮助我们改进。", @@ -107,6 +121,11 @@ object XapkDialogHelper { }, extraConfig = DialogHelper.Config(showCloseIcon = true) ) + + if (context is Activity) { + dialog?.setOwnerActivity(context) + } + mUnzipFailureDialogRef = WeakReference(dialog) } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/download/PackageObserver.kt b/app/src/main/java/com/gh/download/PackageObserver.kt index 3edb1ad2b8..eebe60739f 100644 --- a/app/src/main/java/com/gh/download/PackageObserver.kt +++ b/app/src/main/java/com/gh/download/PackageObserver.kt @@ -145,7 +145,8 @@ object PackageObserver { mDownloadEntity?.let { if (it.isVGame()) return@let - if (it.isPluggable || it.isUpdate) { + if (it.isPluggable + || (it.isUpdate && !PackageUtils.isInstalled(application, it.packageName))) { PackageInstaller.install(application, mDownloadEntity) } } diff --git a/app/src/main/java/com/gh/gamecenter/BlockActivity.kt b/app/src/main/java/com/gh/gamecenter/BlockActivity.kt index 39efca0e02..d43bbf8f07 100644 --- a/app/src/main/java/com/gh/gamecenter/BlockActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/BlockActivity.kt @@ -27,7 +27,7 @@ class BlockActivity : DownloadToolbarActivity() { } override fun provideNormalIntent(): Intent { - return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java) + return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java, intent?.extras) } override fun showDownloadMenu(): Boolean { diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index a6d823eebe..7dbb1f5134 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -474,6 +474,8 @@ public class MainActivity extends BaseActivity { protected void onDestroy() { super.onDestroy(); + if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this); + handler.removeCallbacksAndMessages(null); releaseExoSourceCache(); } @@ -500,7 +502,6 @@ public class MainActivity extends BaseActivity { if (!showAd) { hideStartUp(); hideStartUpAd(); - hideSDKStartUpAd(); return; } final StartupAdEntity startUp = AdHelper.getStartUp(); @@ -612,16 +613,10 @@ public class MainActivity extends BaseActivity { startAdContainer.setVisibility(View.GONE); ExtensionsKt.removeFromParent(startAdContainer); } - checkDialog(); - } - - private void hideSDKStartUpAd() { - showAd = false; - getIntent().putExtra(SHOW_AD, false); - View startAdContainer = findViewById(R.id.sdkStartAdContainer); - if (startAdContainer != null) { - startAdContainer.setVisibility(View.GONE); - ExtensionsKt.removeFromParent(startAdContainer); + View startSdkAdContainer = findViewById(R.id.sdkStartAdContainer); + if (startSdkAdContainer != null) { + startSdkAdContainer.setVisibility(View.GONE); + ExtensionsKt.removeFromParent(startSdkAdContainer); if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this); } checkDialog(); @@ -687,7 +682,7 @@ public class MainActivity extends BaseActivity { FrameLayout adsFl = findViewById(R.id.adsFl); if (mStartUpAdProvider != null) { mStartUpAdProvider.initStartUpAd(startAdContainer, adsFl, showAd, () -> { - hideSDKStartUpAd(); + hideStartUpAd(); return null; }); } diff --git a/app/src/main/java/com/gh/gamecenter/SkipActivity.java b/app/src/main/java/com/gh/gamecenter/SkipActivity.java index 651890a7e0..d20cca34d8 100644 --- a/app/src/main/java/com/gh/gamecenter/SkipActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SkipActivity.java @@ -58,6 +58,7 @@ import com.gh.gamecenter.common.entity.CommunityEntity; import com.gh.gamecenter.common.entity.LinkEntity; import com.gh.gamecenter.common.entity.SimpleGameEntity; import com.gh.gamecenter.core.utils.GsonUtils; +import com.gh.gamecenter.core.utils.ToastUtils; import com.gh.gamecenter.entity.SubjectRecommendEntity; import com.gh.gamecenter.entity.VideoLinkEntity; import com.gh.gamecenter.feature.utils.PlatformUtils; @@ -327,11 +328,11 @@ public class SkipActivity extends BaseActivity { entity.setLink(path); entity.setName(name); entity.setText(name); - DirectUtils.directToBlock(this, entity, mEntrance); + DirectUtils.directToBlock(this, entity, mEntrance, null); break; case EntranceConsts.HOST_SERVER_BLOCK: - DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器"); + DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器", null); break; case EntranceConsts.HOST_AMWAY_BLOCK: @@ -399,7 +400,7 @@ public class SkipActivity extends BaseActivity { DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position)); break; case HOST_GAME_COLLECTION_DETAIL: - DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, ""); + DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null); break; case HOST_GAME_COLLECTION_SQUARE: DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", ""); @@ -450,6 +451,12 @@ public class SkipActivity extends BaseActivity { finish(); } }); + + if (SkipActivity.this.isFinishing()) { + ToastUtils.toast("创建桌面图标失败,请重试"); + return; + } + dialog.show(); } diff --git a/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryActivity.kt b/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryActivity.kt index ff327ad4a2..91643dabe2 100644 --- a/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryActivity.kt @@ -7,6 +7,9 @@ import com.gh.gamecenter.R import com.gh.gamecenter.common.base.activity.ToolBarActivity import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.utils.updateStatusBarColor +import com.gh.gamecenter.feature.exposure.ExposureEvent +import com.gh.gamecenter.feature.exposure.ExposureSource +import java.util.ArrayList /** * 猜你喜欢-发现页 @@ -27,9 +30,15 @@ class DiscoveryActivity : ToolBarActivity() { } companion object { - fun getIntent(context: Context, entrance: String): Intent { + fun getIntent(context: Context, entrance: String, exposureEvent: ExposureEvent? = null): Intent { val bundle = Bundle() bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance) + exposureEvent?.let { + bundle.putParcelableArrayList( + EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, + ArrayList(exposureEvent.source) + ) + } return getTargetIntent(context, DiscoveryActivity::class.java, DiscoveryFragment::class.java, bundle) } } diff --git a/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryFragment.kt b/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryFragment.kt index 35efb26bbc..1597e6b478 100644 --- a/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/discovery/DiscoveryFragment.kt @@ -151,6 +151,8 @@ class DiscoveryFragment : LazyListFragment { val basicExposureSource = arrayListOf().apply { arguments?.getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let { add(it) } + arguments?.getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) + ?.let { addAll(it) } } val outerSequence = requireArguments().getInt(EntranceConsts.KEY_POSITION, -1) diff --git a/app/src/main/java/com/gh/gamecenter/download/UpdatableGameAdapter.kt b/app/src/main/java/com/gh/gamecenter/download/UpdatableGameAdapter.kt index e0b9c35d1c..32513a24f9 100644 --- a/app/src/main/java/com/gh/gamecenter/download/UpdatableGameAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/download/UpdatableGameAdapter.kt @@ -19,6 +19,8 @@ import com.gh.download.DownloadManager import com.gh.download.dialog.DownloadDialog import com.gh.gamecenter.DownloadManagerActivity import com.gh.gamecenter.R +import com.gh.gamecenter.common.base.GlobalActivityManager +import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.BugFixedPopupWindow import com.gh.gamecenter.core.utils.CurrentActivityHolder @@ -397,6 +399,21 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) : updateBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL } } + + SensorsBridge.trackEvent( + "DownLoadbuttonClick", + "game_id", downloadEntity?.gameId ?: "", + "game_name", downloadEntity?.name ?: "", + "game_type", downloadEntity?.meta?.get(Constants.GAME_TYPE) ?: "", + "download_status", update.downloadStatusChinese, + "button_name", str, + "page_name", GlobalActivityManager.getCurrentPageEntity().pageName, + "page_id", GlobalActivityManager.getCurrentPageEntity().pageId, + "page_business_id", GlobalActivityManager.getCurrentPageEntity().pageBusinessId, + "last_page_name", GlobalActivityManager.getLastPageEntity().pageName, + "last_page_id", GlobalActivityManager.getLastPageEntity().pageId, + "last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId + ) } } diff --git a/app/src/main/java/com/gh/gamecenter/download/UpdatableGameViewModel.kt b/app/src/main/java/com/gh/gamecenter/download/UpdatableGameViewModel.kt index e17936d0e7..9faf124151 100644 --- a/app/src/main/java/com/gh/gamecenter/download/UpdatableGameViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/download/UpdatableGameViewModel.kt @@ -6,16 +6,17 @@ import androidx.lifecycle.* import com.gh.common.exposure.ExposureUtils import com.gh.common.exposure.ExposureUtils.logADownloadExposureEvent import com.gh.common.history.HistoryHelper.insertGameEntity -import com.gh.gamecenter.feature.utils.ApkActiveUtils import com.gh.common.util.DataCollectionUtils import com.gh.common.util.PackageInstaller.createDownloadId import com.gh.common.util.PackageInstaller.getDownloadPathWithId import com.gh.common.util.PackageUtils -import com.gh.gamecenter.feature.utils.PlatformUtils import com.gh.download.DownloadManager import com.gh.gamecenter.common.base.BaseSimpleDao +import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity +import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.retrofit.Response +import com.gh.gamecenter.common.utils.SensorsBridge.trackEvent import com.gh.gamecenter.common.utils.addMetaExtra import com.gh.gamecenter.common.utils.secondOrNull import com.gh.gamecenter.common.utils.toProperReadableSize @@ -23,10 +24,12 @@ import com.gh.gamecenter.common.utils.tryCatchInRelease import com.gh.gamecenter.core.utils.GsonUtils.toJson import com.gh.gamecenter.core.utils.SPUtils import com.gh.gamecenter.core.utils.UrlFilterUtils -import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.entity.GameUpdateEntity -import com.gh.gamecenter.feature.entity.PluginLocation import com.gh.gamecenter.eventbus.EBDownloadChanged +import com.gh.gamecenter.feature.entity.GameEntity +import com.gh.gamecenter.feature.entity.PluginLocation +import com.gh.gamecenter.feature.utils.ApkActiveUtils +import com.gh.gamecenter.feature.utils.PlatformUtils import com.gh.gamecenter.manager.PackagesManager import com.gh.gamecenter.retrofit.RetrofitManager import com.halo.assistant.HaloApp @@ -634,6 +637,19 @@ class UpdatableGameViewModel( // 收集下载数据 DataCollectionUtils.uploadDownload(getApplication(), downloadEntity, "开始") + + trackEvent( + "DownloadProcessBegin", + "game_id", gameEntity.id, + "game_name", gameEntity.name!!, + "game_type", gameEntity.categoryChinese, + "page_name", getCurrentPageEntity().pageName, + "page_id", getCurrentPageEntity().pageId, + "page_business_id", getCurrentPageEntity().pageBusinessId, + "last_page_name", getLastPageEntity().pageName, + "last_page_id", getLastPageEntity().pageId, + "last_page_business_id", getLastPageEntity().pageBusinessId + ) } private fun sizeStringToLong(sizeString: String): Long { diff --git a/app/src/main/java/com/gh/gamecenter/entity/GameUpdateEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/GameUpdateEntity.kt index 19e2f43c6d..6c61558698 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/GameUpdateEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/GameUpdateEntity.kt @@ -49,6 +49,15 @@ data class GameUpdateEntity( var downloadStatus: String? = "" ) { + val downloadStatusChinese: String + get() = when (downloadStatus) { + "on" -> "开启" + "smooth" -> "畅玩" + "appointment" -> "预约" + "demo" -> "试玩" + else -> "" + } + fun isShowPlugin(location: PluginLocation): Boolean { if (plugin.isNullOrEmpty() || "open" == plugin || plugin == location.name) { return true diff --git a/app/src/main/java/com/gh/gamecenter/entity/HomeSubSlide.kt b/app/src/main/java/com/gh/gamecenter/entity/HomeSubSlide.kt index bdc27008df..30e563d8d9 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/HomeSubSlide.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/HomeSubSlide.kt @@ -6,6 +6,8 @@ import com.gh.gamecenter.feature.entity.GameEntity import com.google.gson.annotations.SerializedName data class HomeSubSlide( + @SerializedName("_id") + val id: String = "", @SerializedName("link_type") val linkType: String = "", @SerializedName("link_id") diff --git a/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt b/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt index 09a0bf48d6..5461e1614c 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt @@ -136,6 +136,9 @@ class GameFragment : LazyFragment() { arguments?.getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let { add(it) } + arguments?.getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)?.let { + addAll(it) + } add( ExposureSource( "板块", diff --git a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailActivity.kt index 622aad84dd..4a461af465 100644 --- a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailActivity.kt @@ -14,7 +14,8 @@ class CommonCollectionDetailActivity : ToolBarActivity() { return getTargetIntent( this, CommonCollectionDetailActivity::class.java, - CommonCollectionDetailFragment::class.java + CommonCollectionDetailFragment::class.java, + intent?.extras ) } diff --git a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt index 9df876e6a8..156f3efd29 100644 --- a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt @@ -28,7 +28,8 @@ class CommonCollectionDetailAdapter( val mViewModel: CommonCollectionDetailViewModel, val mBlockId: String, val mBlockName: String, - val mEntrance: String + val mEntrance: String, + private val mBasicExposureSource: List? ) : ListAdapter(context), IExposable { private val mExposureEventSparseArray = SparseArray() @@ -98,13 +99,14 @@ class CommonCollectionDetailAdapter( if (linkEntity.type == "game") { mExposureEventSparseArray.put( position, - ExposureEvent.createEvent( + ExposureEvent.createEventWithSourceConcat( GameEntity( id = linkEntity.link, name = linkEntity.name ).also { it.sequence = position }, + basicSource = mBasicExposureSource ?: listOf(), listOf( ExposureSource( "内容合集", diff --git a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailFragment.kt index 4934665b25..3b5088309d 100644 --- a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailFragment.kt @@ -21,6 +21,7 @@ import com.gh.gamecenter.common.view.GridSpacingItemDecoration import com.gh.gamecenter.common.view.VerticalItemDecoration import com.gh.gamecenter.databinding.FragmentListBaseSkeletonBinding import com.gh.gamecenter.common.entity.LinkEntity +import com.gh.gamecenter.feature.exposure.ExposureSource class CommonCollectionDetailFragment : LazyListFragment() { @@ -47,13 +48,16 @@ class CommonCollectionDetailFragment : LazyListFragment { if (mAdapter == null) { + val exposureEvent = + requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) mAdapter = CommonCollectionDetailAdapter( requireContext(), mCollectionStyle, mViewModel, mBlockId, mBlockName, - mEntrance + mEntrance, + exposureEvent ) } return mAdapter!! diff --git a/app/src/main/java/com/gh/gamecenter/game/vertical/GameVerticalAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/vertical/GameVerticalAdapter.kt index 118af35c13..d4f51f0752 100644 --- a/app/src/main/java/com/gh/gamecenter/game/vertical/GameVerticalAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/vertical/GameVerticalAdapter.kt @@ -62,12 +62,13 @@ class GameVerticalAdapter( // 你可能会问为什么这下面会有一些,"加1减1" 的魔法。没错,这里的 "加1减1"就是为了规避 bug,做出的一些 UI 补偿 // bug 的表现可以 checkout https://git.shanqu.cc/android/playground/-/tree/test-snap_adapter_culprit 代码,然后滑动到最后一列体验一下 var paddingEnd = if (isEndOfRow) 16F.dip2px() else 0F.dip2px() + val height = 80F.dip2px() holder.itemView.layoutParams = if (!isEndOfRow) { paddingEnd += 1 - ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), ViewGroup.LayoutParams.WRAP_CONTENT) + ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), height) } else { - ViewGroup.LayoutParams(mMaxWidth - 1, ViewGroup.LayoutParams.WRAP_CONTENT) + ViewGroup.LayoutParams(mMaxWidth - 1, height) } val gameEntity = mSubjectEntity.data!![position + getIndex()] diff --git a/app/src/main/java/com/gh/gamecenter/geetest/GeetestUtils.java b/app/src/main/java/com/gh/gamecenter/geetest/GeetestUtils.java index 2b0c2bb822..70364a1514 100644 --- a/app/src/main/java/com/gh/gamecenter/geetest/GeetestUtils.java +++ b/app/src/main/java/com/gh/gamecenter/geetest/GeetestUtils.java @@ -1,9 +1,12 @@ package com.gh.gamecenter.geetest; +import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; +import android.os.Build; +import com.gh.gamecenter.core.AppExecutor; import com.gh.gamecenter.core.utils.AppDebugConfig; import com.gh.gamecenter.common.retrofit.JSONObjectResponse; import com.gh.gamecenter.retrofit.RetrofitManager; @@ -113,6 +116,10 @@ public class GeetestUtils { mRetryCount = 0; final GtDialog dialog = new GtDialog(context, params); + if (context instanceof Activity) { + dialog.setOwnerActivity((Activity) context); + } + // 启用debug可以在webview上看到验证过程的一些数据 dialog.setDebug(AppDebugConfig.IS_DEBUG); @@ -128,85 +135,88 @@ public class GeetestUtils { @Override public void gtCallReady(Boolean status) { - if (AppDebugConfig.IS_DEBUG) { - AppDebugConfig.logMethodWithParams(this, status, mProgressDialog.isShowing()); - } + AppExecutor.getUiExecutor().execute(() -> { + if (AppDebugConfig.IS_DEBUG) { + AppDebugConfig.logMethodWithParams(this, status, mProgressDialog.isShowing()); + } - mRetryCount = 0; - if (!mProgressDialog.isShowing()) { - //被手动取消了,也就是其实用户想取消loading了,那么即使回调也不弹出 - return; - } + mRetryCount = 0; + if (!mProgressDialog.isShowing()) { + //被手动取消了,也就是其实用户想取消loading了,那么即使回调也不弹出 + return; + } - mProgressDialog.dismiss(); + mProgressDialog.dismiss(); - if (status) { - // 验证加载完成 - RuntimeUtils.getInstance().runOnUiThread(new Runnable() { + if (status) { + // 验证加载完成 + Activity ownerActivity = dialog.getOwnerActivity(); - @Override - public void run() { - if (dialog != null) { - dialog.show(); - } + if (ownerActivity != null + && (ownerActivity.isFinishing() + || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) && ownerActivity.isDestroyed())) { + // activity 不可见 + toastMsg(context, "验证加载超时,请重新尝试"); + } else { + dialog.show(); } - }); - - } else { - // 验证加载超时,未准备完成 - toastMsg(context, "验证加载超时,请重新尝试"); - } + } else { + // 验证加载超时,未准备完成 + toastMsg(context, "验证加载超时,请重新尝试"); + } + }); } @Override public void gtCallClose() { - if (AppDebugConfig.IS_DEBUG) { - AppDebugConfig.logMethodWithParams(this); - } - if (dialog != null && dialog.isShowing()) { - dialog.dismiss(); - } -// toastMsg("close geetest windows"); + AppExecutor.getUiExecutor().execute(() -> { + if (AppDebugConfig.IS_DEBUG) { + AppDebugConfig.logMethodWithParams(this); + } + if (dialog != null && dialog.isShowing()) { + dialog.dismiss(); + } + }); } @Override public void gtError() { - if (AppDebugConfig.IS_DEBUG) { - AppDebugConfig.logMethodWithParams(this); - } - - if (mRetryCount < RETRY_MAX_COUNT) { - mRetryCount++; - checkServer(context); - } else { - if (mProgressDialog.isShowing()) { - mProgressDialog.dismiss(); + AppExecutor.getUiExecutor().execute(() -> { + if (AppDebugConfig.IS_DEBUG) { + AppDebugConfig.logMethodWithParams(this); } - } + if (mRetryCount < RETRY_MAX_COUNT) { + mRetryCount++; + checkServer(context); + } else { + if (mProgressDialog.isShowing()) { + mProgressDialog.dismiss(); + } + } + }); } @Override public void gtResult(boolean success, String result) { - if (AppDebugConfig.IS_DEBUG) { - AppDebugConfig.logMethodWithParams(this, success, result); - } - - if (success) { - if (dialog != null && dialog.isShowing()) { - dialog.dismiss(); + AppExecutor.getUiExecutor().execute(() -> { + if (AppDebugConfig.IS_DEBUG) { + AppDebugConfig.logMethodWithParams(this, success, result); } - if (mGeetestListener != null) { - mGeetestListener.onVerified(result); - } -// toastMsg("client captcha succeed:" + result); - Utils.log("client captcha succeed:" + result); - } else { - // 验证失败 -// toastMsg("client captcha failed:" + result); - Utils.log("client captcha failed:" + result); - } + if (success) { + if (dialog != null && dialog.isShowing()) { + dialog.dismiss(); + } + if (mGeetestListener != null) { + mGeetestListener.onVerified(result); + } + Utils.log("client captcha succeed:" + result); + } else { + // 验证失败 + Utils.log("client captcha failed:" + result); + } + }); } }); @@ -218,7 +228,6 @@ public class GeetestUtils { if (AppDebugConfig.IS_DEBUG) { AppDebugConfig.logMethodWithParams(this); } - } }); diff --git a/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt index 02fedbe732..5cdcd0c83b 100644 --- a/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt @@ -4,7 +4,6 @@ import android.graphics.Typeface import android.graphics.drawable.GradientDrawable import android.view.MotionEvent import android.view.View -import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.core.graphics.ColorUtils import androidx.core.view.isVisible @@ -34,7 +33,6 @@ import com.gh.gamecenter.feature.exposure.ExposureSource import com.gh.gamecenter.feature.exposure.ExposureType import com.gh.gamecenter.home.HomeItemData import com.gh.gamecenter.home.HomeViewModel -import splitties.views.dsl.core.endMargin import kotlin.math.abs class HomeSlideWithCardsViewHolder( @@ -257,11 +255,10 @@ class HomeSlideWithCardsViewHolder( source = listOf( ExposureSource( "右侧卡片", - "${homeSubSlide.cardId} - ${getCardTypeChinese(homeSubSlide.cardType)}" + "${homeSubSlide.id} - ${getCardTypeChinese(homeSubSlide.cardType)}" ) ) ) - itemData.exposureEventList?.add(exposureEvent) when (homeSubSlide.cardType) { "column", @@ -285,6 +282,14 @@ class HomeSlideWithCardsViewHolder( gameIconStackIv1.visibility = View.GONE } homeSubSlide.cardData.games.take(3).forEachIndexed { index, gameEntity -> + itemData.exposureEventList?.add( + getGameExposureEvent( + homeSubSlide, + gameEntity, + position, + basicExposureSource + ) + ) when (index) { 0 -> gameIconStackIv3.displayGameIcon(gameEntity, true) 1 -> gameIconStackIv2.displayGameIcon(gameEntity, true) @@ -314,6 +319,17 @@ class HomeSlideWithCardsViewHolder( gameIconIv3.visibility = View.GONE } homeSubSlide.cardData.games.take(3).forEachIndexed { index, gameEntity -> + val gameExposureEvent = + getGameExposureEvent(homeSubSlide, gameEntity, position, basicExposureSource) + itemData.exposureEventList?.add( + getGameExposureEvent( + homeSubSlide, + gameEntity, + position, + basicExposureSource + ) + ) + when (index) { 0 -> { gameIconIv1.displayGameIcon(gameEntity, true) @@ -327,10 +343,11 @@ class HomeSlideWithCardsViewHolder( binding.root.context, gameEntity.id, BaseActivity.mergeEntranceAndPath("新首页", "右侧卡片"), - exposureEvent + gameExposureEvent ) } } + 1 -> { gameIconIv2.displayGameIcon(gameEntity, true) gameIconIv2.setOnClickListener { @@ -343,10 +360,11 @@ class HomeSlideWithCardsViewHolder( binding.root.context, gameEntity.id, BaseActivity.mergeEntranceAndPath("新首页", "右侧卡片"), - exposureEvent + gameExposureEvent ) } } + 2 -> { gameIconIv3.displayGameIcon(gameEntity, true) gameIconIv3.setOnClickListener { @@ -359,7 +377,7 @@ class HomeSlideWithCardsViewHolder( binding.root.context, gameEntity.id, BaseActivity.mergeEntranceAndPath("新首页", "右侧卡片"), - exposureEvent + gameExposureEvent ) } } @@ -417,6 +435,8 @@ class HomeSlideWithCardsViewHolder( connect(textContainer.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP) connect(textContainer.id, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM) }.applyTo(cardContainer) + + itemData.exposureEventList?.add(exposureEvent) } } @@ -431,17 +451,42 @@ class HomeSlideWithCardsViewHolder( source = listOf( ExposureSource( "右侧卡片", - "${homeSubSlide.cardId} - ${getCardTypeChinese(homeSubSlide.cardType)}" + "${homeSubSlide.id} - ${getCardTypeChinese(homeSubSlide.cardType)}" ) ), event = ExposureType.CLICK ) ) com.gh.common.util.NewFlatLogUtils.logRightSideCardClick(homeSubSlide, viewModel.refreshCount, "卡片") - DirectUtils.directToLinkPage(cardCv.context, homeSubSlide.toLinkEntity(), "新首页", "右侧卡片", exposureEvent) + DirectUtils.directToLinkPage( + cardCv.context, + homeSubSlide.toLinkEntity(), + "新首页", + "右侧卡片", + exposureEvent + ) } } + private fun getGameExposureEvent( + homeSubSlide: HomeSubSlide, + gameEntity: GameEntity, + position: Int, + basicExposureSource: List + ) = ExposureEvent.createEventWithSourceConcat( + gameEntity = gameEntity.apply { + sequence = position + outerSequence = viewModel.refreshCount + }, + basicSource = basicExposureSource, + source = listOf( + ExposureSource( + "右侧卡片", + "${homeSubSlide.id} - ${getCardTypeChinese(homeSubSlide.cardType)}" + ) + ) + ) + private fun updateImmersiveColor(color: Int) { callback.invoke(color) val gradientDrawable = DrawableView.getGradientDrawable( diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt index da2b491f2c..d6eb87e9f9 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt @@ -269,7 +269,11 @@ class VideoDescTopViewHolder( private fun getTextViewHeight(view: TextView, lineCount: Int = 0): Int { if (view.visibility == View.GONE) return 0 val layout: Layout = view.layout ?: return 0 - val desired: Int = layout.getLineTop(if (lineCount > 0) lineCount else view.lineCount) + val desired: Int = try { + layout.getLineTop(if (lineCount > 0) lineCount else view.lineCount) + } catch (e: ArrayIndexOutOfBoundsException) { + layout.getLineTop(view.lineCount) + } val padding = view.compoundPaddingTop + view.compoundPaddingBottom return desired + padding } diff --git a/app/src/main/java/com/gh/gamecenter/servers/GameServersActivity.kt b/app/src/main/java/com/gh/gamecenter/servers/GameServersActivity.kt index 802c567c7d..d60cd3fa77 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/GameServersActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/GameServersActivity.kt @@ -88,7 +88,7 @@ class GameServersActivity : DownloadToolbarActivity() { { MtaHelper.onEvent("开服表", "Tab", if (mServersTest?.isChecked == true) "开测" else "开服") } // init viewpager mFragments.add(GameServersPublishFragment()) - mFragments.add(GameServersTestFragment()) + mFragments.add(GameServersTestFragment().with(intent.extras)) mViewpager?.setScrollable(false) mViewpager?.offscreenPageLimit = 1 mViewpager?.adapter = FragmentAdapter(supportFragmentManager, mFragments) diff --git a/app/src/main/java/com/gh/gamecenter/servers/GameServersTestFragment.kt b/app/src/main/java/com/gh/gamecenter/servers/GameServersTestFragment.kt index c0b75d6371..e4231a8619 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/GameServersTestFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/GameServersTestFragment.kt @@ -155,6 +155,8 @@ class GameServersTestFragment : LazyFragment() { val exposureSource = if (arguments?.getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE) != null) { listOf(arguments?.getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE)!!) + } else if (requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) != null) { + requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) } else { null } diff --git a/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2Activity.kt b/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2Activity.kt index 27ddd956b2..cb7032a544 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2Activity.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2Activity.kt @@ -7,6 +7,8 @@ import com.gh.gamecenter.R import com.gh.gamecenter.common.base.activity.ToolBarActivity import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.utils.updateStatusBarColor +import com.gh.gamecenter.feature.exposure.ExposureEvent +import java.util.ArrayList class GameServerTestV2Activity : ToolBarActivity() { @@ -26,9 +28,15 @@ class GameServerTestV2Activity : ToolBarActivity() { } companion object { - fun getIntent(context: Context, entrance: String): Intent { + fun getIntent(context: Context, entrance: String, exposureEvent: ExposureEvent? = null): Intent { val bundle = Bundle() bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance) + exposureEvent?.let { + bundle.putParcelableArrayList( + EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, + ArrayList(exposureEvent.source) + ) + } return getTargetIntent( context, GameServerTestV2Activity::class.java, diff --git a/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2ListFragment.kt b/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2ListFragment.kt index 23407a6ad3..8a7b33dd42 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2ListFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/gametest2/GameServerTestV2ListFragment.kt @@ -187,6 +187,8 @@ class GameServerTestV2ListFragment : val exposureSource = if (requireArguments().getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE) != null) { listOf(requireArguments().getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE)!!) + } else if (requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) != null) { + requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) } else { null } diff --git a/app/src/main/java/com/gh/vspace/VHelper.kt b/app/src/main/java/com/gh/vspace/VHelper.kt index 96fff78eb6..4882c3ecd9 100644 --- a/app/src/main/java/com/gh/vspace/VHelper.kt +++ b/app/src/main/java/com/gh/vspace/VHelper.kt @@ -1294,6 +1294,12 @@ object VHelper { // 收集下载数据 DataCollectionUtils.uploadDownload(HaloApp.getInstance(), originDownloadEntity, "开始") + + SensorsBridge.trackEvent( + "HaloFunGameDownloadClick", + "game_name", originDownloadEntity.name, + "game_id", originDownloadEntity.gameId + ) } /*** diff --git a/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt b/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt index 147f3959dc..c9653834a8 100644 --- a/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt +++ b/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt @@ -267,8 +267,6 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() { downloadBtn.setText(R.string.install) downloadBtn.buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL - SensorsBridge.trackEvent("HaloFunDownloadDone") - downloadBtn.setOnClickListener { PackageInstaller.install(requireContext(), downloadEntity) SensorsBridge.trackEvent("HaloFunInstallButtonClick") diff --git a/app/src/main/java/com/gh/vspace/db/VGameConverter.kt b/app/src/main/java/com/gh/vspace/db/VGameConverter.kt index 25c1608785..b4e9e8aacd 100644 --- a/app/src/main/java/com/gh/vspace/db/VGameConverter.kt +++ b/app/src/main/java/com/gh/vspace/db/VGameConverter.kt @@ -1,8 +1,12 @@ package com.gh.vspace.db import androidx.room.TypeConverter +import com.gh.gamecenter.common.utils.toObject +import com.gh.gamecenter.common.utils.tryWithDefaultCatch import com.gh.gamecenter.core.utils.GsonUtils import com.lightgame.download.DownloadEntity +import com.lightgame.download.DownloadStatus +import org.json.JSONObject class VGameConverter { @@ -13,7 +17,35 @@ class VGameConverter { @TypeConverter fun convertString2DownloadEntity(string: String): DownloadEntity { - return GsonUtils.fromJson(string, DownloadEntity::class.java) + val downloadEntity = DownloadEntity() + + val rawJsonObject = JSONObject(string) + + val keys = rawJsonObject.keys() + var tempSize = "" + while (keys.hasNext()) { + val key = keys.next() + val value = rawJsonObject.optString(key) + + if (value.startsWith("http")) { + downloadEntity.url = value + } else if (value.endsWith("apk")) { + downloadEntity.path = value + } else if (value.startsWith("{\"")) { + downloadEntity.meta = value.toObject() + downloadEntity.name = downloadEntity.meta["game_name"] + } else if (value == tempSize) { + tryWithDefaultCatch { + downloadEntity.size = value.toLong() + } + } else { + tempSize = value + } + } + + downloadEntity.status = DownloadStatus.done + + return downloadEntity } } \ No newline at end of file diff --git a/feature/beizi_lib/beizi_ad_sdk_3.4.20.23.aar b/feature/beizi_lib/beizi_ad_sdk_3.4.20.23.aar deleted file mode 100644 index 2758de70cd..0000000000 Binary files a/feature/beizi_lib/beizi_ad_sdk_3.4.20.23.aar and /dev/null differ diff --git a/feature/beizi_lib/beizi_fusion_sdk_4.90.2.27.aar b/feature/beizi_lib/beizi_fusion_sdk_4.90.2.27.aar deleted file mode 100644 index 22f73f36d1..0000000000 Binary files a/feature/beizi_lib/beizi_fusion_sdk_4.90.2.27.aar and /dev/null differ diff --git a/feature/beizi_lib/build.gradle b/feature/beizi_lib/build.gradle deleted file mode 100644 index f499ed8752..0000000000 --- a/feature/beizi_lib/build.gradle +++ /dev/null @@ -1,4 +0,0 @@ -configurations.maybeCreate("default") -artifacts.add("default", file('beizi_ad_sdk_3.4.20.23.aar')) -artifacts.add("default", file('beizi_fusion_sdk_4.90.2.27.aar')) -artifacts.add("default", file('oaid_sdk_1.0.25.aar')) \ No newline at end of file diff --git a/feature/beizi_startup_ad/build.gradle b/feature/beizi_startup_ad/build.gradle index 13a44059ff..a2f2db3d43 100644 --- a/feature/beizi_startup_ad/build.gradle +++ b/feature/beizi_startup_ad/build.gradle @@ -66,7 +66,7 @@ android { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + consumerProguardFiles 'proguard-rules.pro' if (!isRelease.toBoolean()) { buildConfigField "String", "DEV_API_HOST", "\"${API_HOST}\"" @@ -86,5 +86,7 @@ dependencies { implementation(project(path: ":module_common")) { exclude group: 'androidx.swiperefreshlayout' } - api project(":feature:beizi_lib") + api project(':feature:oaid_lib') + implementation 'com.beizi:beizi_ad_sdk:3.4.20.23' + implementation 'com.beizi:beizi_fusion_sdk:4.90.2.27' } \ No newline at end of file diff --git a/feature/beizi_startup_ad/proguard-rules.pro b/feature/beizi_startup_ad/proguard-rules.pro index 96e40e34a3..f1d4e54046 100644 --- a/feature/beizi_startup_ad/proguard-rules.pro +++ b/feature/beizi_startup_ad/proguard-rules.pro @@ -30,7 +30,9 @@ -keep class XI.CA.XI.**{*;} -keep class XI.K0.XI.**{*;} -keep class XI.XI.K0.**{*;} +-keep class XI.XI.XI.**{*;} -keep class XI.xo.XI.XI.**{*;} +-keep class XI.kM.XI.XI.XI.**{*;} -keep class com.asus.msa.SupplementaryDID.**{*;} -keep class com.asus.msa.sdid.**{*;} -keep class com.bun.lib.**{*;} diff --git a/feature/beizi_startup_ad/src/main/java/com/gh/gamecenter/beiziad/BeiziAdHelper.kt b/feature/beizi_startup_ad/src/main/java/com/gh/gamecenter/beiziad/BeiziAdHelper.kt index 01af114f8b..4354ef0434 100644 --- a/feature/beizi_startup_ad/src/main/java/com/gh/gamecenter/beiziad/BeiziAdHelper.kt +++ b/feature/beizi_startup_ad/src/main/java/com/gh/gamecenter/beiziad/BeiziAdHelper.kt @@ -1,5 +1,6 @@ package com.gh.gamecenter.beiziad +import android.annotation.SuppressLint import android.content.Context import android.view.View import android.widget.FrameLayout @@ -9,11 +10,9 @@ import com.beizi.fusion.BeiZis import com.beizi.fusion.SplashAd import com.bun.miitmdid.core.MdidSdkHelper import com.gh.gamecenter.common.constant.Constants -import com.gh.gamecenter.common.exposure.meta.MetaUtil import com.gh.gamecenter.core.utils.DisplayUtils import com.gh.gamecenter.core.utils.SPUtils import com.lightgame.utils.Utils -import java.lang.ref.WeakReference object BeiziAdHelper { @@ -21,8 +20,10 @@ object BeiziAdHelper { private const val BEIZI_START_UP_AD_ID = "105706" private const val START_UP_AD_TOTAL_TIME = 3000L - private val mChannelList = listOf("GH_206") - private var mSplashAd: WeakReference? = null + private val mChannelList = listOf("GH_206", "GH_TEST3", "GH_LOST") + @SuppressLint("StaticFieldLeak") + // 显示完广告后即置空 mSplashAd 实例 + private var mSplashAd: SplashAd? = null fun initBeiziSDK(context: Context) { BeiZis.setSupportPersonalized(SPUtils.getBoolean(Constants.SP_PERSONAL_RECOMMEND, true)) @@ -41,10 +42,13 @@ object BeiziAdHelper { fun initBeiziStartUpAd(startAdContainer: View, adsFl: FrameLayout, showAd: Boolean, hideCallback: () -> Unit) { startAdContainer.visibility = View.VISIBLE - mSplashAd = WeakReference(SplashAd(startAdContainer.context, null, BEIZI_START_UP_AD_ID, object : AdListener { + mSplashAd = SplashAd(startAdContainer.context, null, BEIZI_START_UP_AD_ID, object : AdListener { override fun onAdLoaded() { - if (showAd) { - mSplashAd?.get()?.show(adsFl) + if (!showAd || mSplashAd == null) { + hideCallback() + mSplashAd = null + } else { + mSplashAd?.show(adsFl) } } @@ -54,10 +58,12 @@ object BeiziAdHelper { override fun onAdFailedToLoad(i: Int) { hideCallback() + mSplashAd = null } override fun onAdClosed() { hideCallback() + mSplashAd = null } override fun onAdTick(l: Long) { @@ -67,12 +73,12 @@ object BeiziAdHelper { override fun onAdClicked() { // do nothing } - }, START_UP_AD_TOTAL_TIME)) - mSplashAd?.get()?.loadAd(DisplayUtils.getScreenWidth(), DisplayUtils.getScreenHeight()) + }, START_UP_AD_TOTAL_TIME) + mSplashAd?.loadAd(DisplayUtils.getScreenWidth(), DisplayUtils.getScreenHeight()) } fun cancelBeiziStartUpAd(context: Context) { - mSplashAd?.get()?.cancel(context) + mSplashAd?.cancel(context) } fun shouldEnableSDK(channel: String) = mChannelList.contains(channel) diff --git a/feature/beizi_startup_ad/src/main/res/values/values.xml b/feature/beizi_startup_ad/src/main/res/values/values.xml deleted file mode 100644 index 544bee9e14..0000000000 --- a/feature/beizi_startup_ad/src/main/res/values/values.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/feature/beizi_lib/.gitignore b/feature/oaid_lib/.gitignore similarity index 100% rename from feature/beizi_lib/.gitignore rename to feature/oaid_lib/.gitignore diff --git a/feature/oaid_lib/build.gradle b/feature/oaid_lib/build.gradle new file mode 100644 index 0000000000..1766c2bd36 --- /dev/null +++ b/feature/oaid_lib/build.gradle @@ -0,0 +1,2 @@ +configurations.maybeCreate("default") +artifacts.add("default", file('oaid_sdk_1.0.25.aar')) \ No newline at end of file diff --git a/feature/beizi_lib/oaid_sdk_1.0.25.aar b/feature/oaid_lib/oaid_sdk_1.0.25.aar similarity index 100% rename from feature/beizi_lib/oaid_sdk_1.0.25.aar rename to feature/oaid_lib/oaid_sdk_1.0.25.aar diff --git a/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java b/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java index 41729fe928..f2c1e3b902 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java +++ b/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java @@ -70,6 +70,8 @@ public class Constants { public static final String GHZS_GAME_ID = "5ae4462c2924bc7936438d07"; + public static final String HALO_FUN_GAME_ID = "62bd412bbbf04747cd3de539"; // 畅玩助手ID + public static final String EXTRA_DOWNLOAD_TYPE = "extra_download_type"; public static final String SILENT_UPDATE = "静默更新"; public static final String SIMULATOR_DOWNLOAD = "下载模拟器"; diff --git a/settings.gradle b/settings.gradle index aa9cbde806..389a833022 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,4 +17,4 @@ include ':feature:vpn' include ':feature:pkg' include ':feature:floating-window' include ':feature:beizi_startup_ad' -include ':feature:beizi_lib' +include ':feature:oaid_lib'