Compare commits
13 Commits
v5.30.0-95
...
v5.30.2-95
| Author | SHA1 | Date | |
|---|---|---|---|
| 77ee092b5b | |||
| c65147e309 | |||
| 1ff2bb0bcc | |||
| 89ecf09b55 | |||
| 2cfb227c22 | |||
| f34adc8e6d | |||
| 8606c8f87a | |||
| caf2dbacf9 | |||
| 9587336b31 | |||
| e1c2b2027a | |||
| c5ff26c879 | |||
| 9690a695d4 | |||
| 78e9c43f24 |
@ -60,9 +60,6 @@ object AdDelegateHelper {
|
||||
private val mGameSearchAdList: ArrayList<AdConfig> by lazy { arrayListOf() }
|
||||
private var mVGameLaunchAd: AdConfig? = null
|
||||
|
||||
private var mIsCsjRequired: Boolean = false // 是否需要初始化穿山甲 SDK
|
||||
private var mIsBeiziRequired: Boolean = false // 师傅需要初始化 Beizi SDK
|
||||
|
||||
private const val AD_SDK_CSJ = "穿山甲"
|
||||
private const val AD_SDK_BEIZI = "倍孜"
|
||||
private const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告
|
||||
@ -73,11 +70,32 @@ object AdDelegateHelper {
|
||||
HaloApp.getInstance().getSharedPreferences("AdConfig", Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
fun initAdSdk(context: Context) {
|
||||
// 初始化 Beizi
|
||||
if (mBeiziAdImpl == null) {
|
||||
mBeiziAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.beiziAd).navigation() as? IBeiziAdProvider
|
||||
mBeiziAdImpl?.initSDK(context)
|
||||
}
|
||||
|
||||
// 初始化穿山甲
|
||||
if (mCsjAdImpl == null) {
|
||||
mCsjAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
|
||||
mCsjAdImpl?.initSDK(context, BuildConfig.CSJ_APPID, HaloApp.getInstance().oaid)
|
||||
// 监听亮色/暗色模式切换
|
||||
DarkModeUtils.registerModeChangeListener {
|
||||
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: return@registerModeChangeListener
|
||||
updateThemeStatus(context, DarkModeUtils.isDarkModeOn(topActivity))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求接口获取广告相关配置
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
fun requestAdConfig(context: Context, isFromRetry: Boolean) {
|
||||
fun requestAdConfig(isFromRetry: Boolean) {
|
||||
// mAdConfigList 不为空不需要重试
|
||||
if (isFromRetry && mAdConfigList != null) {
|
||||
return
|
||||
@ -89,7 +107,7 @@ object AdDelegateHelper {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : BiResponse<List<AdConfig>>() {
|
||||
override fun onSuccess(data: List<AdConfig>) {
|
||||
handleAdConfig(context, data)
|
||||
handleAdConfig(data)
|
||||
|
||||
// 缓存数据到 SP 供接口请求失败用
|
||||
SPUtils.setString(mAdConfigSp, KEY_CACHE_CONFIG, data.toJson())
|
||||
@ -101,7 +119,7 @@ object AdDelegateHelper {
|
||||
// 若接口请求失败时,从 SP 里获取上次缓存的数据
|
||||
val cachedConfig: List<AdConfig>? = SPUtils.getString(mAdConfigSp, KEY_CACHE_CONFIG).toObject()
|
||||
if (cachedConfig != null) {
|
||||
handleAdConfig(context, cachedConfig)
|
||||
handleAdConfig(cachedConfig)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -124,7 +142,7 @@ object AdDelegateHelper {
|
||||
/**
|
||||
* 处理广告配置
|
||||
*/
|
||||
fun handleAdConfig(context: Context, configList: List<AdConfig>) {
|
||||
fun handleAdConfig(configList: List<AdConfig>) {
|
||||
for (config in configList) {
|
||||
// 处理返回的数据
|
||||
when (config.location) {
|
||||
@ -133,39 +151,6 @@ object AdDelegateHelper {
|
||||
"game_search" -> config.let { mGameSearchAdList.add(it) }
|
||||
"helper_launch" -> mVGameLaunchAd = config
|
||||
}
|
||||
|
||||
// 根据返回的值里判断是否含有 Beizi 的广告
|
||||
if (!mIsBeiziRequired) {
|
||||
if (config.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
|
||||
mIsBeiziRequired = true
|
||||
}
|
||||
}
|
||||
|
||||
// 根据返回的值里判断是否含有 穿山甲 的广告
|
||||
if (!mIsCsjRequired) {
|
||||
if (config.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
|
||||
mIsCsjRequired = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化 Beizi
|
||||
if (mIsBeiziRequired && mBeiziAdImpl == null) {
|
||||
mBeiziAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.beiziAd).navigation() as? IBeiziAdProvider
|
||||
mBeiziAdImpl?.initSDK(context)
|
||||
}
|
||||
|
||||
// 初始化穿山甲
|
||||
if (mIsCsjRequired && mCsjAdImpl == null) {
|
||||
mCsjAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
|
||||
mCsjAdImpl?.initSDK(context, BuildConfig.CSJ_APPID, HaloApp.getInstance().oaid)
|
||||
// 监听亮色/暗色模式切换
|
||||
DarkModeUtils.registerModeChangeListener {
|
||||
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: return@registerModeChangeListener
|
||||
updateThemeStatus(context, DarkModeUtils.isDarkModeOn(topActivity))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ public class NetworkStateReceiver extends BroadcastReceiver {
|
||||
// 奇怪,初次注册监听就会有回调,会导致部分接口短时间内触发两次调用
|
||||
ExtensionsKt.doOnMainProcessOnly(context, () -> {
|
||||
if (NetworkUtils.isNetworkConnected(context)) {
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(context, true);
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(true);
|
||||
RegionSettingHelper.getRegionSetting();
|
||||
ReservationRepository.refreshReservationsIfNeeded();
|
||||
EventBus.getDefault().post(new EBNetworkState(NetworkUtils.isNetworkConnected(context)));
|
||||
|
||||
@ -31,15 +31,17 @@ class GameServerTestActivity : DownloadToolbarActivity() {
|
||||
companion object {
|
||||
fun getIntent(context: Context, id: String, title: String, entrance: String, traceEvent: ExposureEvent?): Intent {
|
||||
val bundle = Bundle()
|
||||
val exposureSourceList = traceEvent?.source
|
||||
bundle.putString(GameServersTestFragment.TEST_COLUMN_ID, id)
|
||||
bundle.putString(GameServersTestFragment.TEST_TITLE, title)
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
if (exposureSourceList is ArrayList) {
|
||||
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, exposureSourceList)
|
||||
} else {
|
||||
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureSourceList))
|
||||
traceEvent?.source?.let {
|
||||
if (it is ArrayList) {
|
||||
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, it)
|
||||
} else {
|
||||
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, ArrayList(it))
|
||||
}
|
||||
}
|
||||
|
||||
return getTargetIntent(
|
||||
context,
|
||||
GameServerTestActivity::class.java,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.vspace
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -43,6 +44,7 @@ class HomeRecentVGameViewHolder(var binding: ItemHomeRecentVgameBinding) :
|
||||
}
|
||||
})
|
||||
|
||||
binding.moreTv.visibility = View.VISIBLE
|
||||
binding.moreTv.setOnClickListener {
|
||||
NewFlatLogUtils.logHaloFunManageShow("最近在玩")
|
||||
binding.root.context.startActivity(
|
||||
|
||||
@ -306,9 +306,10 @@ public class HaloApp extends MultiDexApplication {
|
||||
// 获取 settings 配置
|
||||
ExtensionsKt.doOnMainProcessOnly(this, com.gh.common.constant.Config::getGhzsSettings);
|
||||
|
||||
// 获取广告配置
|
||||
// 初始化广告 SDK 并获取广告配置
|
||||
ExtensionsKt.doOnMainProcessOnly(this, () -> {
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(this, false);
|
||||
AdDelegateHelper.INSTANCE.initAdSdk(this);
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(false);
|
||||
});
|
||||
|
||||
String localTemporaryDeviceId = SPUtils.getString(Constants.SP_TEMPORARY_DEVICE_ID);
|
||||
|
||||
@ -7,8 +7,8 @@ ext {
|
||||
targetSdkVersion = 28
|
||||
|
||||
// application info (每个大版本之间的 versionCode 增加 20)
|
||||
versionCode = 950
|
||||
versionName = "5.30.0"
|
||||
versionCode = 952
|
||||
versionName = "5.30.2"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
// AndroidX
|
||||
|
||||
@ -22,6 +22,8 @@ object CsjAdHelper {
|
||||
|
||||
const val TAG = "CsjAdHelper"
|
||||
|
||||
var mIsInitialed = false
|
||||
|
||||
fun init(context: Context, csjId: String, oaid: String) {
|
||||
|
||||
try {
|
||||
@ -80,10 +82,12 @@ object CsjAdHelper {
|
||||
object : InitCallback {
|
||||
override fun success() {
|
||||
Utils.log(TAG, "穿山甲初始化成功")
|
||||
mIsInitialed = true
|
||||
}
|
||||
|
||||
override fun fail(p0: Int, p1: String?) {
|
||||
Utils.log(TAG, "穿山甲初始化失败, $p0 $p1")
|
||||
mIsInitialed = false
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -116,6 +120,14 @@ object CsjAdHelper {
|
||||
.setAdLoadType(TTAdLoadType.LOAD)// 推荐使用,用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,方便后续为开发者优化相关策略
|
||||
.build()
|
||||
|
||||
Utils.log(TAG, "请求开屏广告")
|
||||
|
||||
if (!mIsInitialed) {
|
||||
Utils.log(TAG, "初始化未完成,不加载开屏动画")
|
||||
callback.invoke(false)
|
||||
return
|
||||
}
|
||||
|
||||
mTTAdNative.loadSplashAd(adSlot, object : CSJSplashAdListener {
|
||||
override fun onSplashLoadSuccess() {
|
||||
Utils.log(TAG, "开屏广告加载成功")
|
||||
@ -201,7 +213,7 @@ object CsjAdHelper {
|
||||
mTTAdNative.loadNativeExpressAd(adSlot, object : NativeExpressAdListener {
|
||||
// 广告请求失败
|
||||
override fun onError(code: Int, message: String) {
|
||||
Utils.log(TAG, "requestFlowAd 广告请求失败 $message")
|
||||
Utils.log(TAG, "requestFlowAd $code 广告请求失败 $message")
|
||||
callback.invoke(false)
|
||||
}
|
||||
|
||||
|
||||
@ -11,20 +11,15 @@ import com.tencent.qqmini.sdk.launcher.model.MiniAppInfo
|
||||
|
||||
class MiniCustomizedProxyImpl : MiniCustomizedProxy() {
|
||||
|
||||
override fun onAppStateChange(info: MiniAppInfo, appState: Int) {
|
||||
val provider = ARouter
|
||||
.getInstance()
|
||||
.build(RouteConsts.provider.realName)
|
||||
.navigation() as IRealNameProvider
|
||||
|
||||
when(appState) {
|
||||
AppState.STATE_SHOW -> provider.setAppInfo(info.appId, info.name) {
|
||||
QGameHelper.stopMiniApp(AppLoaderFactory.g().context, info, true)
|
||||
}
|
||||
|
||||
AppState.STATE_HIDE -> {}
|
||||
|
||||
AppState.STATE_STOP -> {}
|
||||
}
|
||||
override fun onAppStateChange(info: MiniAppInfo?, appState: Int) {
|
||||
if(info != null && appState == AppState.STATE_SHOW) {
|
||||
val provider = ARouter
|
||||
.getInstance()
|
||||
.build(RouteConsts.provider.realName)
|
||||
.navigation() as IRealNameProvider
|
||||
provider.setAppInfo(info.appId, info.name) {
|
||||
QGameHelper.stopMiniApp(AppLoaderFactory.g().context, info, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -21,21 +21,23 @@ object GsonUtils {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("部分 7.1.1 设备会出现 AssertionError,尽量不要在关键功能上使用此方法")
|
||||
fun <T> fromJsonList(json: JSONArray): List<T> {
|
||||
return try {
|
||||
val type = object : TypeToken<List<T>>() {}.type
|
||||
return gson.fromJson(json.toString(), type)
|
||||
} catch (e: Exception) {
|
||||
} catch (e: Throwable) {
|
||||
listOf()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("部分 7.1.1 设备会出现 AssertionError,尽量不要在关键功能上使用此方法")
|
||||
fun <T> fromJsonList(json: String): List<T> {
|
||||
return try {
|
||||
val type = object : TypeToken<List<T>>() {}.type
|
||||
gson.fromJson(json, type)
|
||||
} catch (e: Exception) {
|
||||
} catch (e: Throwable) {
|
||||
listOf()
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class SortedMessageListAdapter(
|
||||
ovalHint.background = R.drawable.oval_message_hint_bg.toDrawable(mContext)
|
||||
|
||||
titleTv.text = entity.title
|
||||
if (mMessageTypeMap.getOrDefault(entity.type, null) != null && entity.icon.isEmpty()) {
|
||||
if (mMessageTypeMap[entity.type] != null && entity.icon.isEmpty()) {
|
||||
ImageUtils.display(iconIv, mMessageTypeMap[entity.type])
|
||||
} else {
|
||||
ImageUtils.display(iconIv, entity.icon)
|
||||
|
||||
Reference in New Issue
Block a user