This commit is contained in:
张玉久
2022-05-17 17:34:21 +08:00
parent 1bb240c964
commit 116702f7f0
457 changed files with 1903 additions and 1239 deletions

View File

@ -1,6 +1,5 @@
package com.gh.common.util;
import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.os.Build;
@ -8,29 +7,25 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.gh.common.exposure.ExposureEntity;
import com.gh.common.exposure.ExposureEvent;
import com.gh.common.exposure.ExposureSource;
import com.gh.common.loghub.LoghubUtils;
import com.gh.common.loghub.SimpleLogContainerEntity;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.entity.ExposureEntity;
import com.gh.gamecenter.common.exposure.meta.Meta;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.common.loghub.LoghubUtils;
import com.gh.gamecenter.common.loghub.SimpleLogContainerEntity;
import com.gh.gamecenter.common.utils.DeviceUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.entity.CommunityEntity;
import com.gh.gamecenter.entity.DetectionObjectEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.PackageDialogEntity;
import com.gh.gamecenter.entity.ShareResultEntity;
import com.gh.gamecenter.entity.SpecialColumn;
import com.gh.gamecenter.entity.StartupAdEntity;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.retrofit.EmptyResponse;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.Utils;
@ -41,10 +36,6 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* Created by khy on 2/01/18.
*/
@ -526,90 +517,6 @@ public class LogUtils {
LoghubUtils.log(object, "event", false);
}
public static void uploadShareEnter(String entrance, String url, String title, String summary, String resourceId) {
JSONObject object = new JSONObject();
JSONObject payloadObject = new JSONObject();
try {
object.put("action", "entrance_source");
payloadObject.put("entrance", entrance);
payloadObject.put("url", url);
payloadObject.put("title", title);
payloadObject.put("summary", summary);
payloadObject.put("resource_id", resourceId);
object.put("payload", payloadObject);
} catch (JSONException e) {
e.printStackTrace();
}
uploadShare(object);
}
public static void uploadShareType(String shareType, String entrance, String url, String title, String summary, String resourceId) {
JSONObject object = new JSONObject();
JSONObject payloadObject = new JSONObject();
try {
object.put("action", "share_type");
payloadObject.put("share_type", shareType);
payloadObject.put("entrance", entrance);
payloadObject.put("url", url);
payloadObject.put("title", title);
payloadObject.put("summary", summary);
payloadObject.put("resource_id", resourceId);
object.put("payload", payloadObject);
} catch (JSONException e) {
e.printStackTrace();
}
uploadShare(object);
}
@SuppressLint("CheckResult")
public static void uploadShareResult(String shareType, String entrance, String shareResult, String url, String title, String summary, String resourceId) {
JSONObject object = new JSONObject();
JSONObject payloadObject = new JSONObject();
try {
object.put("action", "share_result");
payloadObject.put("share_type", shareType);
payloadObject.put("entrance", entrance);
payloadObject.put("share_result", shareResult);
payloadObject.put("url", url);
payloadObject.put("title", title);
payloadObject.put("summary", summary);
payloadObject.put("resource_id", resourceId);
object.put("payload", payloadObject);
} catch (JSONException e) {
e.printStackTrace();
}
uploadShare(object);
ShareResultEntity entity = new ShareResultEntity(new ShareResultEntity.Content(url, title, summary), shareType, shareResult);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), GsonUtils.toJson(entity));
RetrofitManager.getInstance().getApi()
.postShareResult(body)
.subscribeOn(Schedulers.io())
.subscribe(new EmptyResponse<>());
// 判断是否上报游戏单活动的"转发活动"任务
postGameCollectionRepostActivityTaskCheck(url, shareResult);
}
@SuppressLint("CheckResult")
public static void postGameCollectionRepostActivityTaskCheck(String url, String shareResult) {
if (!TextUtils.isEmpty(url) && "success".equals(shareResult)) {
String gameCollectionActivityUrl;
if (EnvHelper.isDevEnv()) {
gameCollectionActivityUrl = Constants.GAME_COLLECTION_ACTIVITY_ADDRESS_DEV;
} else {
gameCollectionActivityUrl = Constants.GAME_COLLECTION_ACTIVITY_ADDRESS;
}
if (url.contains(gameCollectionActivityUrl)) {
RetrofitManager.getInstance().getNewApi()
.postGameCollectionTask("repost_activity", "0")
.subscribeOn(Schedulers.io())
.subscribe(new EmptyResponse<>());
}
}
}
public static JSONObject getMetaObject() {
Meta meta = MetaUtil.INSTANCE.getMeta();
JSONObject metaObject = new JSONObject();