feat: 整理静态类代码 https://jira.shanqu.cc/browse/GHZS-837
1. 移除远古时代的光环3.0数据同步代码 2. 清理部分无用的弹窗构建代码 3. 将默认头像修改完全放置到网络数据中 (原来是本地 drawable,但提交固定 url 的形式) 4. 移除部分没有引用的代码 5. 合并重复的日志类 6. 移除已经没有入口的玩过的游戏 activity 7. 整理部分含有无用入参的方法 8. 重命名部分不合规范的命名
This commit is contained in:
@ -234,8 +234,6 @@ public class MainActivity extends BaseActivity {
|
||||
SPUtils.setString("installedVersionV" + PackageUtils.getGhVersionName(), HaloApp.getInstance().getChannel());
|
||||
|
||||
SPUtils.setString(Constants.SP_INSTALL_TYPE, lunchType.name());
|
||||
|
||||
checkDevice(); // 根据设备信息判断用户是否是新用户
|
||||
}
|
||||
|
||||
// 若 SplashActivity 没能获取到 Gid 这里再重试一次
|
||||
@ -918,102 +916,6 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkTinkerPath() {
|
||||
// CommonDebug.logMethodWithParams(this, TinkerManager.getTinkerId(), TinkerManager.getNewTinkerId());
|
||||
// CommonDebug.logMethodWithParams(this, CrashReport.getAppVer(), CrashReport.getAppID(), CrashReport.getAppChannel(), CrashReport.getSdkExtraData());
|
||||
//
|
||||
// // 1.(母包)首次启动,tinkerId不为空,newTinkerId(patchTinkerId)应该是空的
|
||||
// // 2. 补丁包启动,tinkerId和之前一致,但newTinkerId不一致
|
||||
// // 2.1 显示更新信息弹窗,记录tinkerId+newTinkerId
|
||||
// // 2.1.1 若tinkerId一致,但newTinkerId不一致才能认为是一次补丁更新
|
||||
//
|
||||
// String tinkerId = TinkerManager.getTinkerId();
|
||||
// String newTinkerId = TinkerManager.getNewTinkerId();
|
||||
//
|
||||
// if (TextUtils.isEmpty(newTinkerId)) {
|
||||
// //这是一个新的母包,没有任何补丁信息
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// final Gson gson = new Gson();
|
||||
//
|
||||
// Type type = new TypeToken<HashMap<String, Set<String>>>() {
|
||||
// }.getType();
|
||||
//
|
||||
// final Map<String, Set<String>> tinkerIdMap;
|
||||
// final String tinkerMapJson = mSp.getString(Config.PATCHES, "");
|
||||
// if (!TextUtils.isEmpty(tinkerMapJson)) {
|
||||
// tinkerIdMap = gson.fromJson(tinkerMapJson, type);
|
||||
// } else {
|
||||
// tinkerIdMap = new HashMap<>();
|
||||
// }
|
||||
//
|
||||
// Set<String> tinkerIdSet = tinkerIdMap.get(tinkerId);
|
||||
// if (tinkerIdSet == null) {
|
||||
// tinkerIdSet = new HashSet<>();
|
||||
// tinkerIdMap.put(tinkerId, tinkerIdSet);
|
||||
// }
|
||||
//
|
||||
// // 有新的补丁,没有显示过
|
||||
// if (!tinkerIdSet.contains(newTinkerId)) {
|
||||
// tinkerIdSet.add(newTinkerId);
|
||||
//
|
||||
// final Dialog dialog = new Dialog(this, R.style.GhAlertDialog);
|
||||
//
|
||||
// View contentView = LayoutInflater.from(this).inflate(R.layout.dialog_alert, null);
|
||||
// TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
||||
// TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
||||
// TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
|
||||
// TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
|
||||
//
|
||||
// titleTv.setText("补丁更新成功");
|
||||
// contentTv.setText(("光环助手已成功更新到V" + PackageUtils.getVersionName() + "-" + newTinkerId));
|
||||
// positiveTv.setText("知道了");
|
||||
// negativeTv.setText(null);
|
||||
//
|
||||
// negativeTv.setOnClickListener(view -> dialog.dismiss());
|
||||
//
|
||||
// positiveTv.setOnClickListener(view -> dialog.dismiss());
|
||||
// dialog.setOnDismissListener(dialog1 -> mSp.edit().putString(Config.PATCHES, gson.toJson(tinkerIdMap)).apply());
|
||||
//
|
||||
// dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
// dialog.setContentView(contentView);
|
||||
// dialog.show();
|
||||
// }
|
||||
}
|
||||
|
||||
private void checkDevice() {
|
||||
String content = DeviceUtils.getUserDevice(MainActivity.this).toString();
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), content);
|
||||
RetrofitManager.getInstance().getApi().checkDevice(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>() {
|
||||
@Override
|
||||
public void onResponse(ResponseBody response) {
|
||||
super.onResponse(response);
|
||||
try {
|
||||
String string = response.string();
|
||||
JSONObject object = new JSONObject(string);
|
||||
String deviceId = object.getString("device_id");
|
||||
if (!TextUtils.isEmpty(deviceId)) {
|
||||
oldUserSkip(deviceId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void oldUserSkip(String deviceId) {
|
||||
mSp.edit().putString("syncDeviceID", deviceId).apply();
|
||||
DialogUtils.showForceDialog(MainActivity.this, "数据同步提醒"
|
||||
, "系统检测到你是光环助手的老用户,为了避免数据丢失,请尽快登录"
|
||||
, "前往登录", "残忍拒绝", () -> EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, INDEX_PERSONAL)), null);
|
||||
}
|
||||
|
||||
// 获取META-INF中的plugin_update 文件,判断是否从游戏插件中下载的app,是则获取游戏id,启动游戏更新,下载该游戏
|
||||
private void getPluginUpdate() {
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
|
||||
Reference in New Issue
Block a user