V3.0.1优化完成 补丁安装完成要出现弹窗提示->还没测试
This commit is contained in:
@ -37,7 +37,7 @@ public class DataLogUtils {
|
||||
|
||||
// 上传日志
|
||||
public static void uploadLog(Context context, String topic, Map<String, Object> map) {
|
||||
String version = PackageUtils.getVersionName(context);
|
||||
String version = PackageUtils.getPatchVersionName();
|
||||
String user = Installation.getUUID(context);
|
||||
String channel = HaloApp.getInstance().getChannel();
|
||||
map.put("version", version);
|
||||
|
||||
@ -70,6 +70,7 @@ public class DataUtils {
|
||||
StatConfig.init(context);
|
||||
StatConfig.setInstallChannel(channel);
|
||||
StatConfig.setAntoActivityLifecycleStat(true);
|
||||
StatConfig.setAppVersion(PackageUtils.getPatchVersionName());
|
||||
|
||||
StatService.setContext(context);
|
||||
StatService.registerActivityLifecycleCallbacks(context);
|
||||
|
||||
@ -212,7 +212,13 @@ public class DetailDownloadUtils {
|
||||
mGameEntity.getApk().get(0).getUrl(), StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"));
|
||||
mViewHolder.context.startActivity(intent);
|
||||
} else if ("安装".equals(str)) {
|
||||
PackageUtils.launchSetup(mViewHolder.context, mDownloadEntity.getPath());
|
||||
if (mDownloadEntity == null) {
|
||||
mDownloadEntity = DownloadManager.getInstance(mViewHolder.context).getDownloadEntityByUrl( mGameEntity.getApk().get(0).getUrl());
|
||||
}
|
||||
|
||||
if (mDownloadEntity != null) {
|
||||
PackageUtils.launchSetup(mViewHolder.context, mDownloadEntity.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -272,10 +273,13 @@ public class LibaoUtils {
|
||||
Utils.toast(context, "没到重复淘号时间, 礼包每天0点刷新");
|
||||
return;
|
||||
}
|
||||
final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "淘号中...");
|
||||
postLibaoTao(context, libaoEntity.getId(), new PostLibaoListener() {
|
||||
@Override
|
||||
public void postSucced(Object response) {
|
||||
|
||||
if (loadingDialog != null) loadingDialog.dismiss();
|
||||
|
||||
JSONObject responseBody = (JSONObject) response;
|
||||
Utils.log("postLibaoTao=====" + responseBody);
|
||||
String libaoCode = null;
|
||||
@ -342,13 +346,15 @@ public class LibaoUtils {
|
||||
public void postFailed(Throwable error) {
|
||||
Utils.log("---" + error.toString());
|
||||
|
||||
if (loadingDialog != null) loadingDialog.dismiss();
|
||||
|
||||
if (error instanceof HttpException) {
|
||||
HttpException exception = (HttpException) error;
|
||||
if (exception.code() == 403) {
|
||||
try {
|
||||
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
|
||||
String detail = errorJson.getString("detail");
|
||||
Utils.toast(context, "返回::" + detail);
|
||||
// Utils.toast(context, "返回::" + detail);
|
||||
switch (detail) {
|
||||
case "coming":
|
||||
Utils.toast(context, "礼包领取时间未开始");
|
||||
@ -357,7 +363,7 @@ public class LibaoUtils {
|
||||
Utils.toast(context, "礼包领取时间已结束");
|
||||
break;
|
||||
case "fetched":
|
||||
Utils.toast(context, "你已领过这个礼包了");
|
||||
Utils.toast(context, "你今天已领过这个礼包了, 不能再淘号");
|
||||
|
||||
libaoBtn.setText("已淘号");
|
||||
libaoBtn.setBackgroundResource(R.drawable.libao_taoed_style);
|
||||
@ -405,9 +411,12 @@ public class LibaoUtils {
|
||||
Log.e("LIBAO", "context? " + context + libaoBtn.getContext());
|
||||
}
|
||||
|
||||
final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "领取中...");
|
||||
|
||||
postLibaoLing(context, libaoEntity.getId(), new PostLibaoListener() {
|
||||
@Override
|
||||
public void postSucced(Object response) {
|
||||
if (loadingDialog != null) loadingDialog.dismiss();
|
||||
|
||||
JSONObject responseBody = (JSONObject) response;
|
||||
Utils.log("postLibaoLing=====" + responseBody);
|
||||
@ -432,7 +441,7 @@ public class LibaoUtils {
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
final String finalLibaoCode = libaoCode;
|
||||
DialogUtils.showWarningDialog(context, "领取成功", Html.fromHtml( context.getString(R.string.linged_dialog, libaoCode))
|
||||
DialogUtils.showWarningDialog(context, "领取成功", Html.fromHtml(context.getString(R.string.linged_dialog, libaoCode))
|
||||
, "关闭", " 复制礼包码"
|
||||
, new DialogUtils.ConfirmListener() {
|
||||
@Override
|
||||
@ -444,7 +453,7 @@ public class LibaoUtils {
|
||||
public void run() {
|
||||
Spanned msg = Html.fromHtml(context.getString(R.string.linged_copy_dialog, finalLibaoCode));
|
||||
lunningAppDialog(context
|
||||
,msg, libaoEntity);
|
||||
, msg, libaoEntity);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
@ -454,6 +463,7 @@ public class LibaoUtils {
|
||||
|
||||
@Override
|
||||
public void postFailed(Throwable error) {
|
||||
if (loadingDialog != null) loadingDialog.dismiss();
|
||||
|
||||
if (error instanceof HttpException) {
|
||||
HttpException exception = (HttpException) error;
|
||||
|
||||
@ -12,6 +12,7 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
@ -201,6 +202,16 @@ public class PackageUtils {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据统计或反馈用PatchVersionName
|
||||
* 判断助手是否是第一次启动或版本更新提交的版本号用AppVersionName{@link PackageUtils#getVersionName(Context)}
|
||||
*
|
||||
* @return 补丁包版本号
|
||||
*/
|
||||
public static String getPatchVersionName() {
|
||||
return Config.PATCH_VERSION_NAME;
|
||||
}
|
||||
|
||||
/*
|
||||
* 返回光环助手的版本信息
|
||||
*/
|
||||
|
||||
@ -91,17 +91,14 @@ public class DownloadDialog implements OnCollectionCallBackListener {
|
||||
private boolean isLoadPlatform;
|
||||
|
||||
private DownloadDialog() {
|
||||
}
|
||||
|
||||
private DownloadDialog(Context context) {
|
||||
mContext = context;
|
||||
isShow = false;
|
||||
}
|
||||
|
||||
public static DownloadDialog getInstance(Context context) {
|
||||
if (instance == null) {
|
||||
instance = new DownloadDialog(context);
|
||||
instance = new DownloadDialog();
|
||||
}
|
||||
instance.mContext = context; // 每次创建context重新赋值, Dialog持有context问题
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.gamecenter.manager.UpdateManager;
|
||||
|
||||
@ -52,7 +52,7 @@ public class AboutActivity extends BaseActivity {
|
||||
initTitle(getString(R.string.title_about));
|
||||
|
||||
// ((TextView) findViewById(R.id.about_tv_version)).setText("V" + PackageUtils.getVersionName(this));
|
||||
((TextView) findViewById(R.id.about_tv_version)).setText(Config.PATCH_VERSION_NAME); // TODO 版本号暂时与gradle versionName不一致
|
||||
((TextView) findViewById(R.id.about_tv_version)).setText("V" + PackageUtils.getPatchVersionName()); // TODO 版本号暂时与gradle versionName不一致
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -263,7 +263,15 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
curStatusCount++;
|
||||
}
|
||||
}
|
||||
if (repeat <= curStatusCount) return; // 当前领取/淘号总数是否超过总重复领取次数
|
||||
if (repeat <= curStatusCount || curStatusCount == 0) { // 当前领取/淘号总数是否超过总重复领取次数 / 当前状态的礼包没有领取/淘号过
|
||||
if (curStatusCount == 0 && ("ling".equals(beforeStatus) || "tao".equals(beforeStatus))) {
|
||||
if (isCanLing()) { // 恢复原始状态
|
||||
mLibaoEntity.setStatus(beforeStatus);
|
||||
mAdapter.notifyItemChanged(0);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((("linged").equals(status) || ("taoed").equals(status)) &&
|
||||
|
||||
@ -61,6 +61,8 @@ import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
import com.lightgame.download.FileUtils;
|
||||
import com.lightgame.utils.Utils;
|
||||
import com.tencent.bugly.beta.Beta;
|
||||
import com.tencent.bugly.beta.UpgradeInfo;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -681,6 +683,21 @@ public class MainActivity extends BaseActivity {
|
||||
}, null);
|
||||
}
|
||||
|
||||
checkTinkerPath();
|
||||
}
|
||||
|
||||
private void checkTinkerPath() {
|
||||
UpgradeInfo upgradeInfo = Beta.getUpgradeInfo();
|
||||
if (upgradeInfo != null) {
|
||||
String newPatchVN = upgradeInfo.versionName;
|
||||
String oldPatchVN = sp.getString("patchVersionName", "");
|
||||
if (!oldPatchVN.equals(newPatchVN)) {
|
||||
DialogUtils.showWarningDialog(this, "补丁更新成功"
|
||||
, "光环助手已成功更新到V" + PackageUtils.getPatchVersionName()
|
||||
, null, "知道了", null, null);
|
||||
sp.edit().putString("patchVersionName", newPatchVN).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -508,7 +508,7 @@ public class SuggestionActivity extends BaseActivity implements SuggestTypeAdapt
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("message", mSuggestContentEt.getText().toString().trim());
|
||||
params.put("from", email);
|
||||
params.put("ghversion", PackageUtils.getVersionName(this));
|
||||
params.put("ghversion", PackageUtils.getPatchVersionName());
|
||||
params.put("channel", HaloApp.getInstance().getChannel());
|
||||
params.put("type", android.os.Build.MODEL);
|
||||
params.put("sdk", String.valueOf(android.os.Build.VERSION.SDK_INT));
|
||||
|
||||
@ -58,7 +58,7 @@ public class DataCollectionManager {
|
||||
* 实时上传
|
||||
*/
|
||||
private void realTimeUpload(final String type, Map<String, Object> map) {
|
||||
String version = PackageUtils.getVersionName(mContext);
|
||||
String version = PackageUtils.getPatchVersionName();
|
||||
String user = Installation.getUUID(mContext);
|
||||
String channel = HaloApp.getInstance().getChannel();
|
||||
map.put("version", version);
|
||||
@ -138,7 +138,7 @@ public class DataCollectionManager {
|
||||
|
||||
final List<String> ids = new ArrayList<>();
|
||||
|
||||
String version = PackageUtils.getVersionName(mContext);
|
||||
String version = PackageUtils.getPatchVersionName();
|
||||
String user = Installation.getUUID(mContext);
|
||||
String channel = HaloApp.getInstance().getChannel();
|
||||
|
||||
|
||||
@ -19,12 +19,14 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.common.view.DownloadDialog;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBSearch;
|
||||
import com.gh.gamecenter.manager.GameManager;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
@ -78,7 +80,12 @@ class SearchGameDetailFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
@Override
|
||||
public void onResponse(List<GameEntity> response) {
|
||||
if (response.size() != 0) {
|
||||
GameManager manager = new GameManager(mContext);
|
||||
for (GameEntity gameEntity : response) {
|
||||
// 初始化游戏状态
|
||||
gameEntity.setEntryMap(DownloadManager.getInstance(mContext).getEntryMap(gameEntity.getName()));
|
||||
manager.addOrUpdate(gameEntity.getApk(), gameEntity.getId(), gameEntity.getName());
|
||||
|
||||
ApkActiveUtils.filterHideApk(gameEntity);
|
||||
}
|
||||
if (listener != null) {
|
||||
|
||||
@ -19,6 +19,7 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.common.view.DownloadDialog;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
@ -27,6 +28,7 @@ import com.gh.gamecenter.db.SearchHistoryDao;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBSearch;
|
||||
import com.gh.gamecenter.manager.GameManager;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
@ -84,7 +86,12 @@ class SearchGameListFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
@Override
|
||||
public void onResponse(List<GameEntity> response) {
|
||||
if (response.size() != 0) {
|
||||
GameManager manager = new GameManager(mContext);
|
||||
for (GameEntity gameEntity : response) {
|
||||
// 初始化游戏状态
|
||||
gameEntity.setEntryMap(DownloadManager.getInstance(mContext).getEntryMap(gameEntity.getName()));
|
||||
manager.addOrUpdate(gameEntity.getApk(), gameEntity.getId(), gameEntity.getName());
|
||||
|
||||
ApkActiveUtils.filterHideApk(gameEntity);
|
||||
}
|
||||
if (listener != null) {
|
||||
|
||||
Reference in New Issue
Block a user