fix: 修复更新判断异常和首页最近在玩的排序问题

This commit is contained in:
juntao
2022-06-23 17:20:53 +08:00
parent 0af479e441
commit 4e53b1fb91
5 changed files with 38 additions and 21 deletions

View File

@ -120,6 +120,11 @@ public class PackageUtils {
// 根据版本判断是否需要更新
shouldShowUpdate = new Version(versionFromRequest).isHigherThan(versionFromInstalledApp);
// versionName 没法判定的时候尝试使用 versionCode 去判断
if (!shouldShowUpdate && versionCodeFromRequest != 0) {
shouldShowUpdate = versionCodeFromRequest > versionCodeFromInstalledApp;
}
// 畅玩游戏根据 md5 是否一致确定是否需要更新
if (gameEntity.isVGame()) {
DownloadEntity entity = DownloadManager.getInstance().getDownloadEntitySnapshotByPackageName(apkEntity.getPackageName());
@ -127,17 +132,10 @@ public class PackageUtils {
String md5FromInstalledVGame = ExtensionsKt.getMetaExtra(entity, Constants.APK_MD5);
String md5FromRequest = apkEntity.getMd5();
if (md5FromRequest != null && !md5FromRequest.equals(md5FromInstalledVGame)) {
shouldShowUpdate = true;
}
shouldShowUpdate = md5FromRequest != null && !md5FromRequest.equals(md5FromInstalledVGame);
}
}
// versionName 没法判定的时候尝试使用 versionCode 去判断
if (!shouldShowUpdate && versionCodeFromRequest != 0) {
shouldShowUpdate = versionCodeFromRequest > versionCodeFromInstalledApp;
}
if (shouldShowUpdate) {
GameUpdateEntity updateEntity = new GameUpdateEntity();
updateEntity.setId(gameEntity.getId());