This commit is contained in:
chenjuntao
2023-09-12 17:54:07 +08:00
parent d6d0bea491
commit 48a6bd0d2e
106 changed files with 2665 additions and 2356 deletions

View File

@ -41,7 +41,6 @@ import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VHelper;
import com.gh.vspace.db.VGameEntity;
import com.halo.assistant.HaloApp;
import com.lg.vspace.VirtualAppManager;
import com.lightgame.utils.Utils;
import net.dongliu.apk.parser.ApkFile;
@ -110,10 +109,12 @@ public class PackageUtils {
return !(MD5Str.equals(MD5Utils.calculateMD5(file)));
}
/*
* 判断是否可以更新只判断gh_version的大小
/**
* 判断是否可以更新
* @param gameEntity 游戏摘要实体
* @param isVGame 是否为畅玩游戏(走特殊的判断更新逻辑)
*/
public static List<GameUpdateEntity> getUpdateData(GameEntity gameEntity) {
public static List<GameUpdateEntity> getUpdateData(GameEntity gameEntity, boolean isVGame) {
List<GameUpdateEntity> updateList = new ArrayList<>();
@ -169,7 +170,7 @@ public class PackageUtils {
boolean shouldShowUpdate = apkEntity.getForce();
// 普通游戏根据本地是否有安装来确定是否 qualified畅玩游戏直接进判断
boolean isUpdateQualified =
gameEntity.isVGame() || (!TextUtils.isEmpty(versionFromRequest) && !TextUtils.isEmpty(versionFromInstalledApp));
isVGame || (!TextUtils.isEmpty(versionFromRequest) && !TextUtils.isEmpty(versionFromInstalledApp));
if (shouldShowUpdate && isUpdateQualified) {
@ -182,12 +183,11 @@ public class PackageUtils {
}
// 畅玩游戏根据 md5 是否一致确定是否需要更新
if (gameEntity.isVGame()) {
if (isVGame) {
VGameEntity vGameEntity = VHelper.getVGameSnapshot(gameEntity.getId(), apkEntity.getPackageName());
if (vGameEntity != null) {
String md5FromInstalledVGame = ExtensionsKt.getMetaExtra(vGameEntity.getDownloadEntity(), Constants.APK_MD5);
String md5FromRequest = apkEntity.getMd5();
apkEntity.setPlatform(VHelper.PLATFORM_V);
shouldShowUpdate = md5FromRequest != null && !md5FromRequest.equals(md5FromInstalledVGame);
} else {
@ -219,6 +219,7 @@ public class PackageUtils {
updateEntity.setFormat(apkEntity.getFormat());
updateEntity.setSignature(apkEntity.getSignature());
updateEntity.setCategory(gameEntity.getCategory());
updateEntity.setVGameUpdate(isVGame);
updateEntity.setCurrentVersion(PackageUtils.getVersionNameByPackageName(apkEntity.getPackageName()));
if (gameEntity.isLandPageAddressDialog()) {
updateEntity.setLandPageAddressDialog(gameEntity.getLandPageAddressDialog());