修复因改版造成的下载数据(新)下载事件缺失的问题 https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/877
This commit is contained in:
@ -51,7 +51,7 @@ public class PackageUtils {
|
||||
/*
|
||||
* 判断是否可以更新,只判断gh_version的大小
|
||||
*/
|
||||
public static List<GameUpdateEntity> getUpdateData(Context context, GameEntity gameEntity) {
|
||||
public static List<GameUpdateEntity> getUpdateData(GameEntity gameEntity) {
|
||||
|
||||
List<GameUpdateEntity> updateList = new ArrayList<>();
|
||||
|
||||
@ -88,14 +88,14 @@ public class PackageUtils {
|
||||
String versionFromInstalledApp = getVersionByPackage(apkEntity.getPackageName());
|
||||
|
||||
// 是否需要显示更新
|
||||
boolean shouldShouldUpdate = apkEntity.getForce();
|
||||
boolean shouldShowUpdate = apkEntity.getForce();
|
||||
|
||||
if (shouldShouldUpdate && !TextUtils.isEmpty(versionFromRequest) && !TextUtils.isEmpty(versionFromInstalledApp)) {
|
||||
if (shouldShowUpdate && !TextUtils.isEmpty(versionFromRequest) && !TextUtils.isEmpty(versionFromInstalledApp)) {
|
||||
|
||||
// 根据版本判断是否需要更新
|
||||
shouldShouldUpdate = new Version(versionFromRequest).isHigherThan(versionFromInstalledApp);
|
||||
shouldShowUpdate = new Version(versionFromRequest).isHigherThan(versionFromInstalledApp);
|
||||
|
||||
if (shouldShouldUpdate) {
|
||||
if (shouldShowUpdate) {
|
||||
GameUpdateEntity updateEntity = new GameUpdateEntity();
|
||||
updateEntity.setId(gameEntity.getId());
|
||||
updateEntity.setName(gameEntity.getName());
|
||||
@ -153,7 +153,7 @@ public class PackageUtils {
|
||||
/*
|
||||
* 判断是否是插件包
|
||||
*/
|
||||
public static boolean isSignature(Context context, String packageName) {
|
||||
public static boolean isSignedByGh(Context context, String packageName) {
|
||||
String signature = getApkSignatureByPackageName(context, packageName);
|
||||
return publicKey.equals(signature);
|
||||
}
|
||||
@ -504,7 +504,7 @@ public class PackageUtils {
|
||||
/**
|
||||
* todo 统一判断
|
||||
* <p>
|
||||
* 判断游戏包是否可以更新
|
||||
* 判断游戏包(插件包) 是否可以更新
|
||||
*
|
||||
* @param apkEntity apkEntity 必须是已安装的游戏
|
||||
* @param gameId 游戏id
|
||||
@ -549,6 +549,6 @@ public class PackageUtils {
|
||||
return PackageUtils.isInstalled(HaloApp.getInstance().getApplication(), apkEntity.getPackageName())
|
||||
&& gh_id == null
|
||||
&& !TextUtils.isEmpty(apkEntity.getGhVersion())
|
||||
&& !PackageUtils.isSignature(HaloApp.getInstance().getApplication(), apkEntity.getPackageName());
|
||||
&& !PackageUtils.isSignedByGh(HaloApp.getInstance().getApplication(), apkEntity.getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user