Compare commits
43 Commits
feat/GHZSC
...
fix/system
| Author | SHA1 | Date | |
|---|---|---|---|
| f75396d7ae | |||
| 72c3df7fa6 | |||
| 2d4920cfb0 | |||
| 2d30b97cca | |||
| 40346e3c9a | |||
| 7f601c856a | |||
| 6e56f2e3a0 | |||
| e2fbda1e4c | |||
| 1e88ba8539 | |||
| 0f43b5610d | |||
| 04dcfbab2e | |||
| 8dd33cb599 | |||
| af5826962b | |||
| 9883f8d5c0 | |||
| 848207784e | |||
| fc294f9e7b | |||
| 96cd53a2c9 | |||
| 5458c93475 | |||
| 675d63c1d6 | |||
| 1040f5ff4d | |||
| 97be320529 | |||
| 0e086c9452 | |||
| dc677d1b9f | |||
| fa50c6e417 | |||
| dc96f2274f | |||
| ad5f5048a6 | |||
| e5491fb297 | |||
| ff96eaafee | |||
| 59cde4e2bf | |||
| cc0c7c7fae | |||
| 9e9ce6a84f | |||
| 7d0b500ff9 | |||
| 425456b263 | |||
| f6abab9a2d | |||
| d194f969e4 | |||
| 95f66344fb | |||
| 570e2fa9bc | |||
| 9e07080043 | |||
| e10a329159 | |||
| b3bc7b43f7 | |||
| 811d42457c | |||
| ac0b819ea9 | |||
| d931fb5940 |
@ -72,7 +72,6 @@ android_build:
|
||||
only:
|
||||
- dev
|
||||
- release
|
||||
- feat/GHZSCY-6783
|
||||
|
||||
# 代码检查
|
||||
sonarqube_analysis:
|
||||
@ -158,4 +157,3 @@ oss-upload&send-email:
|
||||
only:
|
||||
- dev
|
||||
- release
|
||||
- feat/GHZSCY-6783
|
||||
|
||||
@ -101,8 +101,6 @@ android {
|
||||
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
|
||||
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT}\""
|
||||
buildConfigField "String", "VAPI_HOST", "\"${VAPI_HOST}\""
|
||||
buildConfigField "String", "WGAME_CPM_BUSIAPPID", "\"${WGAME_CPM_BUSIAPPID}\""
|
||||
buildConfigField "String", "WGAME_CPM_API_HOST", "\"${WGAME_CPM_API_HOST}\""
|
||||
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
|
||||
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
|
||||
buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
|
||||
|
||||
@ -374,7 +374,7 @@ object DefaultUrlHandler {
|
||||
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
|
||||
val gameEntity =
|
||||
if (forumType == BbsType.OFFICIAL_BBS.value && gameId.isNotEmpty() && gameName.isNotEmpty() && icon.isNotEmpty()) {
|
||||
GameEntity(_id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
|
||||
GameEntity(id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
|
||||
} else null
|
||||
val activityLabelEntity = if (activityId.isNotEmpty() && activityName.isNotEmpty()) {
|
||||
ActivityLabelEntity(
|
||||
|
||||
@ -63,9 +63,6 @@ public class Config {
|
||||
public static final String NEW_API_HOST = EnvHelper.getNewHost();
|
||||
public static final String VAPI_HOST = EnvHelper.getVHost();
|
||||
|
||||
public static final String WGAME_CPM_BUSIAPPID = BuildConfig.WGAME_CPM_BUSIAPPID;
|
||||
public static final String WGAME_CPM_API_HOST = EnvHelper.getWGameCPMHost();
|
||||
|
||||
// Third-Party confs
|
||||
public static final String WECHAT_APPID = BuildConfig.WECHAT_APPID;
|
||||
public static final String WECHAT_SECRET = BuildConfig.WECHAT_SECRET;
|
||||
|
||||
@ -6,7 +6,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import io.reactivex.functions.Consumer
|
||||
|
||||
@ -17,9 +16,8 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
||||
|
||||
val throttleBus: ExposureThrottleBus by lazy {
|
||||
ExposureThrottleBus(
|
||||
{ commitExposure(it) },
|
||||
Consumer(Throwable::printStackTrace),
|
||||
{ commitWXCPMExposure(it) }
|
||||
Consumer { commitExposure(it) },
|
||||
Consumer(Throwable::printStackTrace)
|
||||
)
|
||||
}
|
||||
var layoutManager: LayoutManager? = null
|
||||
@ -95,32 +93,4 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
||||
ExposureManager.log(eventList)
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小游戏CPM曝光事件接口上报,由于普通曝光事件的上报通道存在节流特性,不符合CPM接口对于数据上报的实时性和准确性的要求,所以使用额外的通道进行上报
|
||||
*/
|
||||
private fun commitWXCPMExposure(visibleState: ExposureThrottleBus.VisibleState) {
|
||||
|
||||
val eventList = arrayListOf<ExposureEvent>()
|
||||
|
||||
for (pos in visibleState.firstVisiblePosition..visibleState.lastVisiblePosition) {
|
||||
try {
|
||||
exposable.getEventByPosition(pos)?.let {
|
||||
if (it.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
|
||||
eventList.add(it)
|
||||
}
|
||||
}
|
||||
exposable.getEventListByPosition(pos)?.let { list ->
|
||||
list.forEach {
|
||||
if (it.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
|
||||
eventList.add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ignore: Exception) {
|
||||
// Just ignore the error.
|
||||
}
|
||||
}
|
||||
ExposureManager.logCPM(eventList)
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,11 @@
|
||||
package com.gh.common.exposure
|
||||
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.loghub.TLogHubHelper
|
||||
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
|
||||
import com.gh.gamecenter.common.utils.toJson
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.minigame.wechat.WGameSubjectCPMListReportHelper
|
||||
import com.lightgame.utils.Utils
|
||||
import com.volcengine.model.tls.LogItem
|
||||
|
||||
@ -34,9 +32,6 @@ object ExposureManager {
|
||||
*/
|
||||
fun log(event: ExposureEvent) {
|
||||
AppExecutor.logExecutor.execute {
|
||||
if (event.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
|
||||
WGameSubjectCPMListReportHelper.reportExposure(event)
|
||||
}
|
||||
if (!exposureCache.contains(event.id)) {
|
||||
exposureSet.add(event)
|
||||
exposureCache.add(event.id)
|
||||
@ -63,17 +58,6 @@ object ExposureManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a wechat mini game cpm collection of exposure event.
|
||||
*/
|
||||
fun logCPM(eventList: List<ExposureEvent>) {
|
||||
AppExecutor.logExecutor.execute {
|
||||
if (eventList.isNotEmpty()) {
|
||||
WGameSubjectCPMListReportHelper.reportExposure(eventList.toSet())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param forcedUpload Ignore all restrictions.
|
||||
*/
|
||||
|
||||
@ -3,20 +3,16 @@ package com.gh.common.exposure
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.functions.Consumer
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class ExposureThrottleBus(
|
||||
var onSuccess: Consumer<VisibleState>,
|
||||
var onError: Consumer<Throwable>,
|
||||
onPreSuccess: Consumer<VisibleState>
|
||||
) {
|
||||
class ExposureThrottleBus(var onSuccess: Consumer<VisibleState>, var onError: Consumer<Throwable>) {
|
||||
|
||||
companion object {
|
||||
private const val THRESHOLD_TIME = 300L
|
||||
}
|
||||
|
||||
private val mPublishSubject: BehaviorSubject<VisibleState> = BehaviorSubject.create()
|
||||
private val mPublishSubject: PublishSubject<VisibleState> = PublishSubject.create()
|
||||
private val mCompositeDisposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
init {
|
||||
@ -28,7 +24,6 @@ class ExposureThrottleBus(
|
||||
*/
|
||||
val disposable = mPublishSubject
|
||||
.distinctUntilChanged()
|
||||
.doOnNext(onPreSuccess)
|
||||
.throttleWithTimeout(THRESHOLD_TIME, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(onSuccess, onError)
|
||||
|
||||
@ -33,9 +33,5 @@ class BuildConfigImpl : IBuildConfigProvider {
|
||||
|
||||
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
|
||||
|
||||
override fun getWGameCPMApiHost(): String = BuildConfig.WGAME_CPM_API_HOST
|
||||
|
||||
override fun getWGameCPMBusiAppId(): String = BuildConfig.WGAME_CPM_BUSIAPPID
|
||||
|
||||
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
|
||||
}
|
||||
@ -62,13 +62,7 @@ class DirectProviderImpl : IDirectProvider {
|
||||
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path, sourceEntrance)
|
||||
}
|
||||
|
||||
override fun directToVideoDetail(
|
||||
context: Context,
|
||||
videoId: String,
|
||||
entrance: String?,
|
||||
path: String?,
|
||||
sourceEntrance: String
|
||||
) {
|
||||
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?, sourceEntrance: String) {
|
||||
DirectUtils.directToVideoDetail(context, videoId, entrance, path, sourceEntrance)
|
||||
}
|
||||
|
||||
@ -84,13 +78,8 @@ class DirectProviderImpl : IDirectProvider {
|
||||
DirectUtils.directToQQGameById(activity, qqAppId)
|
||||
}
|
||||
|
||||
override fun directToWechatGameById(
|
||||
activity: Activity,
|
||||
wechatAppId: String,
|
||||
wechatAppPath: String,
|
||||
wechatAppExtData: String
|
||||
) {
|
||||
DirectUtils.directToWechatGameById(activity, wechatAppId, wechatAppPath, wechatAppExtData)
|
||||
override fun directToWechatGameById(activity: Activity, qqAppId: String) {
|
||||
DirectUtils.directToWechatGameById(activity, qqAppId)
|
||||
}
|
||||
|
||||
override fun directToExternalBrowser(context: Context, url: String) {
|
||||
|
||||
@ -485,13 +485,11 @@ object DirectUtils {
|
||||
ColumnCollectionDetailFragment.TYPE_QQ_MINI_GAME_COLUMN -> directToQGameHome(context)
|
||||
|
||||
// QQ游戏专题详情页
|
||||
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN,
|
||||
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_COLUMN,
|
||||
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN -> {
|
||||
val subjectType = when (linkEntity.type) {
|
||||
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN -> SubjectData.SubjectType.QQ_GAME
|
||||
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN -> SubjectData.SubjectType.WECHAT_GAME_CPM
|
||||
else -> SubjectData.SubjectType.WECHAT_GAME
|
||||
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN, ViewPagerFragmentHelper.TYPE_WECHAT_GAME_COLUMN -> {
|
||||
val subjectType = if (linkEntity.type == ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN) {
|
||||
SubjectData.SubjectType.QQ_GAME
|
||||
} else {
|
||||
SubjectData.SubjectType.WECHAT_GAME
|
||||
}
|
||||
directToSubject(
|
||||
context = context,
|
||||
@ -2011,8 +2009,6 @@ object DirectUtils {
|
||||
fun directToWechatGameById(
|
||||
activity: Activity,
|
||||
wechatAppId: String,
|
||||
wechatAppPath: String = "",
|
||||
wechatAppExtData: String = ""
|
||||
) {
|
||||
|
||||
val wxApiProxy = WXAPIFactory.createWXAPI(
|
||||
@ -2027,9 +2023,8 @@ object DirectUtils {
|
||||
wxApiProxy.sendReq(
|
||||
WXLaunchMiniProgram.Req().apply {
|
||||
userName = wechatAppId
|
||||
path = wechatAppPath.ifEmpty { Constants.WECHAT_MINI_GAME_PCS }
|
||||
extData = wechatAppExtData
|
||||
miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE
|
||||
path = Constants.WECHAT_MINI_GAME_PCS
|
||||
miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -880,7 +880,7 @@ object DownloadItemUtils {
|
||||
}
|
||||
if (gameEntity.isMiniGame()) {
|
||||
downloadBtn.setOnClickListener {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
clickCallback?.onCallback()
|
||||
allStateClickCallback?.onCallback()
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ object DownloadObserver {
|
||||
java.lang.Boolean.parseBoolean(downloadEntity.getMetaExtra(Constants.IS_PLATFORM_RECOMMEND))
|
||||
val exposureEvent = ExposureUtils.logADownloadCompleteExposureEvent(
|
||||
GameEntity(
|
||||
_id = downloadEntity.gameId,
|
||||
id = downloadEntity.gameId,
|
||||
mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR),
|
||||
gameVersion = downloadEntity.versionName ?: "",
|
||||
isPlatformRecommend = isPlatformRecommend,
|
||||
|
||||
@ -65,7 +65,7 @@ public class InstallUtils {
|
||||
if (!TextUtils.isEmpty(installVersion) && downloadEntity != null &&
|
||||
installVersion.equals(downloadEntity.getVersionName())) {
|
||||
if (!downloadEntity.isPluggable() || PackageUtils.isSignedByGh(context, packageName)) {
|
||||
EventBus.getDefault().post(new EBPackage(EBPackage.TYPE_INSTALLED, packageName, installVersion));
|
||||
EventBus.getDefault().post(new EBPackage(EBPackage.TYPE_INSTALLED, packageName, installVersion, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class InstallUtils {
|
||||
keys.add(packageName);
|
||||
} else if (!list.contains(packageName)) {
|
||||
keys.add(packageName);
|
||||
EventBus.getDefault().post(new EBPackage("卸载", packageName, ""));
|
||||
EventBus.getDefault().post(new EBPackage("卸载", packageName, "", false));
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
|
||||
@ -124,11 +124,12 @@ object UsageStatsHelper {
|
||||
&& curEvent.className == nextEvent.className
|
||||
) {
|
||||
val diff = nextEvent.timeStamp - curEvent.timeStamp
|
||||
val packageName = curEvent.packageName ?: continue
|
||||
|
||||
if (pakAndTime[curEvent.packageName] == null) {
|
||||
pakAndTime[curEvent.packageName] = diff
|
||||
if (pakAndTime[packageName] == null) {
|
||||
pakAndTime[packageName] = diff
|
||||
} else {
|
||||
pakAndTime[curEvent.packageName] = pakAndTime[curEvent.packageName]!! + diff
|
||||
pakAndTime[packageName] = pakAndTime[packageName]!! + diff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,6 @@ object ViewPagerFragmentHelper {
|
||||
const val TYPE_COLUMN = "column" // 游戏专题详情页
|
||||
const val TYPE_QQ_MINI_GAME_COLUMN = "qq_mini_game_column_detail" // QQ小游戏专题详情页
|
||||
const val TYPE_WECHAT_GAME_COLUMN = "wechat_game_column_detail" // 微信小游戏专题详情页
|
||||
const val TYPE_WECHAT_GAME_CPM_COLUMN = "wechat_game_cpm_column_detail" // 微信小游戏CPM专题详情页
|
||||
const val TYPE_COLUMN_COLLECTION = "column_collection" // 专题合集详情页
|
||||
const val TYPE_SERVER = "server" // 开服表
|
||||
const val TYPE_COLUMN_TEST = "column_test_v2" // 新游开测
|
||||
@ -164,11 +163,10 @@ object ViewPagerFragmentHelper {
|
||||
className = GameCollectionSquareFragment::class.java.name
|
||||
}
|
||||
// 游戏专题详情页/QQ游戏专题详情页
|
||||
TYPE_COLUMN, TYPE_QQ_MINI_GAME_COLUMN, TYPE_WECHAT_GAME_COLUMN, TYPE_WECHAT_GAME_CPM_COLUMN -> {
|
||||
TYPE_COLUMN, TYPE_QQ_MINI_GAME_COLUMN, TYPE_WECHAT_GAME_COLUMN -> {
|
||||
val subjectType = when(entity.type) {
|
||||
TYPE_QQ_MINI_GAME_COLUMN -> SubjectData.SubjectType.QQ_GAME
|
||||
TYPE_WECHAT_GAME_COLUMN -> SubjectData.SubjectType.WECHAT_GAME
|
||||
TYPE_WECHAT_GAME_CPM_COLUMN -> SubjectData.SubjectType.WECHAT_GAME_CPM
|
||||
else -> SubjectData.SubjectType.NORMAL
|
||||
}
|
||||
className = SubjectFragment::class.java.name
|
||||
|
||||
@ -238,7 +238,7 @@ open class SearchActivity : BaseActivity() {
|
||||
GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
key ?: "",
|
||||
TRACK_SEARCH_TYPE_DEFAULT,
|
||||
TRACK_SEARCH_TYPE_RANK,
|
||||
mSourceEntrance
|
||||
)
|
||||
}
|
||||
@ -433,12 +433,14 @@ open class SearchActivity : BaseActivity() {
|
||||
const val TRACK_SEARCH_TYPE_INPUT = "输入搜索"
|
||||
const val TRACK_SEARCH_TYPE_DEFAULT = "默认搜索"
|
||||
const val TRACK_SEARCH_TYPE_HISTORY = "历史搜索"
|
||||
const val TRACK_SEARCH_TYPE_RANK = "榜单搜索"
|
||||
|
||||
@JvmStatic
|
||||
fun toTrackSearchType(type: String) = when (type) {
|
||||
SearchType.AUTO.value -> TRACK_SEARCH_TYPE_AUTO
|
||||
SearchType.MANUAL.value -> TRACK_SEARCH_TYPE_INPUT
|
||||
SearchType.HISTORY.value -> TRACK_SEARCH_TYPE_HISTORY
|
||||
SearchType.RANK.value -> TRACK_SEARCH_TYPE_RANK
|
||||
else -> TRACK_SEARCH_TYPE_DEFAULT
|
||||
}
|
||||
|
||||
|
||||
@ -408,7 +408,7 @@ public class SkipActivity extends BaseActivity {
|
||||
try {
|
||||
JSONObject extJsonObject = new JSONObject(extJson);
|
||||
String qqGameId = extJsonObject.optString("aid");
|
||||
MiniGameItemHelper.INSTANCE.launchMiniGame(qqGameId, Constants.QQ_MINI_GAME, "", "");
|
||||
MiniGameItemHelper.INSTANCE.launchMiniGame(qqGameId, Constants.QQ_MINI_GAME);
|
||||
} catch (JSONException ignored) {
|
||||
}
|
||||
break;
|
||||
|
||||
@ -32,7 +32,7 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
|
||||
mViewModel.playedGames.observeNonNull(viewLifecycleOwner) {
|
||||
defaultViewModel?.isExistHotSearch = it.isNotEmpty()
|
||||
updateView()
|
||||
mBinding.searchDiscoveryList.run {
|
||||
mBinding.hotList.run {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
adapter = AmwaySearchAdapter(context, mViewModel, "安利墙搜索-最近玩过").apply { setData(it) }
|
||||
}
|
||||
@ -43,7 +43,7 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
|
||||
|
||||
override fun initView() {
|
||||
mBinding = mAmwayBinding.searchContent
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.text = "最近玩过"
|
||||
mBinding.hotHeadContainer.headTitle.text = "最近玩过"
|
||||
mBinding.historyFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
|
||||
updateHistorySearchView(null)
|
||||
|
||||
@ -309,7 +309,8 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
// 忽略首次初始化触发的事件
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class AdGameBannerAdapter(
|
||||
it.name ?: ""
|
||||
)
|
||||
if (it.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(it)
|
||||
MiniGameItemHelper.launchMiniGame(it.miniGameAppId, it.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
mContext,
|
||||
|
||||
@ -161,6 +161,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
val showOnFailed = downloadManagerAd?.displayRule?.onFailedAction == "show"
|
||||
if ((showThirdPartyAd && thirdPartyAd != null) || (!showThirdPartyAd && thirdPartyAd != null && ownerAd == null)) {
|
||||
initThirdPartyAd(downloadManagerAd, thirdPartyAd) { isSuccess ->
|
||||
if (!isAdded) return@initThirdPartyAd
|
||||
mBinding.maskView.goneIf(!isSuccess)
|
||||
if (!isSuccess && ownerAd != null && showOnFailed) {
|
||||
mSlideInterval = ownerAd.adSource?.sliderInterval ?: -1
|
||||
@ -215,7 +216,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
}
|
||||
|
||||
private fun initOwnerAd(adConfig: AdConfig) {
|
||||
if (adConfig.id.isEmpty()) return
|
||||
if (!isAdded || adConfig.id.isEmpty()) return
|
||||
mAdGameViewModel = viewModelProvider(AdGameViewModel.Factory(adConfig))
|
||||
initAdGameBanner(adConfig)
|
||||
mBinding.closeAdIv.setOnClickListener {
|
||||
@ -249,6 +250,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
adConfig.displayRule.onFailedAction == "show" && adConfig.thirdPartyAd != null) {
|
||||
// 自有广告游戏为空时,显示第三方广告
|
||||
initThirdPartyAd(adConfig, adConfig.thirdPartyAd) { isSuccess ->
|
||||
if (!isAdded) return@initThirdPartyAd
|
||||
mBinding.maskView.goneIf(!isSuccess)
|
||||
if (isSuccess) {
|
||||
SPUtils.setLong(Constants.SP_LAST_DOWNLOAD_MANAGER_AD_SHOW_TIME, System.currentTimeMillis())
|
||||
|
||||
@ -220,7 +220,7 @@ class NewInstalledGameFragment : ToolbarFragment() {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(packageEb: EBPackage) {
|
||||
if (packageEb.isInstalledOrUninstalled()) {
|
||||
if (!packageEb.fromInit && packageEb.isInstalledOrUninstalled()) {
|
||||
mInstallGameViewModel.initData(
|
||||
PackagesManager.filterSameApk(
|
||||
PackagesManager.filterDownloadBlackPackage(mPackageViewModel?.getGameInstalledLiveData()?.value as MutableList<GameInstall>?)
|
||||
|
||||
@ -9,16 +9,14 @@ import kotlinx.parcelize.Parcelize
|
||||
@Parcelize
|
||||
data class SearchSubjectEntity(
|
||||
val name: String = "",
|
||||
var games: List<GameEntity> = listOf(),
|
||||
val games: List<GameEntity> = listOf(),
|
||||
val location: Int = 0,
|
||||
@SerializedName("column_id")
|
||||
val columnId: String = "",
|
||||
val adId: String = "", // 广告ID(本地字段),不为空时为广告专题
|
||||
val codeId: String = "", // 广告CODE_ID(本地字段),不为空时为广告专题
|
||||
@SerializedName("ad_icon_active")
|
||||
val adIconActive: Boolean = false,
|
||||
// 本地字段,标记是否为微信小游戏CPM专题
|
||||
var isWGameSubjectCPM: Boolean = false
|
||||
val adIconActive: Boolean = false
|
||||
) : Parcelable {
|
||||
fun getFilterGame() = RegionSettingHelper.filterGame(games)
|
||||
}
|
||||
@ -63,11 +63,6 @@ class SubjectData(
|
||||
/**
|
||||
* 微信小游戏专题
|
||||
*/
|
||||
WECHAT_GAME,
|
||||
|
||||
/**
|
||||
* 微信小游戏CPM专题
|
||||
*/
|
||||
WECHAT_GAME_CPM,
|
||||
WECHAT_GAME
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,8 +104,6 @@ data class SubjectEntity(
|
||||
@SerializedName("is_wechat_column")
|
||||
var isWechatColumn: Boolean = false,
|
||||
|
||||
var isWechatColumnCPM: Boolean = false,
|
||||
|
||||
var explain: String = "", // 游戏单合集说明
|
||||
|
||||
@SerializedName("show_star")
|
||||
@ -132,7 +130,6 @@ data class SubjectEntity(
|
||||
|
||||
val subjectType: SubjectData.SubjectType get() = when {
|
||||
isQQColumn -> SubjectData.SubjectType.QQ_GAME
|
||||
isWechatColumnCPM -> SubjectData.SubjectType.WECHAT_GAME_CPM
|
||||
isWechatColumn -> SubjectData.SubjectType.WECHAT_GAME
|
||||
else -> SubjectData.SubjectType.NORMAL
|
||||
}
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
package com.gh.gamecenter.eventbus
|
||||
|
||||
class EBPackage(var type: String, var packageName: String, var versionName: String?) {
|
||||
/**
|
||||
* @param fromInit 实体生成是否来自于初始化
|
||||
*/
|
||||
class EBPackage(var type: String,
|
||||
var packageName: String,
|
||||
var versionName: String?,
|
||||
val fromInit: Boolean = false) {
|
||||
var gameId: String? = null
|
||||
var isVGame: Boolean = false // 是否是畅玩游戏
|
||||
|
||||
|
||||
@ -39,14 +39,14 @@ class ForumOrUserSearchDefaultFragment : SearchDefaultFragment() {
|
||||
|
||||
override fun initView() {
|
||||
mBinding = FragmentSearchDefaultBinding.bind(mCachedView)
|
||||
mBinding.searchDiscoveryTagHeadContainer.root.visibility = View.GONE
|
||||
mBinding.searchDiscoveryTagFlexContainer.visibility = View.GONE
|
||||
mBinding.hotTagHeadContainer.root.visibility = View.GONE
|
||||
mBinding.hotTagFlexContainer.visibility = View.GONE
|
||||
if (mEntrance == "论坛首页" || mEntrance == "搜索栏") {
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.text = "热门论坛"
|
||||
mBinding.hotHeadContainer.headTitle.text = "热门论坛"
|
||||
mViewModel.getForumSearchHotContent()
|
||||
} else {
|
||||
mBinding.searchDiscoveryHeadContainer.root.visibility = View.GONE
|
||||
mBinding.searchDiscoveryList.visibility = View.GONE
|
||||
mBinding.hotHeadContainer.root.visibility = View.GONE
|
||||
mBinding.hotList.visibility = View.GONE
|
||||
}
|
||||
val params = mBinding.historyHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams
|
||||
params.topMargin = 0.5f.dip2px()
|
||||
|
||||
@ -611,7 +611,7 @@ class GameFragmentAdapter(
|
||||
val subjectData = gameEntity.subjectData
|
||||
DataCollectionUtils.uploadClick(mContext, subjectData?.name + "-列表", "游戏-专题", gameEntity.name)
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
mContext, gameEntity,
|
||||
@ -1322,7 +1322,7 @@ class GameFragmentAdapter(
|
||||
DataCollectionUtils.uploadClick(mContext, subjectData.name + "-列表", "游戏-专题", gameEntity.name)
|
||||
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
} else if (gameEntity.isPluggable) {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
mContext,
|
||||
|
||||
@ -67,6 +67,8 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
|
||||
}
|
||||
|
||||
private fun showSubjectTab(linkEntityList: MutableList<LinkEntity>) {
|
||||
if (!isVisible) return
|
||||
|
||||
val subjectDataList = arrayListOf<SubjectData>()
|
||||
|
||||
for (link in linkEntityList) {
|
||||
|
||||
@ -135,7 +135,7 @@ class GameGallerySlideViewHolder(val binding: GameGallerySlideItemBinding) : Bas
|
||||
binding.iconIv.displayGameIcon(gameEntity)
|
||||
binding.iconIv.setOnClickListener {
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
binding.root.context,
|
||||
|
||||
@ -55,7 +55,7 @@ class GameGalleryViewHolder(val cell: GameGalleryItemCell) :
|
||||
|
||||
if (subjectEntity.isMiniGame) {
|
||||
gameIcon.setOnClickListener {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
}
|
||||
} else {
|
||||
gameIcon.setOnClickListener(null)
|
||||
|
||||
@ -140,7 +140,7 @@ class GameHorizontalAdapter(
|
||||
}
|
||||
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
mContext,
|
||||
|
||||
@ -68,7 +68,7 @@ class GameHorizontalSlideAdapter(
|
||||
holder.bindGameHorizontalItem(gameEntity, mSubjectEntity)
|
||||
holder.itemView.setOnClickListener {
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
} else {
|
||||
val exposureEvent = exposureEventList?.safelyGetInRelease(position)
|
||||
if (exposureEvent != null) {
|
||||
|
||||
@ -968,7 +968,7 @@ class GameCollectionDetailFragment :
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
if (EBPackage.TYPE_INSTALLED == busFour.type
|
||||
&& UserManager.getInstance().isLoggedIn
|
||||
&& (mEntity?.count?.playedGame ?: 0) < (mEntity?.count?.game ?: 0)
|
||||
|
||||
@ -394,7 +394,7 @@ class SpecialDownloadDialogFragment : BaseDraggableDialogFragment() {
|
||||
SensorsBridge.trackDownloadComponentsContentClick(
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "unknown",
|
||||
gameSchemeType = gameEntity.gameBitChinese,
|
||||
gameSchemaType = gameEntity.gameBitChinese,
|
||||
downloadStatus = gameEntity.downloadStatusChinese,
|
||||
gameType = gameEntity.categoryChinese,
|
||||
downloadType = if (asVGame) "畅玩下载" else "本地下载",
|
||||
@ -405,7 +405,7 @@ class SpecialDownloadDialogFragment : BaseDraggableDialogFragment() {
|
||||
SensorsBridge.trackDownloadComponentsShow(
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "unknown",
|
||||
gameSchemeType = gameEntity.gameBitChinese,
|
||||
gameSchemaType = gameEntity.gameBitChinese,
|
||||
downloadStatus = gameEntity.downloadStatusChinese,
|
||||
gameType = gameEntity.categoryChinese,
|
||||
downloadType = if (asVGame) "畅玩下载" else "本地下载",
|
||||
|
||||
@ -97,7 +97,7 @@ class HomeGameItemViewHolder(val binding: HomeGameItemBinding) : BaseRecyclerVie
|
||||
}
|
||||
holder.itemView.setOnClickListener {
|
||||
if (game.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(game)
|
||||
MiniGameItemHelper.launchMiniGame(game.miniGameAppId, game.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
binding.root.context,
|
||||
|
||||
@ -292,7 +292,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
|
||||
gameDetailDestination.observe(viewLifecycleOwner, EventObserver { (entrance, game) ->
|
||||
if (game.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(game)
|
||||
MiniGameItemHelper.launchMiniGame(game.miniGameAppId, game.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
requireContext(),
|
||||
|
||||
@ -78,7 +78,6 @@ class CustomPageViewModel(
|
||||
addSource(repository.customDiscoverItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.recentGamesItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.customPluginItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.wechatMiniGameCPMItemLiveData, ::notifyWechatMiniGameCPMSubjectItemChanged)
|
||||
}
|
||||
|
||||
val dataList: LiveData<List<CustomPageItem>> = _dataList
|
||||
@ -358,11 +357,11 @@ class CustomPageViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChangeABatch(subjectEntity: SubjectEntity) {
|
||||
override fun onChangeABatch(subjectEntity: SubjectEntity, position: Int) {
|
||||
val subjectId = subjectEntity.id ?: return
|
||||
val gameList = subjectChangedMap[subjectId]
|
||||
if (gameList != null) {
|
||||
changeSubjectCustomPageItem(subjectId, getRandomGameList(subjectEntity.data, ArrayList(gameList)))
|
||||
changeSubjectCustomPageItem(position, getRandomGameList(subjectEntity.data, ArrayList(gameList)))
|
||||
} else {
|
||||
repository.loadChangeSubjectGame(subjectEntity)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -371,7 +370,7 @@ class CustomPageViewModel(
|
||||
override fun onResponse(response: List<GameEntity>?) {
|
||||
if (response != null) {
|
||||
subjectChangedMap[subjectId] = response
|
||||
onChangeABatch(subjectEntity)
|
||||
onChangeABatch(subjectEntity, position)
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,32 +396,21 @@ class CustomPageViewModel(
|
||||
return resultGameList
|
||||
}
|
||||
|
||||
private fun changeSubjectCustomPageItem(id: String, newGameList: MutableList<GameEntity>) {
|
||||
private fun changeSubjectCustomPageItem(position: Int, newGameList: MutableList<GameEntity>) {
|
||||
val oldData = _dataList.value as? MutableList<CustomPageItem>
|
||||
val newData = oldData?.toMutableList()
|
||||
if (!newData.isNullOrEmpty() && newGameList.isNotEmpty()) {
|
||||
if (!oldData.isNullOrEmpty() && newGameList.isNotEmpty()) {
|
||||
// 替换当前专题游戏数据
|
||||
val position = newData.indexOfFirst {
|
||||
when(it) {
|
||||
is CustomSubjectItem -> it.data.id == id
|
||||
is CustomSplitSubjectItem -> it.data.id == id
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
if (position == -1) return
|
||||
|
||||
val customPageItem = newData[position]
|
||||
val customPageItem = oldData.getOrNull(position)
|
||||
if (customPageItem is CustomSubjectItem) {
|
||||
val newCustomPageItem =
|
||||
customPageItem.copy(data = customPageItem.data.copy(mData = newGameList), _position = position)
|
||||
newData[position] = newCustomPageItem
|
||||
val newCustomPageItem = customPageItem.copy(data = customPageItem.data.copy(mData = newGameList))
|
||||
oldData[position] = newCustomPageItem
|
||||
gamePositionAndPackageHelper.putAll(getPositionAndPackageMap(newCustomPageItem, newGameList))
|
||||
}
|
||||
|
||||
if (customPageItem is CustomSplitSubjectItem) {
|
||||
|
||||
// 移除所有旧数据
|
||||
newData.removeAll {
|
||||
oldData.removeAll {
|
||||
it.componentPosition == customPageItem.componentPosition
|
||||
}
|
||||
|
||||
@ -445,15 +433,21 @@ class CustomPageViewModel(
|
||||
)
|
||||
|
||||
// 将新的 items 添加到列表集合
|
||||
newData.addAll(position, newItems)
|
||||
if (position >= oldData.size) {
|
||||
oldData.addAll(newItems)
|
||||
} else {
|
||||
oldData.addAll(position, newItems)
|
||||
}
|
||||
|
||||
|
||||
// 修正集合中 item 的position 取值
|
||||
newData.forEachIndexed { index, item ->
|
||||
oldData.forEachIndexed { index, item ->
|
||||
item.position = index
|
||||
}
|
||||
|
||||
}
|
||||
// 通知更新
|
||||
_dataList.value = newData
|
||||
_dataList.value = oldData
|
||||
}
|
||||
}
|
||||
|
||||
@ -473,40 +467,6 @@ class CustomPageViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过CPM接口异步请求获取的微信小游戏数据插入
|
||||
*/
|
||||
private fun notifyWechatMiniGameCPMSubjectItemChanged(result: Pair<String, List<GameEntity>>) {
|
||||
val oldData = _dataList.value ?: return
|
||||
val index = oldData.indexOfFirst {
|
||||
it is CustomWeChatMiniGamesCPMSubjectItem && it.data.id == result.first
|
||||
}
|
||||
if (index == -1) return
|
||||
val subjectItem = (oldData[index] as CustomWeChatMiniGamesCPMSubjectItem).apply {
|
||||
data.data = result.second.toMutableList()
|
||||
data.isWechatColumnCPM = true
|
||||
}
|
||||
val position = subjectItem.position
|
||||
val componentPosition = subjectItem.componentPosition
|
||||
val newData = oldData.toMutableList()
|
||||
val customPageItemList = repository.convertColumnDetailSubjectItems(
|
||||
position,
|
||||
componentPosition,
|
||||
subjectItem.link,
|
||||
subjectItem.data
|
||||
)
|
||||
if (customPageItemList.isEmpty()) return
|
||||
newData[index] = customPageItemList[0]
|
||||
newData.addAll(index + 1, customPageItemList.subList(1, customPageItemList.size))
|
||||
newData.forEachIndexed { pos, customPageItem ->
|
||||
customPageItem.position = pos
|
||||
}
|
||||
repository.notifyPositionChanged(newData.size)
|
||||
gamePositionAndPackageHelper.clear()
|
||||
gamePositionAndPackageHelper.putAll(getPositionAndPackageMap(newData))
|
||||
_dataList.value = newData
|
||||
}
|
||||
|
||||
private fun notifyItemRemoved(removeItem: CustomPageItem) {
|
||||
val oldData = _dataList.value ?: return
|
||||
val newData = oldData.toMutableList()
|
||||
@ -516,7 +476,7 @@ class CustomPageViewModel(
|
||||
for (i in removeItem.position until newData.size) {
|
||||
newData[i].position--
|
||||
}
|
||||
repository.notifyPositionAdded(-1)
|
||||
repository.notifyPositionChanged(-1)
|
||||
gamePositionAndPackageHelper.clear()
|
||||
gamePositionAndPackageHelper.putAll(getPositionAndPackageMap(newData))
|
||||
_dataList.value = newData
|
||||
|
||||
@ -134,7 +134,7 @@ class CustomGameHorizontalAdapter(
|
||||
}
|
||||
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
context,
|
||||
|
||||
@ -29,7 +29,7 @@ interface OnCustomPageEventListener {
|
||||
/**
|
||||
* 换一批
|
||||
*/
|
||||
fun onChangeABatch(subjectEntity: SubjectEntity)
|
||||
fun onChangeABatch(subjectEntity: SubjectEntity, position: Int)
|
||||
|
||||
fun onChangeAppBarColor(color: Int)
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class SubjectEventHelper(viewModel: CustomPageViewModel) : CustomPageItemChildEv
|
||||
|
||||
fun onChangeABatch(subject: SubjectEntity) {
|
||||
tracker.trackColumnClick(_item, null, "右上角", "换一批")
|
||||
viewModel.onChangeABatch(subject)
|
||||
viewModel.onChangeABatch(subject, _item.position)
|
||||
}
|
||||
|
||||
fun onMoreClick(link: LinkEntity) {
|
||||
|
||||
@ -73,8 +73,6 @@ class CustomPageData(
|
||||
val qqMiniGameColumn: SubjectEntity? = null,
|
||||
@SerializedName("link_wechat_game_column_detail")
|
||||
val wechatMiniGameColumn: SubjectEntity? = null,
|
||||
@SerializedName("link_wechat_game_cpm_column_detail")
|
||||
val wechatMiniGameCPMColumn: SubjectEntity? = null,
|
||||
@SerializedName("link_common_collection")
|
||||
val linkCommonCollection: CommonContentCollection? = null,
|
||||
@SerializedName("link_qq_game_recently_played")
|
||||
@ -85,7 +83,6 @@ class CustomPageData(
|
||||
get() = when (link.type) {
|
||||
CustomPageItem.CUSTOM_LINK_TYPE_QQ_MINI_GAME_COLUMN_DETAIL -> qqMiniGameColumn
|
||||
CustomPageItem.CUSTOM_LINK_TYPE_WECHAT_MINI_GAME_COLUMN_DETAIL -> wechatMiniGameColumn
|
||||
CustomPageItem.CUSTOM_LINK_TYPE_WECHAT_WECHAT_GAME_CPM_COLUMN_DETAIL -> wechatMiniGameCPMColumn
|
||||
else -> linkColumn
|
||||
}
|
||||
|
||||
@ -675,7 +672,7 @@ class CustomPageData(
|
||||
@SerializedName("home")
|
||||
private val _home: String? = null,
|
||||
@SerializedName("more_link")
|
||||
val moreLink: LinkEntity? = null
|
||||
val moreLink: LinkEntity? = null
|
||||
) {
|
||||
|
||||
val home: String
|
||||
|
||||
@ -4,7 +4,10 @@ import com.gh.common.util.ViewPagerFragmentHelper
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.core.utils.TimeUtils
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.entity.AmwayCommentEntity
|
||||
import com.gh.gamecenter.entity.DiscoveryCardEntity
|
||||
import com.gh.gamecenter.entity.HomeItemTestV2Entity
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.vspace.VGameItemData
|
||||
@ -81,7 +84,6 @@ abstract class CustomPageItem(
|
||||
const val CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED = "wechat_game_recently_played"
|
||||
const val CUSTOM_LINK_TYPE_QQ_MINI_GAME_COLUMN_DETAIL = ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN
|
||||
const val CUSTOM_LINK_TYPE_WECHAT_MINI_GAME_COLUMN_DETAIL = ViewPagerFragmentHelper.TYPE_WECHAT_GAME_COLUMN
|
||||
const val CUSTOM_LINK_TYPE_WECHAT_WECHAT_GAME_CPM_COLUMN_DETAIL = ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN
|
||||
const val CUSTOM_LINK_TYPE_HALO_RECOMMEND = "halo_recommend"
|
||||
const val CUSTOM_LINK_TYPE_COLUMN_COLLECTION = "column_collection" // 专题合集
|
||||
const val CUSTOM_LINK_TYPE_GAME_LIST_COLLECTION = "game_list_collection"
|
||||
@ -298,7 +300,6 @@ abstract class CustomPageItem(
|
||||
CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED to "最近在玩",
|
||||
CUSTOM_LINK_TYPE_QQ_MINI_GAME_COLUMN_DETAIL to "QQ小游戏专题",
|
||||
CUSTOM_LINK_TYPE_WECHAT_MINI_GAME_COLUMN_DETAIL to "微信小游戏专题",
|
||||
CUSTOM_LINK_TYPE_WECHAT_WECHAT_GAME_CPM_COLUMN_DETAIL to "微信小游戏专题",
|
||||
CUSTOM_LINK_TYPE_HALO_RECOMMEND to "光环推荐",
|
||||
CUSTOM_LINK_TYPE_COLUMN_COLLECTION to "专题合集",
|
||||
CUSTOM_LINK_TYPE_GAME_LIST_COLLECTION to "游戏单合集",
|
||||
@ -622,25 +623,6 @@ data class CustomRecentWeChatMiniGamesItem(
|
||||
}
|
||||
}
|
||||
|
||||
// 微信小游戏CPM专题组件
|
||||
data class CustomWeChatMiniGamesCPMSubjectItem(
|
||||
private val _link: LinkEntity,
|
||||
val data: SubjectEntity,
|
||||
private val _position: Int,
|
||||
private val _componentPosition: Int
|
||||
) : CustomPageItem(_link, _position, _componentPosition) {
|
||||
|
||||
override val itemType: Int
|
||||
get() = CUSTOM_PAGE_ITEM_TYPE_MINI_GAME_RECENT_PLAY
|
||||
|
||||
override fun doAreContentsTheSames(other: CustomPageItem): Boolean {
|
||||
return other is CustomWeChatMiniGamesCPMSubjectItem
|
||||
&& data == other.data
|
||||
&& position == other.position
|
||||
&& componentPosition == other.componentPosition
|
||||
}
|
||||
}
|
||||
|
||||
// qq小游戏-最近在玩
|
||||
data class CustomRecentQqMiniGamesItem(
|
||||
private val _link: LinkEntity,
|
||||
|
||||
@ -3,12 +3,12 @@ package com.gh.gamecenter.home.custom.model
|
||||
import android.graphics.Paint
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.Observer
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.util.GameSubstituteRepositoryHelper
|
||||
import com.gh.common.util.HomePluggableHelper
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.utils.TextHelper
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.sp2px
|
||||
@ -18,11 +18,11 @@ import com.gh.gamecenter.entity.DiscoveryCardEntity
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
import com.gh.gamecenter.entity.PullDownPush
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.FloatingWindowEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.gamecenter.feature.entity.FloatingWindowEntity
|
||||
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_BANNER
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_BANNER
|
||||
@ -47,6 +47,7 @@ import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_S
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_SUBJECT_TYPE_GAME_HORIZONTAL_SLIDE
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_SUBJECT_TYPE_GAME_TIMELINE_HORIZONTAL_SLIDE
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_SUBJECT_TYPE_GAME_VERTICAL_SLIDE
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_SUBJECT_TYPE_SINGLE_GAME_CARD
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_COLUMN
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_GAME
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_HALO_RECOMMEND
|
||||
@ -54,11 +55,7 @@ import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_QQ_MINI_GAME_COLUMN_DETAIL
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_WECHAT_MINI_GAME_COLUMN_DETAIL
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.CUSTOM_LINK_TYPE_WECHAT_WECHAT_GAME_CPM_COLUMN_DETAIL
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMListRepository
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMListUseCase
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMRemoteDataSource
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.wrapper.MainWrapperRepository
|
||||
@ -66,14 +63,12 @@ import com.gh.vspace.VHelper
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.regex.Pattern
|
||||
|
||||
|
||||
class CustomPageRepository private constructor(
|
||||
private val remoteDataSource: CustomPageRemoteDataSource,
|
||||
private val localDataSource: CustomPageLocalDataSource,
|
||||
private val wGameSubjectCPMRemoteDataSource: WGameSubjectCPMRemoteDataSource
|
||||
private val localDataSource: CustomPageLocalDataSource
|
||||
) {
|
||||
|
||||
private val pageInfo = PageInfo()
|
||||
@ -82,10 +77,6 @@ class CustomPageRepository private constructor(
|
||||
|
||||
private val shareRepository = CustomPageShareRepository.instance
|
||||
|
||||
private val wGameSubjectCPMListUseCase = WGameSubjectCPMListUseCase(
|
||||
WGameSubjectCPMListRepository(wGameSubjectCPMRemoteDataSource)
|
||||
)
|
||||
|
||||
private var recentItem: CustomRecentGamesItem? = null
|
||||
|
||||
private var recentQQItem: CustomRecentQqMiniGamesItem? = null
|
||||
@ -100,13 +91,14 @@ class CustomPageRepository private constructor(
|
||||
|
||||
private var displayingGameIdSet = hashSetOf<String>() // 当前正在显示的游戏 id 列表
|
||||
|
||||
val customPluginItemLiveData: LiveData<CustomPluginItem> = MediatorLiveData<CustomPluginItem>().apply {
|
||||
private val _customPluginItemLiveData = MediatorLiveData<CustomPluginItem>().apply {
|
||||
addSource(PackageRepository.gameUpdateLiveData) {
|
||||
refreshPluginIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
}
|
||||
val customPluginItemLiveData: LiveData<CustomPluginItem> = _customPluginItemLiveData
|
||||
|
||||
val recentGamesItemLiveData: LiveData<CustomRecentGamesItem> = MediatorLiveData<CustomRecentGamesItem>().apply {
|
||||
private val _recentGamesItemLiveData = MediatorLiveData<CustomRecentGamesItem>().apply {
|
||||
addSource(DownloadManager.getInstance().downloadEntityLiveData) {
|
||||
refreshRecentVGameIfNeed()?.let(this::setValue)
|
||||
}
|
||||
@ -114,30 +106,29 @@ class CustomPageRepository private constructor(
|
||||
refreshRecentVGameIfNeed()?.let(this::setValue)
|
||||
}
|
||||
}
|
||||
val recentGamesItemLiveData: LiveData<CustomRecentGamesItem> = _recentGamesItemLiveData
|
||||
|
||||
val recentMiniGamesItemLiveData: LiveData<CustomRecentWeChatMiniGamesItem> =
|
||||
MediatorLiveData<CustomRecentWeChatMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.wechatRecentGamesItemLiveData) {
|
||||
refreshRecentWechatMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
private val _recentMiniGamesItemLiveData = MediatorLiveData<CustomRecentWeChatMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.wechatRecentGamesItemLiveData) {
|
||||
refreshRecentWechatMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
}
|
||||
|
||||
val recentQqMiniGamesItemLiveData: LiveData<CustomRecentQqMiniGamesItem> =
|
||||
MediatorLiveData<CustomRecentQqMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData) {
|
||||
refreshRecentQQMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
val recentMiniGamesItemLiveData: LiveData<CustomRecentWeChatMiniGamesItem> = _recentMiniGamesItemLiveData
|
||||
|
||||
private val _recentQqMiniGamesItemLiveData = MediatorLiveData<CustomRecentQqMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData) {
|
||||
refreshRecentQQMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
}
|
||||
val recentQqMiniGamesItemLiveData: LiveData<CustomRecentQqMiniGamesItem> = _recentQqMiniGamesItemLiveData
|
||||
|
||||
val customDiscoverItemLiveData: LiveData<CustomDiscoverCardItem> =
|
||||
MediatorLiveData<CustomDiscoverCardItem>().apply {
|
||||
addSource(shareRepository.discoverData) {
|
||||
refreshDiscoverDataIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
private val _customDiscoverItemLiveData = MediatorLiveData<CustomDiscoverCardItem>().apply {
|
||||
addSource(shareRepository.discoverData) {
|
||||
refreshDiscoverDataIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
|
||||
val wechatMiniGameCPMItemLiveData: LiveData<Pair<String, List<GameEntity>>> =
|
||||
wGameSubjectCPMListUseCase.wechatMiniGameCPMListLiveData
|
||||
}
|
||||
val customDiscoverItemLiveData: LiveData<CustomDiscoverCardItem> = _customDiscoverItemLiveData
|
||||
|
||||
val hiddenNotifications: LiveData<HashMap<String, MutableSet<String>>>
|
||||
get() = shareRepository.hiddenNotifications
|
||||
@ -233,7 +224,6 @@ class CustomPageRepository private constructor(
|
||||
|
||||
private fun transformRawDataIntoItemData(data: CustomPageData, reloadDiscoverData: Boolean): List<CustomPageItem> {
|
||||
val list = arrayListOf<CustomPageItem>()
|
||||
|
||||
data.customsComponents
|
||||
.forEachIndexed { _, item ->
|
||||
// 如果当前item不是展开大图,并且上一个item为展开大图,则说明展开大图组件已结束
|
||||
@ -275,24 +265,112 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
item.link.type == CUSTOM_LINK_TYPE_COLUMN
|
||||
|| item.link.type == CUSTOM_LINK_TYPE_QQ_MINI_GAME_COLUMN_DETAIL
|
||||
|| item.link.type == CUSTOM_LINK_TYPE_WECHAT_MINI_GAME_COLUMN_DETAIL -> {
|
||||
val subItems = convertColumnDetailSubjectItems(
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition,
|
||||
item.link,
|
||||
item.gameSubjectEntity
|
||||
)
|
||||
if (subItems.isNotEmpty()) {
|
||||
list.addAll(subItems)
|
||||
pageInfo.positionGetAndAdd(subItems.size)
|
||||
pageInfo.componentPositionIncrement()
|
||||
item.link.type == CUSTOM_LINK_TYPE_COLUMN || item.link.type == CUSTOM_LINK_TYPE_QQ_MINI_GAME_COLUMN_DETAIL || item.link.type == CUSTOM_LINK_TYPE_WECHAT_MINI_GAME_COLUMN_DETAIL -> {
|
||||
// 游戏专题
|
||||
val gameSubject = item.gameSubjectEntity?.also {
|
||||
if (item.link.type == CUSTOM_LINK_TYPE_COLUMN) {
|
||||
it.data?.forEach { game ->
|
||||
game.gameLocation = GameEntity.GameLocation.INDEX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isAdded = false
|
||||
if (gameSubject != null && !gameSubject.data.isNullOrEmpty()) {
|
||||
// 记录已显示的游戏 id
|
||||
for (game in gameSubject.data!!) {
|
||||
displayingGameIdSet.add(game.id)
|
||||
}
|
||||
|
||||
// 替换游戏
|
||||
substituteGameIfNeeded(gameSubject)
|
||||
|
||||
if (gameSubject.tag == "update") {
|
||||
// 优先显示更新标签
|
||||
gameSubject.data?.forEach {
|
||||
it.tagStyle.clear()
|
||||
it.tagStyle.add(
|
||||
TagStyleEntity(
|
||||
id = "local_generated",
|
||||
name = TimeUtils.getFormatTime(it.updateTime, "MM-dd") + " 更新",
|
||||
color = "1383EB",
|
||||
background = "E8F3FF",
|
||||
column = "1383EB"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
when (gameSubject.type) {
|
||||
COMPONENTS_GAME_SUBJECT_TYPE_DOUBLE_CARD, COMPONENTS_SUBJECT_TYPE_DOUBLE_GAME_WELFARE_CARD -> {
|
||||
// 双列卡片 双列福利卡片
|
||||
val gameCount = gameSubject.data?.size ?: 0
|
||||
if (gameCount >= COMPONENT_TYPE_COLUMN_LIMIT_TWO_COUNT) {
|
||||
val subjectItems = convertSplitSubjectItems(item, 2, false)
|
||||
list.addAll(subjectItems)
|
||||
isAdded = true
|
||||
}
|
||||
}
|
||||
|
||||
COMPONENTS_GAME_SUBJECT_TYPE_GAME_VERTICAL -> {
|
||||
// 长列表式
|
||||
val subjectItems = convertSplitSubjectItems(item, 1, false)
|
||||
list.addAll(subjectItems)
|
||||
isAdded = true
|
||||
}
|
||||
|
||||
COMPONENTS_SUBJECT_TYPE_GAME_HORIZONTAL -> {
|
||||
// 图标矩阵
|
||||
val subjectItems = convertSplitSubjectItems(item, 4, true)
|
||||
list.addAll(subjectItems)
|
||||
isAdded = true
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (gameSubject.type == COMPONENTS_GAME_SUBJECT_TYPE_GAME_VIDEO_HORIZONTAL_SLIDE ||
|
||||
gameSubject.type == COMPONENTS_SUBJECT_TYPE_GAME_FOLD_SLIDE
|
||||
) {
|
||||
val gameCount = gameSubject.data?.size ?: 0
|
||||
if (gameCount >= COMPONENT_TYPE_COLUMN_LIMIT_TWO_COUNT) {
|
||||
list.add(
|
||||
CustomSubjectItem(
|
||||
item.link,
|
||||
gameSubject,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition
|
||||
)
|
||||
)
|
||||
pageInfo.positionIncrement()
|
||||
isAdded = true
|
||||
}
|
||||
|
||||
} else {
|
||||
val gameCount = gameSubject.data?.size ?: 0
|
||||
if (gameCount > 0) {
|
||||
list.add(
|
||||
CustomSubjectItem(
|
||||
item.link,
|
||||
gameSubject,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition
|
||||
)
|
||||
)
|
||||
pageInfo.positionIncrement()
|
||||
isAdded = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (isAdded) {
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//QQ小游戏-最近在玩(需要用户登录才显示)
|
||||
item.link.type == CUSTOM_LINK_TYPE_QQ_GAME_RECENTLY_PLAYED -> {
|
||||
//QQ小游戏-最近在玩(需要用户登录才显示)
|
||||
val linkQqGameRecentlyPlayed = item.linkQqGameRecentlyPlayed
|
||||
if (linkQqGameRecentlyPlayed != null) {
|
||||
recentQQItem = CustomRecentQqMiniGamesItem(
|
||||
@ -308,8 +386,8 @@ class CustomPageRepository private constructor(
|
||||
|
||||
}
|
||||
|
||||
// 微信小游戏-最近在玩
|
||||
item.link.type == CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED -> {
|
||||
// 微信小游戏-最近在玩
|
||||
recentWechatItem = CustomRecentWeChatMiniGamesItem(
|
||||
item.link,
|
||||
MiniGameRecentlyPlayUseCase.getRecentlyPlayedMiniGameList(Constants.WECHAT_MINI_GAME),
|
||||
@ -320,23 +398,6 @@ class CustomPageRepository private constructor(
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
|
||||
// 微信小游戏CPM专题
|
||||
item.link.type == CUSTOM_LINK_TYPE_WECHAT_WECHAT_GAME_CPM_COLUMN_DETAIL -> {
|
||||
item.gameSubjectEntity?.let { subject ->
|
||||
list.add(
|
||||
CustomWeChatMiniGamesCPMSubjectItem(
|
||||
item.link,
|
||||
subject,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition
|
||||
)
|
||||
)
|
||||
wGameSubjectCPMListUseCase.getWechatMiniGameCPMList(subject.id)
|
||||
pageInfo.positionIncrement()
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
}
|
||||
|
||||
item.linkColumnCollection != null -> {
|
||||
// 专题合集
|
||||
val linkColumnCollection = item.linkColumnCollection
|
||||
@ -414,9 +475,7 @@ class CustomPageRepository private constructor(
|
||||
|| layout == COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_VERTICAL_CARD
|
||||
|| layout == COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT
|
||||
) {
|
||||
val subItems = convertSplitCommonContentCollection(item)
|
||||
list.addAll(subItems)
|
||||
pageInfo.positionGetAndAdd(subItems.size)
|
||||
list.addAll(convertSplitCommonContentCollection(item))
|
||||
pageInfo.componentPositionIncrement()
|
||||
} else {
|
||||
var show = true
|
||||
@ -469,16 +528,12 @@ class CustomPageRepository private constructor(
|
||||
// 最近在玩
|
||||
val entities = VHelper.getSortedRecentlyPlayedList()
|
||||
recentItem =
|
||||
CustomRecentGamesItem(
|
||||
item.link,
|
||||
entities,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition
|
||||
).also {
|
||||
list.add(it)
|
||||
pageInfo.positionIncrement()
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
CustomRecentGamesItem(item.link, entities, pageInfo.position, pageInfo.componentPosition)
|
||||
.also {
|
||||
list.add(it)
|
||||
pageInfo.positionIncrement()
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
}
|
||||
|
||||
item.link.type == "plugin_area" -> {
|
||||
@ -611,155 +666,45 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
|
||||
pageInfo.nextPage()
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
fun convertColumnDetailSubjectItems(
|
||||
position: Int,
|
||||
componentPosition: Int,
|
||||
link: LinkEntity,
|
||||
subjectEntity: SubjectEntity?,
|
||||
): List<CustomPageItem> {
|
||||
|
||||
var currentPosition = position
|
||||
val list = mutableListOf<CustomPageItem>()
|
||||
|
||||
// 游戏专题
|
||||
val gameSubject = subjectEntity?.also {
|
||||
if (link.type == CUSTOM_LINK_TYPE_COLUMN) {
|
||||
it.data?.forEach { game ->
|
||||
game.gameLocation = GameEntity.GameLocation.INDEX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gameSubject != null && !gameSubject.data.isNullOrEmpty()) {
|
||||
// 记录已显示的游戏 id
|
||||
for (game in gameSubject.data!!) {
|
||||
displayingGameIdSet.add(game.id)
|
||||
}
|
||||
|
||||
// 替换游戏
|
||||
substituteGameIfNeeded(gameSubject)
|
||||
|
||||
if (gameSubject.tag == "update") {
|
||||
// 优先显示更新标签
|
||||
gameSubject.data?.forEach {
|
||||
it.tagStyle.clear()
|
||||
it.tagStyle.add(
|
||||
TagStyleEntity(
|
||||
id = "local_generated",
|
||||
name = TimeUtils.getFormatTime(it.updateTime, "MM-dd") + " 更新",
|
||||
color = "1383EB",
|
||||
background = "E8F3FF",
|
||||
column = "1383EB"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
when (gameSubject.type) {
|
||||
COMPONENTS_GAME_SUBJECT_TYPE_DOUBLE_CARD, COMPONENTS_SUBJECT_TYPE_DOUBLE_GAME_WELFARE_CARD -> {
|
||||
// 双列卡片 双列福利卡片
|
||||
val gameCount = gameSubject.data?.size ?: 0
|
||||
if (gameCount >= COMPONENT_TYPE_COLUMN_LIMIT_TWO_COUNT) {
|
||||
val subjectItems =
|
||||
convertSplitSubjectItems(link, subjectEntity, currentPosition, componentPosition, 2, false)
|
||||
list.addAll(subjectItems)
|
||||
currentPosition += subjectItems.size
|
||||
}
|
||||
}
|
||||
|
||||
COMPONENTS_GAME_SUBJECT_TYPE_GAME_VERTICAL -> {
|
||||
// 长列表式
|
||||
val subjectItems =
|
||||
convertSplitSubjectItems(link, subjectEntity, currentPosition, componentPosition, 1, false)
|
||||
list.addAll(subjectItems)
|
||||
currentPosition += subjectItems.size
|
||||
}
|
||||
|
||||
COMPONENTS_SUBJECT_TYPE_GAME_HORIZONTAL -> {
|
||||
// 图标矩阵
|
||||
val subjectItems =
|
||||
convertSplitSubjectItems(link, subjectEntity, currentPosition, componentPosition, 4, true)
|
||||
list.addAll(subjectItems)
|
||||
currentPosition += subjectItems.size
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (gameSubject.type == COMPONENTS_GAME_SUBJECT_TYPE_GAME_VIDEO_HORIZONTAL_SLIDE ||
|
||||
gameSubject.type == COMPONENTS_SUBJECT_TYPE_GAME_FOLD_SLIDE
|
||||
) {
|
||||
val gameCount = gameSubject.data?.size ?: 0
|
||||
if (gameCount >= COMPONENT_TYPE_COLUMN_LIMIT_TWO_COUNT) {
|
||||
list.add(
|
||||
CustomSubjectItem(
|
||||
link,
|
||||
gameSubject,
|
||||
currentPosition,
|
||||
componentPosition
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
} else {
|
||||
val gameCount = gameSubject.data?.size ?: 0
|
||||
if (gameCount > 0) {
|
||||
list.add(
|
||||
CustomSubjectItem(
|
||||
link,
|
||||
gameSubject,
|
||||
currentPosition,
|
||||
componentPosition
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
|
||||
private fun convertSplitSubjectItems(
|
||||
link: LinkEntity,
|
||||
subjectEntity: SubjectEntity?,
|
||||
position: Int,
|
||||
componentPosition: Int,
|
||||
item: CustomPageData.CustomsComponent,
|
||||
stepNum: Int,
|
||||
isMustFullyCover: Boolean
|
||||
): List<CustomPageItem> {
|
||||
val gameSubject = subjectEntity ?: return emptyList()
|
||||
val gameSubject = item.gameSubjectEntity ?: return emptyList()
|
||||
val items = arrayListOf<CustomPageItem>()
|
||||
val games = gameSubject.data ?: emptyList()
|
||||
var currentPosition = position
|
||||
(games.indices step stepNum).forEach { start ->
|
||||
if (isMustFullyCover) {
|
||||
if (start + stepNum - 1 < games.size) {
|
||||
items.add(
|
||||
CustomSplitSubjectItem(
|
||||
link,
|
||||
item.link,
|
||||
gameSubject,
|
||||
currentPosition++,
|
||||
componentPosition,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition,
|
||||
stepNum,
|
||||
start
|
||||
)
|
||||
)
|
||||
pageInfo.positionIncrement()
|
||||
}
|
||||
} else {
|
||||
items.add(
|
||||
CustomSplitSubjectItem(
|
||||
link,
|
||||
item.link,
|
||||
gameSubject,
|
||||
currentPosition++,
|
||||
componentPosition,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition,
|
||||
stepNum,
|
||||
start
|
||||
)
|
||||
)
|
||||
pageInfo.positionIncrement()
|
||||
}
|
||||
}
|
||||
items.forEach {
|
||||
@ -784,6 +729,7 @@ class CustomPageRepository private constructor(
|
||||
left
|
||||
)
|
||||
)
|
||||
pageInfo.positionIncrement()
|
||||
}
|
||||
return items
|
||||
}
|
||||
@ -796,20 +742,12 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun notifyPositionAdded(offset: Int) {
|
||||
pageInfo.positionGetAndAdd(offset)
|
||||
}
|
||||
|
||||
fun notifyPositionChanged(value: Int) {
|
||||
pageInfo.position = value
|
||||
fun notifyPositionChanged(offset: Int) {
|
||||
pageInfo.position += offset
|
||||
}
|
||||
|
||||
fun loadChangeSubjectGame(subjectEntity: SubjectEntity): Observable<List<GameEntity>> =
|
||||
if (subjectEntity.isWechatColumnCPM) {// 微信小游戏CPM专题的“换一批”接口
|
||||
wGameSubjectCPMRemoteDataSource.getRecommendCPMList(2, 30).toObservable()
|
||||
} else {
|
||||
remoteDataSource.loadChangeSubjectGame(subjectEntity)
|
||||
}
|
||||
remoteDataSource.loadChangeSubjectGame(subjectEntity)
|
||||
.map(RegionSettingHelper.filterGame)
|
||||
.map(ApkActiveUtils.filterMapperList)
|
||||
|
||||
@ -860,16 +798,16 @@ class CustomPageRepository private constructor(
|
||||
val page: Int
|
||||
get() = _page
|
||||
|
||||
private var _position: AtomicInteger = AtomicInteger(0)
|
||||
private var _position: Int = 0
|
||||
var position: Int
|
||||
get() = _position.get()
|
||||
get() = _position
|
||||
set(value) {
|
||||
_position.set(value)
|
||||
_position = value
|
||||
}
|
||||
|
||||
private var _componentPosition: AtomicInteger = AtomicInteger(0)
|
||||
private var _componentPosition = 0
|
||||
val componentPosition: Int
|
||||
get() = _componentPosition.get()
|
||||
get() = _componentPosition
|
||||
|
||||
|
||||
fun nextPage() {
|
||||
@ -877,25 +815,17 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
|
||||
fun positionIncrement() {
|
||||
positionGetAndAdd(1)
|
||||
_position++
|
||||
}
|
||||
|
||||
fun componentPositionIncrement() {
|
||||
componentPositionGetAndAdd(1)
|
||||
}
|
||||
|
||||
fun positionGetAndAdd(value: Int) {
|
||||
_position.getAndAdd(value)
|
||||
}
|
||||
|
||||
fun componentPositionGetAndAdd(value: Int) {
|
||||
_componentPosition.getAndAdd(value)
|
||||
_componentPosition++
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
_page = 1
|
||||
_position.set(0)
|
||||
_componentPosition.set(0)
|
||||
_position = 0
|
||||
_componentPosition = 0
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,8 +844,7 @@ class CustomPageRepository private constructor(
|
||||
RetrofitManager.getInstance().newApi,
|
||||
MainWrapperRepository.getInstance()
|
||||
),
|
||||
CustomPageLocalDataSource(),
|
||||
WGameSubjectCPMRemoteDataSource()
|
||||
CustomPageLocalDataSource()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,8 +123,12 @@ abstract class BaseCustomViewHolder(
|
||||
_title.name = subject.name
|
||||
tvTitle.text = subject.name ?: ""
|
||||
}
|
||||
if (_title.rightText != subject.home) {
|
||||
_title.rightText = subject.home
|
||||
val home = subject.home ?: ""
|
||||
val homeText = subject.homeText ?: ""
|
||||
if (_title.rightHome != home || _title.rightText != homeText) {
|
||||
_title.rightHome = home
|
||||
_title.rightText = homeText
|
||||
|
||||
fun getHomeText(defaultResId: Int): String =
|
||||
if (subject.homeText.isNullOrBlank()) {
|
||||
defaultResId.toResString()
|
||||
@ -363,6 +367,7 @@ abstract class BaseCustomViewHolder(
|
||||
|
||||
data class TitleData(
|
||||
var name: String? = null,
|
||||
var rightHome: String? = null,
|
||||
var rightText: String? = null,
|
||||
var isRefresh: Boolean = false,
|
||||
var icon: String? = null,
|
||||
|
||||
@ -13,7 +13,7 @@ object HeadUpDisplayLogHelper {
|
||||
source = source,
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
@ -25,7 +25,7 @@ object HeadUpDisplayLogHelper {
|
||||
source = source,
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
@ -36,7 +36,7 @@ object HeadUpDisplayLogHelper {
|
||||
SensorsBridge.trackAutomaticInstallationPromptBarShow(
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
@ -47,7 +47,7 @@ object HeadUpDisplayLogHelper {
|
||||
SensorsBridge.trackAutomaticInstallationPromptBarClick(
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
|
||||
@ -59,7 +59,7 @@ class MiniGameRecentlyPlayListAdapter(
|
||||
if (onItemClick != null) {
|
||||
onItemClick.invoke(entity, position)
|
||||
} else {
|
||||
MiniGameItemHelper.launchMiniGame(entity)
|
||||
MiniGameItemHelper.launchMiniGame(entity.miniGameAppId, entity.miniGameType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ class MiniGameSearchDefaultRankAdapter(
|
||||
|
||||
// 转成Game实体比较好处理数据
|
||||
val trackGame = GameEntity(
|
||||
_id = rank.id,
|
||||
id = rank.id,
|
||||
mName = rank.name,
|
||||
miniGameAppId = rank.link.link ?: "",
|
||||
miniGameType = Constants.WECHAT_MINI_GAME,
|
||||
|
||||
@ -2,16 +2,14 @@ package com.gh.gamecenter.minigame
|
||||
|
||||
import com.gh.gamecenter.entity.SearchSubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMRemoteDataSource
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.retrofit.service.ApiService
|
||||
import com.gh.gamecenter.search.ISearchGameResultRepository
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import java.net.URLEncoder
|
||||
|
||||
class MiniGameSearchResultRepository(
|
||||
private val api: ApiService = RetrofitManager.getInstance().newApi,
|
||||
private val mWGameSubjectCPMDataSource: WGameSubjectCPMRemoteDataSource = WGameSubjectCPMRemoteDataSource()
|
||||
private val api: ApiService = RetrofitManager.getInstance().newApi
|
||||
) : ISearchGameResultRepository {
|
||||
|
||||
override fun getSearchGame(
|
||||
@ -24,8 +22,4 @@ class MiniGameSearchResultRepository(
|
||||
override fun getSearchSubject(key: String?, page: Int): Observable<List<SearchSubjectEntity>> {
|
||||
return Observable.just(emptyList())
|
||||
}
|
||||
|
||||
override fun getWGameCPMGameList(): Single<MutableList<GameEntity>> {
|
||||
return mWGameSubjectCPMDataSource.getRecommendCPMList(1)
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.gh.gamecenter.minigame.wechat
|
||||
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.subject.ISubjectListRepository
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
|
||||
class WGameSubjectCPMListRepository(
|
||||
private val dataSource: WGameSubjectCPMRemoteDataSource = WGameSubjectCPMRemoteDataSource()
|
||||
) : ISubjectListRepository {
|
||||
|
||||
override fun getColumn(column_id: String?, page: Int, sort: String?, order: String?): Single<MutableList<GameEntity>> {
|
||||
return dataSource.getRecommendCPMList(page)
|
||||
}
|
||||
|
||||
override fun getColumnSettings(column_id: String?): Observable<SubjectSettingEntity> {
|
||||
return Observable.just(SubjectSettingEntity())
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package com.gh.gamecenter.minigame.wechat
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.lifecycle.LiveData
|
||||
import com.gh.gamecenter.common.livedata.NonStickyMutableLiveData
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* 微信小游戏CPM-网域层
|
||||
*/
|
||||
class WGameSubjectCPMListUseCase(
|
||||
private val repository: WGameSubjectCPMListRepository = WGameSubjectCPMListRepository()
|
||||
) {
|
||||
|
||||
/**
|
||||
* 微信专题CPM请求记录,用于避免重复请求,以专题ID作为Key
|
||||
*/
|
||||
private val requestKeyList = mutableListOf<String>()
|
||||
|
||||
/**
|
||||
* 微信小游戏CPM列表,这里的LiveData充当类似于EventBus的角色,因此使用NonStickyMutableLiveData
|
||||
*/
|
||||
private val _wechatMiniGameCPMListLiveData = NonStickyMutableLiveData<Pair<String, List<GameEntity>>>()
|
||||
val wechatMiniGameCPMListLiveData: LiveData<Pair<String, List<GameEntity>>> = _wechatMiniGameCPMListLiveData
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getWechatMiniGameCPMList(subjectId: String?) {
|
||||
if (subjectId.isNullOrEmpty() || requestKeyList.contains(subjectId)) {
|
||||
return
|
||||
}
|
||||
|
||||
requestKeyList.add(subjectId)
|
||||
repository.getColumn(null, 1, null, null)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<List<GameEntity>>() {
|
||||
override fun onSuccess(data: List<GameEntity>) {
|
||||
requestKeyList.remove(subjectId)
|
||||
_wechatMiniGameCPMListLiveData.value = subjectId to data
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
package com.gh.gamecenter.minigame.wechat
|
||||
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
||||
import com.gh.gamecenter.common.utils.toRequestBody
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.feature.retrofit.WGameCPMApiService
|
||||
import io.reactivex.Single
|
||||
|
||||
class WGameSubjectCPMRemoteDataSource(
|
||||
private val api: WGameCPMApiService = RetrofitManager.getInstance().wGameCPMApi
|
||||
) {
|
||||
|
||||
fun getRecommendCPMList(page: Int, pageSize: Int = 20): Single<MutableList<GameEntity>> {
|
||||
val meta = MetaUtil.getMeta()
|
||||
val request = mapOf(
|
||||
"head" to mapOf(
|
||||
"busiAppid" to Config.WGAME_CPM_BUSIAPPID,
|
||||
"oaid" to (meta.oaid ?: ""),
|
||||
"manufacturer" to (meta.manufacturer ?: ""),
|
||||
"mode" to (meta.model ?: ""),
|
||||
"androidId" to (MetaUtil.getAndroidId()),
|
||||
"imei" to (MetaUtil.getIMEI())
|
||||
),
|
||||
"body" to mapOf(
|
||||
"page" to page - 1,
|
||||
"pageSize" to pageSize,
|
||||
)
|
||||
)
|
||||
return api.getUserRecommendList(request.toRequestBody())
|
||||
.map {
|
||||
if (it.ret == 0) {
|
||||
it.appInfoList.map { info ->
|
||||
GameEntity(
|
||||
mName = info.appName,
|
||||
mIcon = info.logo,
|
||||
mBrief = info.briefIntro,
|
||||
miniGameUid = info.appID,
|
||||
miniGameAppId = info.userName,
|
||||
miniGameType = Constants.WECHAT_MINI_GAME_CPM,
|
||||
miniGameAppStatus = 2,
|
||||
miniGameAppPath = info.wechatAppPath,
|
||||
miniGameExtData = info.extData,
|
||||
miniGameRecommendId = info.recommendID,
|
||||
mTagStyle = arrayListOf(
|
||||
TagStyleEntity(name = info.categoryName),
|
||||
TagStyleEntity(name = info.subcategoryName)
|
||||
)
|
||||
)
|
||||
}.toMutableList()
|
||||
} else {
|
||||
mutableListOf()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package com.gh.gamecenter.minigame.wechat
|
||||
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.gh.gamecenter.subject.ISubjectRepository
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.ResponseBody
|
||||
|
||||
class WGameSubjectCPMRepository : ISubjectRepository {
|
||||
override fun getColumnSettings(column_id: String?): Observable<SubjectSettingEntity> {
|
||||
return Observable.just(SubjectSettingEntity())
|
||||
}
|
||||
|
||||
override fun getSubjectName(column_id: String?): Observable<ResponseBody> {
|
||||
return Observable.just(ResponseBody.create(MediaType.parse("application/json"), "{\"name\": \"专题\"}"))
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,8 @@ object PackageRepository {
|
||||
packageKey = packageFilterManager.packageKey,
|
||||
filteredList = filteredList,
|
||||
isVGame = false,
|
||||
updateInstallStatus = true
|
||||
updateInstallStatus = true,
|
||||
fromInit = true
|
||||
)
|
||||
}
|
||||
},
|
||||
@ -256,13 +257,15 @@ object PackageRepository {
|
||||
* @param onWorkerThreadOnly 是否在工作线程执行
|
||||
* @param isVGame 包名列表是否为畅玩游戏
|
||||
* @param updateInstallStatus 更新安装状态 (通过 EventBus 来进行)
|
||||
* @param fromInit 是否来自数据首次初始化
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun loadInstalledGameDigestAndNotifyData(
|
||||
packageKey: String,
|
||||
filteredList: ArrayList<String>,
|
||||
isVGame: Boolean = false,
|
||||
updateInstallStatus: Boolean = false
|
||||
updateInstallStatus: Boolean = false,
|
||||
fromInit: Boolean = false
|
||||
) {
|
||||
var isNotifyUpdate = false
|
||||
val maxPageCount = (filteredList.size / PAGE_SIZE) + 1
|
||||
@ -291,7 +294,7 @@ object PackageRepository {
|
||||
|
||||
for (game in validGames) {
|
||||
val shouldNotifyChanges =
|
||||
validateGameAndPostChanges(gh_id, game, pkgName, isVGame, updateInstallStatus)
|
||||
validateGameAndPostChanges(gh_id, game, pkgName, isVGame, updateInstallStatus, fromInit)
|
||||
if (!isNotifyUpdate && shouldNotifyChanges) {
|
||||
isNotifyUpdate = true
|
||||
}
|
||||
@ -317,7 +320,8 @@ object PackageRepository {
|
||||
game: GameEntity,
|
||||
pkgName: String,
|
||||
isVGame: Boolean,
|
||||
updateInstallStatus: Boolean
|
||||
updateInstallStatus: Boolean,
|
||||
fromInit: Boolean = false
|
||||
): Boolean {
|
||||
if (ghId == null || ghId == game.id) {
|
||||
gameInstalled.add(GameInstall.transformGameInstall(game, pkgName, isVGame))
|
||||
@ -328,7 +332,7 @@ object PackageRepository {
|
||||
|
||||
if (updateInstallStatus) {
|
||||
EventBus.getDefault()
|
||||
.post(EBPackage(EBPackage.TYPE_INSTALLED, pkgName, game.getApk().firstOrNull()?.version))
|
||||
.post(EBPackage(EBPackage.TYPE_INSTALLED, pkgName, game.getApk().firstOrNull()?.version, fromInit))
|
||||
}
|
||||
|
||||
if (isCanUpdate || isCanPluggable) {
|
||||
|
||||
@ -40,7 +40,7 @@ class GameDefaultAdapter(
|
||||
val intent = Intent()
|
||||
intent.putExtra(
|
||||
GameEntity::class.java.simpleName,
|
||||
GameEntity(_id = entity.gameId, mIcon = entity.gameIcon, mName = entity.gameName, mCategory = entity.category)
|
||||
GameEntity(id = entity.gameId, mIcon = entity.gameIcon, mName = entity.gameName, mCategory = entity.category)
|
||||
)
|
||||
(mContext as Activity).setResult(Activity.RESULT_OK, intent)
|
||||
(mContext as Activity).finish()
|
||||
|
||||
@ -72,7 +72,7 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
PackageHelper.refreshLocalPackageList();
|
||||
|
||||
String versionName = PackageUtils.getVersionNameByPackageName(packageName);
|
||||
EBPackage installEb = new EBPackage(EBPackage.TYPE_INSTALLED, packageName, versionName);
|
||||
EBPackage installEb = new EBPackage(EBPackage.TYPE_INSTALLED, packageName, versionName, false);
|
||||
if (PackageUtils.isAppOnForeground(context)) {
|
||||
PackageObserver.onPackageChanged(installEb, null);
|
||||
EventBus.getDefault().post(installEb);
|
||||
@ -102,7 +102,7 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
InstallUtils.getInstance().removeUninstall(packageName);
|
||||
PackageHelper.refreshLocalPackageList();
|
||||
|
||||
EBPackage uninstallEb = new EBPackage(EBPackage.TYPE_UNINSTALLED, packageName, "");
|
||||
EBPackage uninstallEb = new EBPackage(EBPackage.TYPE_UNINSTALLED, packageName, "", false);
|
||||
PackageObserver.onPackageChanged(uninstallEb, null);
|
||||
EventBus.getDefault().post(uninstallEb);
|
||||
if (webviewPackageName.equals(packageName)) {
|
||||
@ -118,7 +118,7 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
Utils.log(TAG, "替换了:" + packageName + "包名的程序");
|
||||
String versionName = PackageUtils.getVersionNameByPackageName(packageName);
|
||||
|
||||
EBPackage updateEb = new EBPackage(EBPackage.TYPE_REPLACED, packageName, versionName);
|
||||
EBPackage updateEb = new EBPackage(EBPackage.TYPE_REPLACED, packageName, versionName, false);
|
||||
EventBus.getDefault().post(updateEb);
|
||||
PackageObserver.onPackageChanged(updateEb, null);
|
||||
if (webviewPackageName.equals(packageName)) {
|
||||
|
||||
@ -4,7 +4,6 @@ import android.content.Context;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.common.retrofit.BaseRetrofitManager;
|
||||
import com.gh.gamecenter.feature.retrofit.WGameCPMApiService;
|
||||
import com.gh.gamecenter.retrofit.service.ApiService;
|
||||
import com.gh.gamecenter.retrofit.service.VApiService;
|
||||
import com.halo.assistant.HaloApp;
|
||||
@ -21,7 +20,6 @@ public class RetrofitManager extends BaseRetrofitManager {
|
||||
private final ApiService mNewApiService;
|
||||
private final ApiService mUploadApiService;
|
||||
private final VApiService mVApiService;
|
||||
private final WGameCPMApiService mWGameCPMApiService;
|
||||
|
||||
private RetrofitManager() {
|
||||
Context context = HaloApp.getInstance().getApplicationContext();
|
||||
@ -29,8 +27,7 @@ public class RetrofitManager extends BaseRetrofitManager {
|
||||
mApiService = provideService(okHttpNormalConfig, Config.API_HOST, ApiService.class);
|
||||
mNewApiService = provideService(okHttpNormalConfig, Config.NEW_API_HOST, ApiService.class);
|
||||
mUploadApiService = provideService(getOkHttpConfig(context, UPLOAD_CALL_TIME_OUT, 1), Config.API_HOST, ApiService.class);
|
||||
mVApiService = provideService(okHttpNormalConfig, Config.VAPI_HOST, VApiService.class);
|
||||
mWGameCPMApiService = provideService(okHttpNormalConfig, Config.WGAME_CPM_API_HOST, WGameCPMApiService.class);
|
||||
mVApiService = provideService(okHttpNormalConfig, Config.VAPI_HOST, VApiService.class);;
|
||||
}
|
||||
|
||||
public static RetrofitManager getInstance() {
|
||||
@ -53,10 +50,6 @@ public class RetrofitManager extends BaseRetrofitManager {
|
||||
return mVApiService;
|
||||
}
|
||||
|
||||
public WGameCPMApiService getWGameCPMApi() {
|
||||
return mWGameCPMApiService;
|
||||
}
|
||||
|
||||
private static class SingletonHolder {
|
||||
private static final RetrofitManager INSTANCE = new RetrofitManager();
|
||||
}
|
||||
|
||||
@ -3153,7 +3153,7 @@ public interface ApiService {
|
||||
/**
|
||||
* QQ小游戏-专题-换一换
|
||||
*/
|
||||
@GET("games/qq_mini/columns/{column_id}/games?page=2&page_size=30")
|
||||
@GET("games/qq_mini/columns/{column_id}/games?page=1&page_size=30")
|
||||
Observable<List<GameEntity>> getSubjectQGame(@Path("column_id") String columnId);
|
||||
|
||||
/**
|
||||
@ -3186,7 +3186,7 @@ public interface ApiService {
|
||||
/**
|
||||
* 微信小游戏-专题-换一换
|
||||
*/
|
||||
@GET("wechat_game/columns/{column_id}/games?page=2&page_size=30")
|
||||
@GET("wechat_game/columns/{column_id}/games?page=1&page_size=30")
|
||||
Observable<List<GameEntity>> getSubjectWGame(@Path("column_id") String columnId);
|
||||
|
||||
/**
|
||||
|
||||
@ -3,12 +3,9 @@ package com.gh.gamecenter.search
|
||||
import com.gh.gamecenter.entity.SearchSubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
|
||||
interface ISearchGameResultRepository {
|
||||
fun getSearchGame(key: String?, page: Int): Observable<List<GameEntity>>
|
||||
|
||||
fun getSearchSubject(key: String?, page: Int): Observable<List<SearchSubjectEntity>>
|
||||
|
||||
fun getWGameCPMGameList(): Single<MutableList<GameEntity>>
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
package com.gh.gamecenter.search
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Shader
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
@ -15,6 +18,7 @@ import androidx.viewpager.widget.PagerAdapter
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
@ -31,7 +35,7 @@ import com.gh.gamecenter.databinding.TabItemSearchDefaultRankBinding
|
||||
import com.gh.gamecenter.db.ISearchHistoryDao
|
||||
import com.gh.gamecenter.db.SearchHistoryDao
|
||||
import com.gh.gamecenter.eventbus.EBSearch
|
||||
import com.gh.gamecenter.feature.entity.DiscoveryTagEntity
|
||||
import com.gh.gamecenter.feature.entity.HotTagEntity
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
@ -43,7 +47,7 @@ import org.json.JSONObject
|
||||
|
||||
open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private var mSearchDiscoveryTagList: List<DiscoveryTagEntity>? = null
|
||||
private var mHotTagList: List<HotTagEntity>? = null
|
||||
protected var mRankList: List<SettingsEntity.Search.RankList>? = null
|
||||
|
||||
protected lateinit var mBinding: FragmentSearchDefaultBinding
|
||||
@ -62,28 +66,28 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private val mDao by lazy { provideDao() }
|
||||
|
||||
private val mSearchDiscoveryTagClickListener: (Int) -> Unit = {
|
||||
val tag = mSearchDiscoveryTagList!![it]
|
||||
val keyword = tag.keyword
|
||||
if (keyword.isNotEmpty()) {
|
||||
PageSwitchDataHelper.pushCurrentPageData(
|
||||
hashMapOf(
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "游戏搜索-搜索发现"),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_ID, tag.id ?: ""),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, tag.text ?: " ")
|
||||
)
|
||||
private val mHotTagClickListener: (Int) -> Unit = {
|
||||
val tag = mHotTagList!![it]
|
||||
NewFlatLogUtils.logSearchHotTagClick(
|
||||
tag.name ?: "",
|
||||
tag.type ?: "",
|
||||
tag.link ?: "",
|
||||
tag.text ?: ""
|
||||
)
|
||||
DataLogUtils.uploadHotTagLog(context, tag.name)
|
||||
PageSwitchDataHelper.pushCurrentPageData(
|
||||
hashMapOf(
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "游戏搜索-热门标签"),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_ID, tag.id ?: ""),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, tag.name ?: " ")
|
||||
)
|
||||
SensorsBridge.trackEvent("SearchLabelClick", "label_name", tag.text ?: "", "label_id", tag.id ?: "")
|
||||
SensorsBridge.trackSearchDiscoveryClick(
|
||||
labelName = tag.text ?: "",
|
||||
labelId = tag.id ?: "",
|
||||
searchContent = keyword,
|
||||
position = it
|
||||
)
|
||||
mViewModel?.add(keyword)
|
||||
EventBus.getDefault().post(EBSearch("history", keyword))
|
||||
Util_System_Keyboard.hideSoftKeyboardByIBinder(context, mBinding.historyFlex.windowToken)
|
||||
}
|
||||
)
|
||||
SensorsBridge.trackEvent("SearchLabelClick", "label_name", tag.name ?: "", "label_id", tag.id ?: "")
|
||||
val exposureEvent = ExposureEvent.createEvent(
|
||||
null,
|
||||
source = listOf(ExposureSource("首页搜索", ""), ExposureSource("热门标签", tag.name ?: ""))
|
||||
)
|
||||
DirectUtils.directToLinkPage(requireContext(), tag, "(搜索-${tag.name})", "", exposureEvent) // 不需要path
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@ -136,20 +140,16 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
}
|
||||
mViewModel?.isExistRankList = mRankList?.isNotEmpty() == true
|
||||
|
||||
mSearchDiscoveryTagList = Config.getSettings()?.search?.discoveryTag
|
||||
mViewModel?.isExistSearchDiscoveryTag = mSearchDiscoveryTagList?.isNotEmpty() == true
|
||||
mHotTagList = Config.getSettings()?.search?.hotTag
|
||||
mViewModel?.isExistHotTag = mHotTagList?.isNotEmpty() == true
|
||||
|
||||
updateHistorySearchView(null)
|
||||
mViewModel?.historySearchLiveData?.observe(viewLifecycleOwner) {
|
||||
updateHistorySearchView(it)
|
||||
}
|
||||
|
||||
mBinding.searchDiscoveryTagFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
createFlexContent(
|
||||
mBinding.searchDiscoveryTagFlex,
|
||||
getTagListString(),
|
||||
clickListener = mSearchDiscoveryTagClickListener
|
||||
)
|
||||
mBinding.hotTagFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
createFlexContent(mBinding.hotTagFlex, getTagListString(), true, clickListener = mHotTagClickListener)
|
||||
initHeadView()
|
||||
initRankViewPager()
|
||||
}
|
||||
@ -178,12 +178,12 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
})
|
||||
}
|
||||
}
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.text = getString(R.string.search_hot)
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.searchDiscoveryHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.searchDiscoveryTagHeadContainer.headTitle.text = getString(R.string.search_discovery_tag)
|
||||
mBinding.searchDiscoveryTagHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.searchDiscoveryTagHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.hotHeadContainer.headTitle.text = getString(R.string.search_hot)
|
||||
mBinding.hotHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.hotTagHeadContainer.headTitle.text = getString(R.string.search_hot_tag)
|
||||
mBinding.hotTagHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotTagHeadContainer.headActionTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
protected open fun initRankViewPager() {
|
||||
@ -318,8 +318,8 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
mBinding.historyHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE
|
||||
mBinding.historyFlex.visibility = if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryTagHeadContainer.root.layoutParams =
|
||||
(mBinding.searchDiscoveryTagHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
mBinding.hotTagHeadContainer.root.layoutParams =
|
||||
(mBinding.hotTagHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (mViewModel?.isExistHistory == true) 16F.dip2px() else 0,
|
||||
@ -327,22 +327,21 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
0
|
||||
)
|
||||
}
|
||||
mBinding.searchDiscoveryHeadContainer.root.layoutParams =
|
||||
(mBinding.searchDiscoveryHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
mBinding.hotHeadContainer.root.layoutParams =
|
||||
(mBinding.hotHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (mViewModel?.isExistHistory == false && mViewModel?.isExistSearchDiscoveryTag == false) 16F.dip2px() else 0,
|
||||
if (mViewModel?.isExistHistory == false && mViewModel?.isExistHotTag == false) 16F.dip2px() else 0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
mBinding.searchDiscoveryTagHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistSearchDiscoveryTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryTagFlex.visibility =
|
||||
if (mViewModel?.isExistSearchDiscoveryTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryHeadContainer.root.visibility =
|
||||
mBinding.hotTagHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotTagFlex.visibility = if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryList.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotList.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.rankTabLayout.visibility = if (mViewModel?.isExistRankList == true) View.VISIBLE else View.GONE
|
||||
mBinding.rankTabIndicator.visibility = if (mViewModel?.isExistRankList == true) View.VISIBLE else View.GONE
|
||||
mBinding.rankViewPager.visibility = if (mViewModel?.isExistRankList == true) View.VISIBLE else View.GONE
|
||||
@ -364,9 +363,9 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private fun getTagListString(): List<String> {
|
||||
val list = ArrayList<String>()
|
||||
if (mSearchDiscoveryTagList != null) {
|
||||
for (entity in mSearchDiscoveryTagList!!) {
|
||||
entity.text?.let { list.add(it) }
|
||||
if (mHotTagList != null) {
|
||||
for (entity in mHotTagList!!) {
|
||||
entity.name?.let { list.add(it) }
|
||||
}
|
||||
}
|
||||
return list
|
||||
@ -375,6 +374,7 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
fun createFlexContent(
|
||||
flexView: FlexboxLayout,
|
||||
contentList: List<String>?,
|
||||
isHotTag: Boolean = false,
|
||||
clickListener: (Int) -> Unit
|
||||
) {
|
||||
|
||||
@ -388,12 +388,16 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
val params = FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 24F.dip2px())
|
||||
flexCell.layoutParams = params
|
||||
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(contentList[index], 6)
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
if (isHotTag && !mHotTagList.isNullOrEmpty() && mHotTagList!![index].isGuessSearch) {
|
||||
createSmartHotTagStyle(flexCell, contentList[index])
|
||||
} else {
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(contentList[index], 6)
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
}
|
||||
flexCell.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0)
|
||||
flexCell.background = if (mIsDarkModeOn) GradientDrawable().apply {
|
||||
setStroke(0.5F.dip2px(), Color.parseColor("#21FFFFFF"))
|
||||
@ -405,6 +409,30 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSmartHotTagStyle(flexCell: TextView, name: String) {
|
||||
flexCell.setDrawableStart(R.drawable.ic_smart_search)
|
||||
flexCell.compoundDrawablePadding = 4F.dip2px()
|
||||
flexCell.gravity = Gravity.CENTER_VERTICAL
|
||||
flexCell.typeface = Typeface.DEFAULT_BOLD
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(name, 6)
|
||||
flexCell.setTextColor(Color.WHITE)
|
||||
val colors =
|
||||
intArrayOf(com.gh.gamecenter.common.R.color.text_FFB749.toColor(requireContext()), com.gh.gamecenter.common.R.color.text_FF6D3C.toColor(requireContext()))
|
||||
val position = floatArrayOf(0F, 1F)
|
||||
val linearGradient = LinearGradient(
|
||||
0F,
|
||||
0F,
|
||||
flexCell.paint.textSize * flexCell.text.length,
|
||||
0F,
|
||||
colors,
|
||||
position,
|
||||
Shader.TileMode.CLAMP
|
||||
)
|
||||
flexCell.paint.shader = linearGradient
|
||||
flexCell.invalidate()
|
||||
}
|
||||
|
||||
private fun postExposureEvent(index: Int) {
|
||||
mRankList?.safelyGetInRelease(index)?.content?.forEach {
|
||||
if (it.link.type == "game") {
|
||||
@ -419,15 +447,11 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
super.onDarkModeChanged()
|
||||
initHeadView()
|
||||
mBinding.rootContainer.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(requireContext()))
|
||||
mBinding.searchDiscoveryList.adapter?.run {
|
||||
mBinding.hotList.adapter?.run {
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
mViewModel?.historySearchLiveData?.value?.let { updateHistorySearchView(it) }
|
||||
createFlexContent(
|
||||
mBinding.searchDiscoveryTagFlex,
|
||||
getTagListString(),
|
||||
clickListener = mSearchDiscoveryTagClickListener
|
||||
)
|
||||
createFlexContent(mBinding.hotTagFlex, getTagListString(), true, clickListener = mHotTagClickListener)
|
||||
}
|
||||
|
||||
protected open fun provideDao(): ISearchHistoryDao =
|
||||
|
||||
@ -11,7 +11,7 @@ class SearchDefaultViewModel(private val dao: ISearchHistoryDao) : ViewModel() {
|
||||
it
|
||||
}
|
||||
var isExistHotSearch: Boolean = false
|
||||
var isExistSearchDiscoveryTag: Boolean = false
|
||||
var isExistHotTag: Boolean = false
|
||||
var isExistHistory: Boolean = false
|
||||
var isExistRankList: Boolean = false
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ class SearchGameIndexFragment : ListFragment<GameEntity, SearchGameResultViewMod
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ import com.gh.gamecenter.common.view.DrawableView
|
||||
import com.gh.gamecenter.databinding.SearchGameIndexItemBinding
|
||||
import com.gh.gamecenter.databinding.SearchSubjectItemBinding
|
||||
import com.gh.gamecenter.db.ISearchHistoryDao
|
||||
import com.gh.gamecenter.entity.SubjectData
|
||||
import com.gh.gamecenter.feature.databinding.GameItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
@ -86,7 +85,7 @@ class SearchSubjectItemViewHolder(var binding: SearchSubjectItemBinding) : Recyc
|
||||
|
||||
binding.run {
|
||||
subjectRv.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||
subjectRv.adapter = SearchSubjectAdapter(context, entity.getFilterGame(), "($type-专题)", key) {
|
||||
subjectRv.adapter = SearchSubjectAdapter(context, entity.getFilterGame(), "($type-专题)") {
|
||||
dao?.add(key)
|
||||
if (itemData.adConfig != null) {
|
||||
NewFlatLogUtils.logClickGameAd(
|
||||
@ -120,17 +119,7 @@ class SearchSubjectItemViewHolder(var binding: SearchSubjectItemBinding) : Recyc
|
||||
headContainer.headActionTv.setOnClickListener {
|
||||
dao?.add(key)
|
||||
if (entity.columnId.isNotEmpty()) {
|
||||
DirectUtils.directToSubject(
|
||||
context,
|
||||
entity.columnId,
|
||||
entity.name,
|
||||
"($type-专题)",
|
||||
subjectType = if (entity.isWGameSubjectCPM) {
|
||||
SubjectData.SubjectType.WECHAT_GAME_CPM
|
||||
} else {
|
||||
SubjectData.SubjectType.NORMAL
|
||||
}
|
||||
)
|
||||
DirectUtils.directToSubject(context, entity.columnId, entity.name, "($type-专题)")
|
||||
} else if (entity.adId.isNotEmpty() && entity.codeId.isNotEmpty()) {
|
||||
SubjectActivity.startAdSubjectActivity(
|
||||
context,
|
||||
|
||||
@ -58,7 +58,7 @@ class SearchGameResultAdapter(
|
||||
private val dao: ISearchHistoryDao,
|
||||
val listViewModel: SearchGameResultViewModel,
|
||||
val entrance: String,
|
||||
val type: String,
|
||||
var type: String,
|
||||
val sourceEntrance: String
|
||||
) : ListAdapter<SearchItemData>(context), IExposable {
|
||||
|
||||
@ -752,7 +752,7 @@ class SearchGameResultAdapter(
|
||||
gameEntity.name ?: "",
|
||||
gameEntity.categoryChinese
|
||||
)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
MiniGameItemHelper.trackMiniGameClick(
|
||||
gameEntity = gameEntity,
|
||||
location = "小游戏搜索结果列表",
|
||||
|
||||
@ -376,6 +376,7 @@ open class SearchGameResultFragment : ListFragment<GameEntity, SearchGameResultV
|
||||
this.mKey = key
|
||||
this.mType = type
|
||||
mAdapter?.key = key
|
||||
mAdapter?.type = type
|
||||
mAdapter?.clearAdIdSet()
|
||||
mListViewModel?.updateSearchKeyWithType(key, type)
|
||||
mListViewModel?.clearSearchSubjects()
|
||||
@ -423,7 +424,7 @@ open class SearchGameResultFragment : ListFragment<GameEntity, SearchGameResultV
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,17 +4,14 @@ import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.entity.SearchSubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMRemoteDataSource
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.retrofit.service.ApiService
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import java.net.URLEncoder
|
||||
|
||||
class SearchGameResultRepository(
|
||||
private val mApi: ApiService = RetrofitManager.getInstance().api,
|
||||
private val mWGameSubjectCPMDataSource: WGameSubjectCPMRemoteDataSource = WGameSubjectCPMRemoteDataSource()
|
||||
private val mApi: ApiService = RetrofitManager.getInstance().api
|
||||
) : ISearchGameResultRepository {
|
||||
|
||||
override fun getSearchGame(
|
||||
@ -34,8 +31,4 @@ class SearchGameResultRepository(
|
||||
override fun getSearchSubject(key: String?, page: Int): Observable<List<SearchSubjectEntity>> {
|
||||
return mApi.getSearchSubject(key, page)
|
||||
}
|
||||
|
||||
override fun getWGameCPMGameList(): Single<MutableList<GameEntity>> {
|
||||
return mWGameSubjectCPMDataSource.getRecommendCPMList(1)
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,6 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import com.gh.ad.AdDelegateHelper
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.util.PackageHelper
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.baselist.ListViewModel
|
||||
import com.gh.gamecenter.common.baselist.LoadParams
|
||||
@ -23,6 +22,7 @@ import com.gh.gamecenter.entity.SearchSubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.minigame.MiniGameSearchResultRepository
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@ -58,6 +58,10 @@ class SearchGameResultViewModel(
|
||||
mSearchSubjects.clear()
|
||||
}
|
||||
|
||||
override fun loadData() {
|
||||
super.loadData()
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
mResultLiveData.addSource(mListLiveData) { list ->
|
||||
mGameEntityList = ArrayList(list)
|
||||
@ -76,40 +80,31 @@ class SearchGameResultViewModel(
|
||||
refreshWrongInstallStatus()
|
||||
|
||||
repository.getSearchSubject(mSearchKey, mPage)
|
||||
.map { dataList ->
|
||||
mSearchSubjects.addAll(dataList)
|
||||
var cpmSearchSubject: SearchSubjectEntity? = null
|
||||
mSearchSubjects.forEach {
|
||||
// 微信小游戏CPM专题需要等搜索广告位插入完成后再插入
|
||||
if (it.location == WGAME_CPM_SUBJECT_POSITION) {
|
||||
cpmSearchSubject = it.apply { isWGameSubjectCPM = true }
|
||||
} else {
|
||||
val item = SearchItemData(subject = it)
|
||||
if (it.location <= 0 || it.location > itemDataList.size) {
|
||||
itemDataList.add(item)
|
||||
} else {
|
||||
itemDataList.add(it.location - 1, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
cpmSearchSubject to dataList
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ result ->
|
||||
.subscribe({ mutableList ->
|
||||
mSearchSubjects.addAll(mutableList)
|
||||
mSearchSubjects.forEach {
|
||||
val item = SearchItemData(subject = it)
|
||||
if (it.location <= 0 || it.location > itemDataList.size) {
|
||||
itemDataList.add(item)
|
||||
} else {
|
||||
itemDataList.add(it.location - 1, item)
|
||||
}
|
||||
}
|
||||
// 处理初始化列表且游戏列表size为0的情况
|
||||
handleLoadStatusWhenGameListIsEmpty(list, itemDataList)
|
||||
|
||||
if (mIsManuallySearch) {
|
||||
if (mSearchKey == AdDelegateHelper.gameSearchKeyword) {
|
||||
updateAdConfigAndDecorateList(itemDataList, list, result.first)
|
||||
updateAdConfigAndDecorateList(itemDataList, list)
|
||||
} else {
|
||||
AdDelegateHelper.requestAdConfig(false, mSearchKey ?: "") {
|
||||
updateAdConfigAndDecorateList(itemDataList, list, result.first)
|
||||
updateAdConfigAndDecorateList(itemDataList, list)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
decorateWithWGameSubjectCPM(itemDataList, list, result.first)
|
||||
postResultList(itemDataList, list)
|
||||
}
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
@ -119,11 +114,7 @@ class SearchGameResultViewModel(
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun updateAdConfigAndDecorateList(
|
||||
itemDataList: ArrayList<SearchItemData>,
|
||||
list: MutableList<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
) {
|
||||
private fun updateAdConfigAndDecorateList(itemDataList: ArrayList<SearchItemData>, list: MutableList<GameEntity>) {
|
||||
mGameSearchAdList =
|
||||
AdDelegateHelper.getGameSearchAdList().filter { AdDelegateHelper.shouldShowGameSearchAd(it) }.toArrayList()
|
||||
.apply { sortBy { it.position } }
|
||||
@ -175,18 +166,18 @@ class SearchGameResultViewModel(
|
||||
Single.zip(requestSingleList) {}
|
||||
.compose(singleToMain())
|
||||
.subscribe({
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list, cpmSubjectEntity)
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list)
|
||||
}, {
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list, cpmSubjectEntity)
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list)
|
||||
})
|
||||
} else {
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list, cpmSubjectEntity)
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list)
|
||||
}
|
||||
} else {
|
||||
decorateListWithThirdPartyAdOnly(decoratedItemDataList, thirdPartyAdList, list, cpmSubjectEntity)
|
||||
decorateListWithThirdPartyAdOnly(decoratedItemDataList, thirdPartyAdList, list)
|
||||
}
|
||||
} else {
|
||||
decorateWithWGameSubjectCPM(itemDataList, list, cpmSubjectEntity)
|
||||
postResultList(itemDataList, list)
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,21 +190,19 @@ class SearchGameResultViewModel(
|
||||
private fun decorateListWithThirdPartyAdOnly(
|
||||
decoratedItemDataList: ArrayList<SearchItemData>,
|
||||
thirdPartyAdList: List<AdConfig>,
|
||||
list: List<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
list: List<GameEntity>
|
||||
) {
|
||||
thirdPartyAdList.forEach {
|
||||
decoratedItemDataList.add(it.position - 1, SearchItemData(ad = it.thirdPartyAd, adConfig = it))
|
||||
SPUtils.setLong(Constants.SP_LAST_GAME_SEARCH_AD_SHOW_TIME + it.position, System.currentTimeMillis())
|
||||
}
|
||||
decorateWithWGameSubjectCPM(decoratedItemDataList, list, cpmSubjectEntity)
|
||||
postResultList(decoratedItemDataList, list)
|
||||
}
|
||||
|
||||
private fun decorateListWithAd(
|
||||
itemDataList: ArrayList<SearchItemData>,
|
||||
decoratedItemDataList: ArrayList<SearchItemData>,
|
||||
list: List<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
list: List<GameEntity>
|
||||
) {
|
||||
val adGameOneIdSet = HashSet<String>() // 展示样式为单个游戏时记录游戏ID,避免重复
|
||||
for ((index, position) in mAdPositionSet!!.withIndex()) {
|
||||
@ -281,41 +270,7 @@ class SearchGameResultViewModel(
|
||||
break
|
||||
}
|
||||
}
|
||||
decorateWithWGameSubjectCPM(decoratedItemDataList, list, cpmSubjectEntity)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun decorateWithWGameSubjectCPM(
|
||||
resultList: ArrayList<SearchItemData>,
|
||||
list: List<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
) {
|
||||
// 微信小游戏CPM专题搜索结果存在,则请求CPM接口获取微信小游戏列表数据,并将列表数据插入缓存的CPM专题中,
|
||||
// 再根据location的值(固定为4)将CPM专题插入搜索结果列表中
|
||||
// 相关需求:https://jira.shanqu.cc/browse/GHZSCY-6710
|
||||
cpmSubjectEntity?.let { subject ->
|
||||
if (subject.games.isNotEmpty()) {
|
||||
Single.just(subject.games.toMutableList())
|
||||
} else {
|
||||
repository.getWGameCPMGameList()
|
||||
.onErrorReturnItem(mutableListOf())
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
val cpmSearchItemData = SearchItemData(subject = subject.apply { games = it })
|
||||
if (subject.location <= 0 || subject.location > resultList.size) {
|
||||
resultList.add(cpmSearchItemData)
|
||||
} else {
|
||||
resultList.add(subject.location - 1, cpmSearchItemData)
|
||||
}
|
||||
postResultList(resultList, list)
|
||||
},
|
||||
{
|
||||
postResultList(resultList, list)
|
||||
})
|
||||
} ?: postResultList(resultList, list)
|
||||
postResultList(decoratedItemDataList, list)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@ -431,7 +386,6 @@ class SearchGameResultViewModel(
|
||||
|
||||
companion object {
|
||||
const val AD_SUBJECT_GAME_MAX_COUNT = 8
|
||||
const val WGAME_CPM_SUBJECT_POSITION = 4
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,7 +6,6 @@ import com.gh.gamecenter.GameDetailActivity
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||
import com.gh.gamecenter.game.horizontal.GameHorizontalSimpleItemViewHolder
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
|
||||
@ -14,7 +13,6 @@ class SearchSubjectAdapter(
|
||||
context: Context,
|
||||
private val mList: List<GameEntity>,
|
||||
private val mEntrance: String,
|
||||
private val mKey: String,
|
||||
private val clickCallback: ((GameEntity) -> Unit)
|
||||
) : BaseRecyclerAdapter<GameHorizontalSimpleItemViewHolder>(context) {
|
||||
|
||||
@ -36,16 +34,7 @@ class SearchSubjectAdapter(
|
||||
GameHorizontalSimpleItemViewHolder.setHorizontalNameAndGravity(gameName, gameEntity.name)
|
||||
root.setOnClickListener {
|
||||
clickCallback.invoke(gameEntity)
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.trackMiniGameClick(
|
||||
gameEntity = gameEntity,
|
||||
location = "小游戏搜索结果列表",
|
||||
searchContent = mKey,
|
||||
)
|
||||
} else {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, gameEntity.id, mEntrance, gameEntity.exposureEvent)
|
||||
}
|
||||
GameDetailActivity.startGameDetailActivity(mContext, gameEntity.id, mEntrance, gameEntity.exposureEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package com.gh.gamecenter.search.viewmodel
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
||||
class SearchTabViewModel : ViewModel() {
|
||||
|
||||
@ -21,7 +21,8 @@ class SearchTabViewModel : ViewModel() {
|
||||
GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
location,
|
||||
searchKeyAndType.value?.first ?: "",
|
||||
searchKeyAndType.value?.second ?: "",
|
||||
searchKeyAndType.value?.let {
|
||||
SearchActivity.toTrackSearchType(it.second) } ?: "",
|
||||
text ?: "",
|
||||
position
|
||||
)
|
||||
|
||||
@ -228,7 +228,7 @@ class SubjectAdapter(
|
||||
DataCollectionUtils.uploadClick(mContext, "列表", subjectData.subjectName, gameEntity.name)
|
||||
|
||||
if (gameEntity.isMiniGame()) {
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
|
||||
val pageLocation = mViewModel.pageLocation
|
||||
MiniGameItemHelper.trackMiniGameClick(
|
||||
gameEntity = gameEntity,
|
||||
|
||||
@ -207,7 +207,7 @@ open class SubjectListFragment : LazyListFragment<GameEntity, SubjectListViewMod
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,6 @@ package com.gh.gamecenter.subject
|
||||
import com.gh.gamecenter.entity.SubjectData
|
||||
import com.gh.gamecenter.minigame.qq.QGameSubjectListRepository
|
||||
import com.gh.gamecenter.minigame.qq.QGameSubjectRepository
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMListRepository
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectCPMRepository
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectListRepository
|
||||
import com.gh.gamecenter.minigame.wechat.WGameSubjectRepository
|
||||
|
||||
@ -12,14 +10,12 @@ object SubjectRepositoryFactory {
|
||||
fun createRepo(subjectType: SubjectData.SubjectType): ISubjectRepository = when(subjectType) {
|
||||
SubjectData.SubjectType.QQ_GAME -> QGameSubjectRepository()
|
||||
SubjectData.SubjectType.WECHAT_GAME -> WGameSubjectRepository()
|
||||
SubjectData.SubjectType.WECHAT_GAME_CPM -> WGameSubjectCPMRepository()
|
||||
else -> SubjectRepository()
|
||||
}
|
||||
|
||||
fun createListRepo(subjectType: SubjectData.SubjectType): ISubjectListRepository = when(subjectType) {
|
||||
SubjectData.SubjectType.QQ_GAME -> QGameSubjectListRepository()
|
||||
SubjectData.SubjectType.WECHAT_GAME -> WGameSubjectListRepository()
|
||||
SubjectData.SubjectType.WECHAT_GAME_CPM -> WGameSubjectCPMListRepository()
|
||||
else -> SubjectListRepository()
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ class TagsListFragment : ListFragment<GameEntity, TagsListViewModel>() {
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,9 @@ import com.gh.gamecenter.entity.DiverterEntity
|
||||
import com.gh.gamecenter.entity.MultiTabNav
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
@ -59,10 +62,13 @@ class MainWrapperRepository {
|
||||
private val mTabSelectEventFlow = MutableSharedFlow<MainSelectedEvent>()
|
||||
val tabSelectEventFlow = mTabSelectEventFlow as SharedFlow<MainSelectedEvent>
|
||||
|
||||
private var mDisposable: Disposable? = null
|
||||
private var mCheckGidCount = 0
|
||||
|
||||
fun init() {
|
||||
// 若 timeout 后数据未加载完成,则即便还没有回调也使用默认数据生成底部 tab
|
||||
emitDefaultTabDataAfterTimeout()
|
||||
getBypassList()
|
||||
checkGidAndGetBypassList()
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,8 +155,33 @@ class MainWrapperRepository {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkGidAndGetBypassList() {
|
||||
if (HaloApp.getInstance().gid.isNullOrEmpty()) {
|
||||
stopCheckGid()
|
||||
mDisposable = Observable.interval(100, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.subscribe({
|
||||
mCheckGidCount++
|
||||
if (!HaloApp.getInstance().gid.isNullOrEmpty() || mCheckGidCount >= CHECK_GID_MAX_COUNT) {
|
||||
stopCheckGid()
|
||||
getBypassList()
|
||||
}
|
||||
}, {
|
||||
stopCheckGid()
|
||||
})
|
||||
} else {
|
||||
getBypassList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopCheckGid() {
|
||||
mDisposable?.dispose()
|
||||
mDisposable = null
|
||||
mCheckGidCount = 0
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getBypassList() {
|
||||
private fun getBypassList() {
|
||||
val isInstallFirstAccess = TimeUtils.isToday(SPUtils.getLong(Constants.SP_BRAND_NEW_FIRST_LAUNCH_TIME) / 1000).toString()
|
||||
mNewApi.getDiverterList(isInstallFirstAccess, BYPASS_TYPE_BOTTOM_TAB)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
@ -294,6 +325,7 @@ class MainWrapperRepository {
|
||||
|
||||
companion object : SingletonHolder<MainWrapperRepository>({ MainWrapperRepository() }) {
|
||||
private const val BYPASS_TIME_OUT = 1000L
|
||||
private const val CHECK_GID_MAX_COUNT = 5
|
||||
const val BYPASS_TYPE_BOTTOM_TAB = "bottom_tab"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.gh.ndownload.suspendwindow
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.app.Application.ActivityLifecycleCallbacks
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.core.view.ViewCompat
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
@ -128,7 +127,7 @@ class NDownloadDrawOverlayPermissionWindowController(val application: Applicatio
|
||||
SensorsBridge.trackDownloadSuspendedWindowGuideShow(
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name,
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.categoryChinese,
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载"
|
||||
|
||||
@ -48,10 +48,17 @@ abstract class NDownloadSuspendWindow<T : View>(
|
||||
|
||||
fun attach() {
|
||||
if (!isAttached) {
|
||||
_isAttached = true
|
||||
windowManager.addView(root, layoutParams)
|
||||
context.registerComponentCallbacks(this)
|
||||
onAttach()
|
||||
try {
|
||||
_isAttached = true
|
||||
windowManager.addView(root, layoutParams)
|
||||
context.registerComponentCallbacks(this)
|
||||
onAttach()
|
||||
} catch (e: Throwable) {
|
||||
// 处理“Unable to add window android.view.ViewRootImpl$W@7bc9502 -- permission denied for window type 2038”的异常
|
||||
// 目前Sentry上仅Z10型号的手机报这个错误(Android 8.1.0),这里明明已经授予了SYSTEM_ALERT_WINDOW权限,但是就是会抛异常= =,只能暴力捕获处理了。。。
|
||||
// 相关异常的链接:https://sentry.shanqu.cc/organizations/lightgame/issues/407275/?project=22
|
||||
_isAttached = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable-xxxhdpi/ic_smart_search.webp
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_smart_search.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@ -36,7 +36,7 @@
|
||||
</com.gh.gamecenter.common.view.LimitHeightLinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/searchDiscoveryTagHeadContainer"
|
||||
android:id="@+id/hotTagHeadContainer"
|
||||
layout="@layout/layout_subject_head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
@ -45,14 +45,14 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/history_flex_container" />
|
||||
|
||||
<com.gh.gamecenter.common.view.LimitHeightLinearLayout
|
||||
android:id="@+id/search_discovery_tag_flex_container"
|
||||
android:id="@+id/hot_tag_flex_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/ui_surface"
|
||||
app:layout_constraintTop_toBottomOf="@id/searchDiscoveryTagHeadContainer">
|
||||
app:layout_constraintTop_toBottomOf="@id/hotTagHeadContainer">
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:id="@+id/search_discovery_tag_flex"
|
||||
android:id="@+id/hot_tag_flex"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
@ -62,21 +62,21 @@
|
||||
</com.gh.gamecenter.common.view.LimitHeightLinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/searchDiscoveryHeadContainer"
|
||||
android:id="@+id/hotHeadContainer"
|
||||
layout="@layout/layout_subject_head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_discovery_tag_flex_container" />
|
||||
app:layout_constraintTop_toBottomOf="@id/hot_tag_flex_container" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/search_discovery_list"
|
||||
android:id="@+id/hot_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintTop_toBottomOf="@+id/searchDiscoveryHeadContainer" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/hotHeadContainer" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/rankTabLayout"
|
||||
@ -91,7 +91,7 @@
|
||||
app:tabMode="scrollable"
|
||||
app:tabIndicator="@null"
|
||||
app:tabRippleColor="@color/transparent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_discovery_list"
|
||||
app:layout_constraintTop_toBottomOf="@+id/hot_list"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<string name="download_startall">全部開始</string>
|
||||
<string name="search_searching">搜索中...</string>
|
||||
<string name="search_hot">熱門搜索</string>
|
||||
<string name="search_discovery_tag">搜索發現</string>
|
||||
<string name="search_hot_tag">熱門標簽</string>
|
||||
<string name="search_history">歷史搜索</string>
|
||||
<string name="news_concenrn_game_mine">我關註的遊戲</string>
|
||||
<string name="news_search_input">請輸入搜索關鍵字</string>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<string name="download_startall">全部开始</string>
|
||||
<string name="search_searching">搜索中...</string>
|
||||
<string name="search_hot">热门搜索</string>
|
||||
<string name="search_discovery_tag">搜索发现</string>
|
||||
<string name="search_hot_tag">热门标签</string>
|
||||
<string name="search_history">历史搜索</string>
|
||||
<string name="news_concenrn_game_mine">我关注的游戏</string>
|
||||
<string name="news_search_input">请输入搜索关键字</string>
|
||||
|
||||
@ -17,8 +17,8 @@ buildscript {
|
||||
password("u9gZYH4MQEwLLQZK")
|
||||
}
|
||||
}
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "https://maven.google.com" }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -41,7 +41,6 @@ allprojects {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central'}
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/releases/' }
|
||||
@ -55,6 +54,7 @@ allprojects {
|
||||
// 配置HMS Core SDK的Maven仓地址。
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
maven { url 'https://developer.hihonor.com/repo' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
task clean(type: Delete) {
|
||||
|
||||
@ -49,6 +49,7 @@ class GhTransform(var project: Project) : Transform() {
|
||||
mTransformHelper.addTransformer(RoomTransformer())
|
||||
mTransformHelper.addTransformer(ActivityTransformer())
|
||||
mTransformHelper.addTransformer(AppCompatEditTextTransformer())
|
||||
mTransformHelper.addTransformer(MiniGameWebViewTransformer())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.gh.gamecenter.plugin.transform
|
||||
|
||||
import javassist.ClassPool
|
||||
import javassist.CtClass
|
||||
import javassist.NotFoundException
|
||||
import javassist.bytecode.ClassFile
|
||||
import java.io.BufferedInputStream
|
||||
import java.io.DataInputStream
|
||||
import java.io.InputStream
|
||||
|
||||
class MiniGameWebViewTransformer : Transformer {
|
||||
|
||||
private val classPool = ClassPool.getDefault()
|
||||
|
||||
override fun getModifyClassName(): String {
|
||||
return "QUAUtil"
|
||||
}
|
||||
|
||||
override fun modifyClass(filePath: String, inputStream: InputStream): CtClass? {
|
||||
if (filePath.contains(getModifyClassName())) {
|
||||
|
||||
println("发现 QUAUtil")
|
||||
|
||||
val classFile = ClassFile(DataInputStream(BufferedInputStream(inputStream)))
|
||||
val ctClass = classPool.get(classFile.name)
|
||||
|
||||
if (ctClass.isFrozen) {
|
||||
ctClass.defrost()
|
||||
}
|
||||
|
||||
// 使用 try catch 包裹找到的第一个 getSystemUA 方法 (若能找到的话)
|
||||
try {
|
||||
val ctMethod = ctClass.getDeclaredMethod("getSystemUA")
|
||||
val body = "{ if (systemUA != null) { return systemUA; } systemUA = java.net.URLEncoder.encode(System.getProperty(\"http.agent\"), \"UTF-8\"); return systemUA; }"
|
||||
ctMethod.setBody(body)
|
||||
|
||||
println("修改 getSystemUA 方法")
|
||||
} catch (e: NotFoundException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
return ctClass
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,6 +18,7 @@ object NewLogUtils {
|
||||
private const val KEY_CONTENT_ID = "content_id"
|
||||
private const val KEY_CONTENT_TITLE = "content_title"
|
||||
private const val KEY_HELP_ID = "help_id"
|
||||
private const val KEY_QA_COLLECTION = "qa_collection"
|
||||
private const val KEY_SEARCH_KEY = "search_key"
|
||||
|
||||
private fun log(jsonObject: JSONObject, logStore: String = "event", uploadImmediately: Boolean = false) {
|
||||
@ -53,10 +54,11 @@ object NewLogUtils {
|
||||
}
|
||||
|
||||
//点击QA更多
|
||||
fun logClickQaMoreBtn(helpId: String) {
|
||||
fun logClickQaMoreBtn(helpId: String, qaCollection: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "qa_click_title_more"
|
||||
KEY_HELP_ID to helpId
|
||||
KEY_QA_COLLECTION to qaCollection
|
||||
KEY_META to LogUtils.getMetaObject()
|
||||
KEY_LAUNCH_ID to Tracker.launchId
|
||||
KEY_SESSION_ID to Tracker.sessionId
|
||||
|
||||
@ -209,9 +209,7 @@ class HelpAndFeedbackFragment : BaseLazyFragment() {
|
||||
mViewModel.selectedCategory.name == HelpAndFeedbackViewModel.MY_RELATED_QA_NAME
|
||||
)
|
||||
)
|
||||
if (mViewModel.selectedCategory.id.isNotEmpty()) {
|
||||
NewLogUtils.logClickQaMoreBtn(mViewModel.selectedCategory.id)
|
||||
}
|
||||
NewLogUtils.logClickQaMoreBtn(mViewModel.selectedCategory.id, mViewModel.selectedCategory.name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ class HelpContentAdapter(
|
||||
context: Context,
|
||||
private val mFragment: HelpContentFragment,
|
||||
private val mViewModel: NormalListViewModel<HelpEntity>,
|
||||
private val mQaId: String?,
|
||||
private val mIsFromHelpAndFeedback: Boolean,
|
||||
private val mQaCollectionId: String?,
|
||||
private val mNavigationTitle: String,
|
||||
private val searchType: String,
|
||||
@ -103,7 +103,7 @@ class HelpContentAdapter(
|
||||
)
|
||||
} else {
|
||||
NewLogUtils.logEnterQaContent(
|
||||
"其他位置",
|
||||
if (mIsFromHelpAndFeedback) "帮助与反馈" else "其他位置",
|
||||
entity.id,
|
||||
HtmlUtils.filterHtmlLabel(entity.title),
|
||||
entity.helpId,
|
||||
|
||||
@ -60,7 +60,7 @@ class HelpContentFragment : ListFragment<HelpEntity, NormalListViewModel<HelpEnt
|
||||
requireContext(),
|
||||
this,
|
||||
mListViewModel,
|
||||
mQaId,
|
||||
!mCategoryId.isNullOrEmpty() || mIsMyRelatedQA,
|
||||
mQaCollectionId,
|
||||
mNavigationTitle,
|
||||
mSearchType,
|
||||
|
||||
@ -61,7 +61,7 @@ class HelpQaCategoryAdapter(val context: Context, private val mQaCollectionId: S
|
||||
} else {
|
||||
MtaHelper.onEvent("意见反馈", "使用帮助点击", "点击更多+${helpCategoryEntity.name}")
|
||||
}
|
||||
NewLogUtils.logClickQaMoreBtn(helpCategoryEntity.id)
|
||||
NewLogUtils.logClickQaMoreBtn(helpCategoryEntity.id, helpCategoryEntity.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import cn.com.chinatelecom.account.api.CtAuth
|
||||
import cn.jiguang.verifysdk.api.*
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.databinding.SetWaitDialogBinding
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
@ -50,7 +49,6 @@ object LoginHelper {
|
||||
//请注意,这里有可能会出现内存泄漏,需要及时清理
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var backgroundView: View? = null
|
||||
private var loggingDialog: Dialog? = null
|
||||
private var cbPrivacy: CheckBox? = null
|
||||
|
||||
private var loginProvider: ILoginProvider? = null
|
||||
@ -85,20 +83,26 @@ object LoginHelper {
|
||||
fun loginAuth(context: Context, entrance: String, callback: (() -> Unit)?) {
|
||||
runOnUiThread {
|
||||
val dialogContext = DialogHelper.checkDialogContext(context)
|
||||
if (dialogContext is Activity && dialogContext.isFinishing) return@runOnUiThread
|
||||
preDialog = dialogContext?.let {
|
||||
Dialog(it, com.gh.gamecenter.common.R.style.DialogWindowTransparent).apply {
|
||||
val binding = SetWaitDialogBinding.inflate(LayoutInflater.from(dialogContext)).apply {
|
||||
setWaitMessage.text = "请求登录中"
|
||||
if (dialogContext is Activity && (dialogContext.isFinishing || dialogContext.isDestroyed)) return@runOnUiThread
|
||||
preDialog = try {
|
||||
dialogContext?.let {
|
||||
Dialog(it, com.gh.gamecenter.common.R.style.DialogWindowTransparent).apply {
|
||||
val binding = SetWaitDialogBinding.inflate(LayoutInflater.from(dialogContext)).apply {
|
||||
setWaitMessage.text = "请求登录中"
|
||||
}
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
setContentView(binding.root)
|
||||
setCanceledOnTouchOutside(false)
|
||||
show()
|
||||
}
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
setContentView(binding.root)
|
||||
setCanceledOnTouchOutside(false)
|
||||
show()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// no implement
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
isDarkMode = DarkModeUtils.isDarkModeOn(context)
|
||||
setUiConfig(context, callback)
|
||||
val settings = LoginSettings()
|
||||
@ -136,7 +140,6 @@ object LoginHelper {
|
||||
}
|
||||
|
||||
8 -> { // 点击了一键登录按钮
|
||||
showLoggingDialog()
|
||||
SensorsBridge.trackEvent("Login", "login_type", "一键登录")
|
||||
}
|
||||
}
|
||||
@ -156,7 +159,6 @@ object LoginHelper {
|
||||
}
|
||||
|
||||
LOGIN_AUTH_CODE_FAILURE -> {
|
||||
dismissDialog()
|
||||
getLoginProvider()?.startCodeLoginPageFromQuickLogin(openAuthPageSuccess, context, callback)
|
||||
}
|
||||
}
|
||||
@ -167,9 +169,6 @@ object LoginHelper {
|
||||
if (preDialog?.isShowing == true) {
|
||||
preDialog?.dismiss()
|
||||
}
|
||||
if (loggingDialog?.isShowing == true) {
|
||||
loggingDialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUiConfig(context: Context, callback: (() -> Unit)?) {
|
||||
@ -259,15 +258,6 @@ object LoginHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showLoggingDialog() {
|
||||
AppManager.getInstance().recentActiveActivity?.run {
|
||||
val dialogContext = com.gh.gamecenter.common.utils.DialogHelper.checkDialogContext(this)
|
||||
if (dialogContext == null || (dialogContext is Activity && dialogContext.isFinishing)) return
|
||||
loggingDialog = getLoginProvider()?.createLoggingDialog(dialogContext)
|
||||
loggingDialog?.show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showPrivacyCheckDialog(
|
||||
authContext: Context,
|
||||
context: Context,
|
||||
@ -332,7 +322,6 @@ object LoginHelper {
|
||||
|
||||
fun release() {
|
||||
backgroundView = null
|
||||
loggingDialog = null
|
||||
preDialog = null
|
||||
isPolicyCheck = false
|
||||
loginToken = ""
|
||||
|
||||
@ -59,9 +59,6 @@ LOG_HUB_PROJECT_GAT=ghzs-global
|
||||
DEV_CSJ_APPID=5410486
|
||||
CSJ_APPID=5429125
|
||||
|
||||
WGAME_CPM_BUSIAPPID=dl5b0ccbd8
|
||||
WGAME_CPM_API_HOST=https://mrj.20130123.com/dlwxgame/api/
|
||||
|
||||
# hosts
|
||||
DEV_API_HOST=https\://dev-and-api.ghzs6.com/v5d5d0/
|
||||
API_HOST=https\://and-api.ghzs6.com/v5d5d0/
|
||||
|
||||
@ -78,7 +78,6 @@ public class Constants {
|
||||
|
||||
public static final String QQ_MINI_GAME = "qq";
|
||||
public static final String WECHAT_MINI_GAME = "wechat";
|
||||
public static final String WECHAT_MINI_GAME_CPM = "wechat_cpm";
|
||||
/**
|
||||
* <a href="https://developers.weixin.qq.com/community/minigame/doc/000c461a17c6486f0641e27176b401">微信小游戏PCS参数</a>
|
||||
*/
|
||||
|
||||
@ -30,14 +30,10 @@ data class ExposureEntity(
|
||||
val displayType: String? = "",
|
||||
@SerializedName("is_platform_recommend")
|
||||
val isPlatformRecommend: Boolean? = false,
|
||||
@SerializedName("mini_game_uid")
|
||||
val miniGameUid: String? = "",
|
||||
@SerializedName("mini_game_id")
|
||||
val miniGameId: String? = "",// 小游戏ID
|
||||
@SerializedName("mini_game_type")
|
||||
val miniGameType: String? = "",// 小游戏类型:QQ小游戏:qq 微信小游戏:wechat
|
||||
@SerializedName("mini_game_recommend_id")
|
||||
val miniGameRecommendId: String? = "",
|
||||
var speed: Long = 0,
|
||||
var certification: Int? = null, // 0表示未实名,1表示未成年,2表示成年
|
||||
|
||||
|
||||
@ -92,21 +92,6 @@ object EnvHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getWGameCPMHost(): String {
|
||||
val buildConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
|
||||
return buildConfig?.getWGameCPMApiHost() ?: ""
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getWGameCPMBusiAppId(): String {
|
||||
val buildConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
|
||||
return buildConfig?.getWGameCPMBusiAppId() ?: ""
|
||||
}
|
||||
|
||||
|
||||
fun showChangeChannelDialog(context: Context, restartAfterChanges: Boolean = false) {
|
||||
val appProvider = ARouter.getInstance().build(RouteConsts.provider.app).navigation() as? IAppProvider
|
||||
val layout = LinearLayout(context).apply {
|
||||
|
||||
@ -26,7 +26,7 @@ object SensorsBridge {
|
||||
private const val KEY_LAST_PAGE_BUSINESS_ID = "last_page_business_id"
|
||||
private const val KEY_DOWNLOAD_STATUS = "download_status"
|
||||
private const val KEY_DOWNLOAD_TYPE = "download_type"
|
||||
private const val KEY_GAME_SCHEME_TYPE = "game_scheme_type"
|
||||
private const val KEY_GAME_SCHEMA_TYPE = "game_schema_type"
|
||||
private const val KEY_GAME_TYPE = "game_type"
|
||||
const val KEY_POSITION = "position"
|
||||
const val KEY_TAB_CONTENT = "tab_content"
|
||||
@ -88,8 +88,6 @@ object SensorsBridge {
|
||||
private const val KEY_VERIFICATION_TYPE = "verification_type"
|
||||
private const val KEY_VIDEO_ID = "video_id"
|
||||
private const val KEY_PLAY_TYPE = "play_type"
|
||||
private const val KEY_LABEL_NAME = "label_name"
|
||||
private const val KEY_LABEL_ID = "label_id"
|
||||
const val KEY_BOTTOM_TAB = "bottom_tab"
|
||||
const val KEY_MULTI_TAB_NAME = "several_tab_page_name"
|
||||
const val KEY_MULTI_TAB_ID = "several_tab_page_id"
|
||||
@ -293,8 +291,6 @@ object SensorsBridge {
|
||||
|
||||
private const val EVENT_COLUMN_TEST_CLICK = "ColumnTestClick"
|
||||
|
||||
private const val EVENT_SEARCH_DISCOVERY_CLICK = "SearchDiscoveryClick"
|
||||
|
||||
private const val EVENT_BYPASS_BROWSING = "BypassBrowsing"
|
||||
private const val EVENT_FAIL_BYPASS = "FailBypass"
|
||||
|
||||
@ -4013,7 +4009,7 @@ object SensorsBridge {
|
||||
* 触发时机:当下载悬浮窗引导图展示时触发上报
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
* @param gameSchemeType 游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 游戏架构类型:64位/32位
|
||||
* @param downloadStatus 游戏下载状态
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param downloadType 实际下载方式:本地下载/畅玩下载
|
||||
@ -4022,7 +4018,7 @@ object SensorsBridge {
|
||||
fun trackDownloadSuspendedWindowGuideShow(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
downloadStatus: String,
|
||||
gameType: String,
|
||||
downloadType: String
|
||||
@ -4030,7 +4026,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
@ -4070,7 +4066,7 @@ object SensorsBridge {
|
||||
* @param source 来源:游戏下载\重启APP
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4079,7 +4075,7 @@ object SensorsBridge {
|
||||
source: String,
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4088,7 +4084,7 @@ object SensorsBridge {
|
||||
KEY_SOURCE to source
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4103,7 +4099,7 @@ object SensorsBridge {
|
||||
* @param source 来源:游戏下载\重启APP
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4112,7 +4108,7 @@ object SensorsBridge {
|
||||
source: String,
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4121,7 +4117,7 @@ object SensorsBridge {
|
||||
KEY_SOURCE to source
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4135,7 +4131,7 @@ object SensorsBridge {
|
||||
* 触发时机:触发自动下载提示条展示时上报
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4143,7 +4139,7 @@ object SensorsBridge {
|
||||
fun trackAutomaticInstallationPromptBarShow(
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4151,7 +4147,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4165,7 +4161,7 @@ object SensorsBridge {
|
||||
* 触发时机:触发自动下载提示条点击时上报
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4173,7 +4169,7 @@ object SensorsBridge {
|
||||
fun trackAutomaticInstallationPromptBarClick(
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4181,7 +4177,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4195,7 +4191,7 @@ object SensorsBridge {
|
||||
* 触发时机:下载组件展示时上报
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
* @param gameSchemeType 游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 游戏架构类型:64位/32位
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
@ -4203,7 +4199,7 @@ object SensorsBridge {
|
||||
fun trackDownloadComponentsShow(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
downloadStatus: String,
|
||||
gameType: String,
|
||||
downloadType: String,
|
||||
@ -4211,7 +4207,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
@ -4225,7 +4221,7 @@ object SensorsBridge {
|
||||
* 触发时机:下载组件点击时上报
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
* @param gameSchemeType 游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 游戏架构类型:64位/32位
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
@ -4235,7 +4231,7 @@ object SensorsBridge {
|
||||
fun trackDownloadComponentsContentClick(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
downloadStatus: String,
|
||||
gameType: String,
|
||||
downloadType: String,
|
||||
@ -4245,7 +4241,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
@ -4339,31 +4335,6 @@ object SensorsBridge {
|
||||
trackEvent(EVENT_HALO_SELF_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件ID:SearchDiscoveryClick
|
||||
* 事件名称:搜索发现点击事件
|
||||
* 触发时机:点击搜索发现时触发
|
||||
* @param labelName 标签名称
|
||||
* @param labelId 标签ID
|
||||
* @param searchContent 搜索内容
|
||||
* @param position 序号
|
||||
* @see EVENT_SEARCH_DISCOVERY_CLICK
|
||||
*/
|
||||
fun trackSearchDiscoveryClick(
|
||||
labelName: String,
|
||||
labelId: String,
|
||||
searchContent: String,
|
||||
position: Int
|
||||
) {
|
||||
val json = json {
|
||||
KEY_LABEL_NAME to labelName
|
||||
KEY_LABEL_ID to labelId
|
||||
KEY_SEARCH_CONTENT to searchContent
|
||||
KEY_POSITION to position
|
||||
}
|
||||
trackEvent(EVENT_SEARCH_DISCOVERY_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件ID:BypassBrowsing
|
||||
* 事件名称:分流器访问事件
|
||||
|
||||
@ -25,9 +25,5 @@ interface IBuildConfigProvider : IProvider {
|
||||
|
||||
fun getVDevApiHost(): String
|
||||
|
||||
fun getWGameCPMApiHost(): String
|
||||
|
||||
fun getLogProducerProject(): String
|
||||
|
||||
fun getWGameCPMBusiAppId(): String
|
||||
}
|
||||
@ -56,10 +56,5 @@ interface IDirectProvider : IProvider {
|
||||
|
||||
fun directToQQGameById(activity: Activity, qqAppId: String)
|
||||
|
||||
fun directToWechatGameById(
|
||||
activity: Activity,
|
||||
wechatAppId: String,
|
||||
wechatAppPath: String,
|
||||
wechatAppExtData: String
|
||||
)
|
||||
fun directToWechatGameById(activity: Activity, qqAppId: String)
|
||||
}
|
||||
@ -15,8 +15,6 @@ interface ILoginProvider : IProvider {
|
||||
callback: () -> Unit
|
||||
)
|
||||
|
||||
fun createLoggingDialog(context: Context): Dialog
|
||||
|
||||
fun createQuickLoginBackgroundView(context: Context): View
|
||||
|
||||
fun startQuickLoginHelperPageFromQuickLogin(loginToken: String, context: Context, callback: (() -> Unit)?)
|
||||
|
||||
@ -6,6 +6,8 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ProcessUtil {
|
||||
@ -20,13 +22,25 @@ public class ProcessUtil {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//1)通过Application的API获取当前进程名
|
||||
//0)通过反射 ActivityThread 获取实例再获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByActivityThreadInstance();
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//1)通过 CMD 获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByCMD(android.os.Process.myPid());
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//2)通过 Application 的 API 获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByApplication();
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//2)通过反射ActivityThread获取当前进程名
|
||||
//3)通过反射 ActivityThread 获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByActivityThread();
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
@ -38,7 +52,7 @@ public class ProcessUtil {
|
||||
/**
|
||||
* 通过Application新的API获取进程名,无需反射,无需IPC,效率最高。
|
||||
*/
|
||||
public static String getCurrentProcessNameByApplication() {
|
||||
private static String getCurrentProcessNameByApplication() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
return Application.getProcessName();
|
||||
}
|
||||
@ -48,7 +62,7 @@ public class ProcessUtil {
|
||||
/**
|
||||
* 通过反射ActivityThread获取进程名,避免了ipc
|
||||
*/
|
||||
public static String getCurrentProcessNameByActivityThread() {
|
||||
private static String getCurrentProcessNameByActivityThread() {
|
||||
String processName = null;
|
||||
try {
|
||||
final Method declaredMethod = Class.forName("android.app.ActivityThread", false, Application.class.getClassLoader())
|
||||
@ -64,4 +78,52 @@ public class ProcessUtil {
|
||||
return processName;
|
||||
}
|
||||
|
||||
private static String getCurrentProcessNameByActivityThreadInstance() {
|
||||
try {
|
||||
// Get ActivityThread class
|
||||
Class<?> activityThreadClass = Class.forName("android.app.ActivityThread",false, Application.class.getClassLoader());
|
||||
|
||||
// Get the current ActivityThread instance
|
||||
Method currentActivityThreadMethod = activityThreadClass.getDeclaredMethod("currentActivityThread");
|
||||
currentActivityThreadMethod.setAccessible(true);
|
||||
Object activityThread = currentActivityThreadMethod.invoke(null);
|
||||
|
||||
// Get the getProcessName method
|
||||
Method getProcessNameMethod = activityThreadClass.getDeclaredMethod("getProcessName");
|
||||
getProcessNameMethod.setAccessible(true);
|
||||
|
||||
// Call the getProcessName method
|
||||
return (String) getProcessNameMethod.invoke(activityThread);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getCurrentProcessNameByCMD(int pid) {
|
||||
//get from /proc/PID/cmdline
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
|
||||
String processName = br.readLine();
|
||||
if (!TextUtils.isEmpty(processName)) {
|
||||
processName = processName.trim();
|
||||
if (!TextUtils.isEmpty(processName)) {
|
||||
return processName; //OK
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (br != null) {
|
||||
br.close();
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
//failed
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.gh.gamecenter.feature.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class DiscoveryTagEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String? = "",
|
||||
var text: String? = "",
|
||||
@SerializedName("keyword")
|
||||
var _keyword: String? = ""
|
||||
) : Parcelable {
|
||||
val keyword get(): String {
|
||||
val keyword = this._keyword
|
||||
if (keyword.isNullOrEmpty()) {
|
||||
return text ?: ""
|
||||
}
|
||||
return keyword
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ import java.util.*
|
||||
@Parcelize
|
||||
data class GameEntity(
|
||||
@SerializedName("_id")
|
||||
private var _id: String = "",
|
||||
var id: String = "",
|
||||
@SerializedName("icon")
|
||||
private var mIcon: String? = null,
|
||||
@SerializedName("ori_icon")
|
||||
@ -284,26 +284,18 @@ data class GameEntity(
|
||||
@SerializedName("message_private_id")
|
||||
var messageId: String = "",
|
||||
|
||||
// 小游戏服务商ID,目前仅用于微信小游戏CPM
|
||||
var miniGameUid: String = "",
|
||||
// 小游戏ID,仅用于小游戏
|
||||
@SerializedName("appid")
|
||||
var miniGameAppId: String = "",
|
||||
// 小游戏状态(1:下架 2:秒玩),仅用于小游戏
|
||||
@SerializedName("app_status")
|
||||
var miniGameAppStatus: Int = 0,
|
||||
// 小游戏类型(qq/wechat/wechat_cpm),仅用于小游戏
|
||||
// 小游戏类型(qq/wechat),仅用于小游戏
|
||||
@SerializedName("game_type")
|
||||
var miniGameType: String = "",
|
||||
// 小游戏链接URL,仅用于小游戏
|
||||
@SerializedName("appidLink")
|
||||
var miniGameAppLink: String = "",
|
||||
// 小游戏跳转path,目前仅用于微信小游戏CPM
|
||||
var miniGameAppPath: String = "",
|
||||
// 小游戏跳转extData,目前仅用于微信小游戏CPM
|
||||
var miniGameExtData: String = "",
|
||||
// 小游戏广告推荐ID,目前仅用于微信小游戏CPM
|
||||
var miniGameRecommendId: String = "",
|
||||
// 使用人数,仅用于微信小游戏
|
||||
var usage: Int = 0,
|
||||
// 游戏封面图,仅用于微信小游戏
|
||||
@ -388,11 +380,11 @@ data class GameEntity(
|
||||
) : Parcelable {
|
||||
|
||||
constructor(id: String?) : this() {
|
||||
this._id = id ?: "empty gameId"
|
||||
this.id = id ?: "empty gameId"
|
||||
}
|
||||
|
||||
constructor(id: String?, name: String?) : this() {
|
||||
this._id = id ?: "empty gameId, it's name is $name"
|
||||
this.id = id ?: "empty gameId, it's name is $name"
|
||||
this.mName = name
|
||||
}
|
||||
|
||||
@ -407,10 +399,6 @@ data class GameEntity(
|
||||
val assignRemark: AssignRemark
|
||||
get() = _assignRemark ?: AssignRemark()
|
||||
|
||||
var id: String
|
||||
set(value) { _id = value }
|
||||
get() = if (isWechatMiniGameCPM()) miniGameAppId else _id
|
||||
|
||||
@IgnoredOnParcel
|
||||
private var entryMap: androidx.collection.ArrayMap<String, DownloadEntity>? =
|
||||
androidx.collection.ArrayMap()
|
||||
@ -459,7 +447,7 @@ data class GameEntity(
|
||||
.build(RouteConsts.provider.regionSettingHelper)
|
||||
.navigation() as? IRegionSettingHelperProvider
|
||||
|
||||
return when (regionSettingProvider?.getMirrorPosition(_id)) {
|
||||
return when (regionSettingProvider?.getMirrorPosition(id)) {
|
||||
1 -> mMirrorData
|
||||
2 -> mMirrorData2
|
||||
else -> null
|
||||
@ -468,7 +456,7 @@ data class GameEntity(
|
||||
|
||||
@IgnoredOnParcel
|
||||
var recommendText: String
|
||||
get() = if (isWechatMiniGame() || isWechatMiniGameCPM()) {
|
||||
get() = if (isWechatMiniGame()) {
|
||||
brief ?: ""
|
||||
} else {
|
||||
_recommendText
|
||||
@ -812,11 +800,6 @@ data class GameEntity(
|
||||
*/
|
||||
fun isWechatMiniGame(): Boolean = isMiniGame() && miniGameType == Constants.WECHAT_MINI_GAME
|
||||
|
||||
/**
|
||||
* 当前游戏是否为微信小游戏CPM
|
||||
*/
|
||||
fun isWechatMiniGameCPM(): Boolean = isMiniGame() && miniGameType == Constants.WECHAT_MINI_GAME_CPM
|
||||
|
||||
/**
|
||||
* 当前小游戏是否下架
|
||||
*/
|
||||
@ -844,7 +827,7 @@ data class GameEntity(
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.regionSettingHelper)
|
||||
.navigation() as? IRegionSettingHelperProvider
|
||||
useMirrorInfo =
|
||||
(mirrorStatus == "on" || mirrorStatus2 == "on") && provider?.shouldThisGameDisplayMirrorInfo(_id) == true
|
||||
(mirrorStatus == "on" || mirrorStatus2 == "on") && provider?.shouldThisGameDisplayMirrorInfo(id) == true
|
||||
}
|
||||
|
||||
return useMirrorInfo
|
||||
@ -858,7 +841,7 @@ data class GameEntity(
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.regionSettingHelper)
|
||||
.navigation() as? IRegionSettingHelperProvider
|
||||
|
||||
return provider?.getMirrorPosition(_id) ?: -1
|
||||
return provider?.getMirrorPosition(id) ?: -1
|
||||
}
|
||||
|
||||
/**
|
||||
@ -989,7 +972,7 @@ data class GameEntity(
|
||||
fun isSpecialDownload(): Boolean {
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.regionSettingHelper)
|
||||
.navigation() as? IRegionSettingHelperProvider
|
||||
return provider?.shouldThisGameShowSpecialDownload(_id) == true
|
||||
return provider?.shouldThisGameShowSpecialDownload(id) == true
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1031,7 +1014,7 @@ data class GameEntity(
|
||||
|
||||
fun toSimpleGame(): SimpleGame {
|
||||
val simpleGame = SimpleGame()
|
||||
simpleGame.id = _id
|
||||
simpleGame.id = id
|
||||
simpleGame.mName = mName
|
||||
simpleGame.mIcon = mIcon
|
||||
simpleGame.mRawIcon = mRawIcon
|
||||
@ -1044,7 +1027,7 @@ data class GameEntity(
|
||||
|
||||
fun convertSimulatorGameRecordEntity(): SimulatorGameRecordEntity {
|
||||
val entity = SimulatorGameRecordEntity()
|
||||
entity.id = _id
|
||||
entity.id = id
|
||||
entity.brief = brief
|
||||
entity.des = des
|
||||
entity.icon = rawIcon
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user