feat: 广告位前置工作(接入新版 OAID SDK) https://jira.shanqu.cc/browse/GHZS-2389

This commit is contained in:
chenjuntao
2023-05-29 16:49:25 +08:00
parent aa069b7a21
commit 68a3eadfeb
25 changed files with 331 additions and 42 deletions

View File

@ -306,7 +306,7 @@ class SplashScreenActivity : BaseActivity() {
private fun doFlavorInit() {
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this, PkgHelper.getActivateRatio())
val whiteListChannel = arrayListOf<String>(
val whiteListChannel = arrayListOf(
"GH_206",
"KS-GHZS-KY1",
"KS-GHZS-MC1",
@ -326,12 +326,6 @@ class SplashScreenActivity : BaseActivity() {
private fun initStartUpAdSDK() {
mStartUpAdProvider?.run {
if (shouldEnableSDK(HaloApp.getInstance().channel)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
initOAID(applicationContext) {
HaloApp.getInstance().oaid = it
MetaUtil.refreshMeta()
}
}
initSDK(applicationContext)
}
}

View File

@ -0,0 +1,22 @@
package com.gh.gamecenter.oaid
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IOAIDProvider
object OAIDHelper {
fun doSystemLoad() {
val oaidProvider = ARouter.getInstance().build(RouteConsts.provider.oaid).navigation() as? IOAIDProvider
oaidProvider?.doSystemLoad()
}
fun getOAID(context: Context, callback: (String) -> Unit) {
val oaidProvider = ARouter.getInstance().build(RouteConsts.provider.oaid).navigation() as? IOAIDProvider
oaidProvider?.getOAID(context, callback)
}
}

View File

@ -43,6 +43,7 @@ import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.Injection;
import com.gh.gamecenter.common.constant.Config;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.common.image.EmptyDecoder;
import com.gh.gamecenter.common.tracker.Tracker;
import com.gh.gamecenter.common.utils.DarkModeUtils;
@ -58,6 +59,7 @@ import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.entity.SubjectRecommendEntity;
import com.gh.gamecenter.fragment.MainWrapperRepository;
import com.gh.gamecenter.login.user.UserRepository;
import com.gh.gamecenter.oaid.OAIDHelper;
import com.gh.gamecenter.packagehelper.PackageRepository;
import com.gh.gamecenter.core.provider.IFlavorProvider;
import com.gh.gamecenter.provider.FlavorProviderImp;
@ -204,6 +206,9 @@ public class HaloApp extends MultiDexApplication {
application.onCreate(mInstance);
}
// 似乎只是 load SO 不涉及方法调用,所以可以在隐私政策前调用吧?
OAIDHelper.INSTANCE.doSystemLoad();
// 70ms
PlayerFactory.setPlayManager(Exo2PlayerManager.class);
CacheFactory.setCacheManager(ExoPlayerCacheManager.class);
@ -273,6 +278,12 @@ public class HaloApp extends MultiDexApplication {
// 获取/更新 GID 和 读 SP 的操作不需要 delay
DataUtils.getGid();
OAIDHelper.INSTANCE.getOAID(this, s -> {
setOAID(s);
MetaUtil.INSTANCE.refreshMeta();
return null;
});
// 获取 settings 配置
ExtensionsKt.doOnMainProcessOnly(this, com.gh.common.constant.Config::getGhzsSettings);