This commit is contained in:
juntao
2021-09-24 17:29:39 +08:00
parent 7fd7197909
commit a1ecb784e2
23 changed files with 358 additions and 101 deletions

View File

@ -1,5 +1,6 @@
package com.gh.common.util;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
@ -11,6 +12,9 @@ import com.gh.common.AppExecutor;
import com.gh.common.constant.Constants;
import com.gh.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.UserInfoEntity;
import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gid.GidCallback;
import com.gh.gid.GidHelper;
import com.halo.assistant.HaloApp;
@ -20,6 +24,8 @@ import com.lightgame.utils.Utils;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.sentry.Sentry;
import io.sentry.android.core.SentryAndroid;
@ -171,6 +177,8 @@ public class DataUtils {
GameSubstituteRepositoryHelper.updateSubstitutableGames();
}
getDeviceCertification(gid);
// 避免初始化顺序问题导致 MetaUtil 一直持有空的 gid
MetaUtil.INSTANCE.refreshMeta();
}
@ -182,6 +190,23 @@ public class DataUtils {
});
}
/**
* 获取应用 gid 绑定的实名信息
*/
@SuppressLint("CheckResult")
private static void getDeviceCertification(String gid) {
RetrofitManager.getInstance(HaloApp.getInstance())
.getApi()
.getCertification()
.subscribeOn(Schedulers.io())
.subscribe(new BiResponse<UserInfoEntity>() {
@Override
public void onSuccess(UserInfoEntity data) {
SPUtils.setString(Constants.SP_DEVICE_CERTIFICATION_PREFIX + gid, GsonUtils.toJson(data));
}
});
}
public static void onEvent(Context var0, String var1, String var2) {
// Properties prop = new Properties();
// prop.setProperty(var1, var2);