MOD限制规则(新)(补充请求头) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1646

This commit is contained in:
juntao
2021-12-24 11:55:58 +08:00
parent d6f75d6dd0
commit bfae7143b1
4 changed files with 35 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
@ -67,6 +68,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -276,6 +278,13 @@ public class SplashScreenActivity extends BaseActivity {
HashMap<String, String> map = new HashMap<>();
if (mIsNewForThisVersion) {
// gid 不存在 (因网络延迟还没获取到时,本地生成一个临时 id 供这个接口用)
if (TextUtils.isEmpty(HaloApp.getInstance().getGid())
&& TextUtils.isEmpty(HaloApp.getInstance().getTemporaryLocalDeviceId())) {
String localTemporaryDeviceId = UUID.randomUUID().toString();
HaloApp.getInstance().setLocalTemporaryDeviceId(localTemporaryDeviceId);
SPUtils.setString(Constants.SP_TEMPORARY_DEVICE_ID, localTemporaryDeviceId);
}
map.put("launch_type", DeviceTokenUtils.getLaunchType().name());
}
@ -367,7 +376,6 @@ public class SplashScreenActivity extends BaseActivity {
overridePendingTransition(0, 0);
startActivity(intent);
// TODO 是否可以放在子线程上报?
uploadTeaAndGdtData();
finish();
@ -397,11 +405,11 @@ public class SplashScreenActivity extends BaseActivity {
Field field = clazz.getDeclaredField("NETWORK_TYPE");
String type = (String) field.get(null);
Method method = clazz.getMethod("logAction", String.class, String[].class);
Class<?> actionTypeClazz = Class.forName("com.qq.gdt.action.ActionType");
Field typeField = actionTypeClazz.getDeclaredField("START_APP");
String actionType = (String) typeField.get(null);
method.invoke(null, actionType, new String[]{type, DeviceUtils.getNetwork(this)});
} catch (Exception e) {
e.printStackTrace();