feat: 实现畅玩游戏更新

This commit is contained in:
juntao
2022-06-10 17:21:56 +08:00
parent 90e947b65d
commit 1eeec1c89b
13 changed files with 145 additions and 53 deletions

View File

@ -31,7 +31,6 @@ import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VHelper;
import com.halo.assistant.HaloApp;
import com.lightgame.download.DownloadEntity;
import com.lightgame.utils.Utils;
@ -112,20 +111,23 @@ public class PackageUtils {
// 是否需要显示更新
boolean shouldShowUpdate = apkEntity.getForce();
// 普通游戏根据本地是否有安装来确定是否 qualified畅玩游戏直接进判断
boolean isUpdateQualified =
gameEntity.isVGame() || (!TextUtils.isEmpty(versionFromRequest) && !TextUtils.isEmpty(versionFromInstalledApp));
if (shouldShowUpdate && !TextUtils.isEmpty(versionFromRequest) && !TextUtils.isEmpty(versionFromInstalledApp)) {
if (shouldShowUpdate && isUpdateQualified) {
// 根据版本判断是否需要更新
shouldShowUpdate = new Version(versionFromRequest).isHigherThan(versionFromInstalledApp);
// 畅玩游戏根据 md5 是否一致确定是否需要更新
if (gameEntity.isVGame()) {
DownloadEntity entity = VHelper.getVGameSnapshot(apkEntity.getPackageName());
DownloadEntity entity = DownloadManager.getInstance().getDownloadEntitySnapshotByPackageName(apkEntity.getPackageName());
if (entity != null) {
String md5FromInstalledVGame = ExtensionsKt.getMetaExtra(entity, Constants.APK_MD5);
String md5FromRequest = apkEntity.getMd5();
if (md5FromRequest!= null && md5FromRequest.equals(md5FromInstalledVGame)) {
if (md5FromRequest != null && !md5FromRequest.equals(md5FromInstalledVGame)) {
shouldShowUpdate = true;
}
}