fix: 32位畅玩游戏下载流程—0529测试 https://jira.shanqu.cc/browse/CWZS-65
This commit is contained in:
@ -11,6 +11,8 @@ class AppEntity(
|
||||
@SerializedName("version_code")
|
||||
var versionCode: Int = 0,
|
||||
|
||||
var category: String? = "",
|
||||
|
||||
var url: String? = null,
|
||||
|
||||
var size: String? = null,
|
||||
|
||||
@ -65,7 +65,8 @@ object VHelper {
|
||||
// 畅玩游戏是否已被使用过
|
||||
private const val KEY_V_IS_USED = "v_is_used"
|
||||
private const val KEY_LAST_PLAYED_TIME = "last_played_time"
|
||||
private const val KEY_LAST_ALERT_UPDATE_URL = "last_alert_update_url"
|
||||
private const val KEY_LAST_ALERT_64_UPDATE_URL = "last_alert_64_update_url"
|
||||
private const val KEY_LAST_ALERT_32_UPDATE_URL = "last_alert_32_update_url"
|
||||
private const val KEY_TOTAL_PLAYED_TIME = "total_played_time"
|
||||
|
||||
private const val G_GMS_PACKAGE_NAME = "com.google.android.gms"
|
||||
@ -509,15 +510,19 @@ object VHelper {
|
||||
// 检查关联64位是否需要更新
|
||||
if (m32UpdateEntity?.relation != null) {
|
||||
containsRelated64Update =
|
||||
shouldShowVSpaceUpdate(m32UpdateEntity?.relation, installed64SpaceVersionCode)
|
||||
shouldShowVSpaceUpdate(m32UpdateEntity?.relation, installed64SpaceVersionCode, true)
|
||||
}
|
||||
}
|
||||
|
||||
if (contains32Update || contains64Update) {
|
||||
val updateEntity = if (contains64Update) m64UpdateEntity else m32UpdateEntity
|
||||
val gameBit = gameEntity?.getApk()?.get(0)?.bit
|
||||
val updateEntity = if (gameBit == "32" && contains32Update) m32UpdateEntity else m64UpdateEntity
|
||||
val dialogType = if (updateEntity!!.isAlertEveryTime()) "强制更新" else "提示更新"
|
||||
NewFlatLogUtils.logHaloFunEvent("halo_fun_update_dialog_show")
|
||||
SPUtils.setString(KEY_LAST_ALERT_UPDATE_URL, updateEntity.url + updateEntity.alert)
|
||||
SPUtils.setString(
|
||||
if (updateEntity.category == "32-bit") KEY_LAST_ALERT_32_UPDATE_URL else KEY_LAST_ALERT_64_UPDATE_URL,
|
||||
updateEntity.url + updateEntity.alert
|
||||
)
|
||||
DialogHelper.showDialog(
|
||||
context = context,
|
||||
title = "服务工具更新提示",
|
||||
@ -527,17 +532,24 @@ object VHelper {
|
||||
cancelClickCallback = {
|
||||
NewFlatLogUtils.logHaloFunUpdateDialogClick(dialogType, "立即更新")
|
||||
val appEntity64 =
|
||||
if (contains32Update && containsRelated64Update) {
|
||||
// 对比32位关联的64位更新与64位单独更新推送的版本号
|
||||
if (gameBit == "32" && contains32Update && m32UpdateEntity?.relation != null) {
|
||||
// 32位游戏且包含32位更新和32位关联64位更新
|
||||
// 存在64位单独更新时对比32位关联的64位更新与64位单独更新推送的版本号
|
||||
if (contains64Update && (m64UpdateEntity?.versionCode
|
||||
?: 0) > (m32UpdateEntity?.relation?.versionCode ?: 0)
|
||||
) {
|
||||
// 64位单独更新版本号更高时使用64位单独更新
|
||||
m64UpdateEntity
|
||||
} else {
|
||||
} else if (containsRelated64Update) {
|
||||
// 不存在64位单独更新或32位关联64位更新版本号更高
|
||||
// 对比已安装版本号和32位关联的64位更新版本号,32位关联的64位更新版本号更高时使用32位关联的64位更新
|
||||
m32UpdateEntity?.relation
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else if (contains64Update) {
|
||||
updateEntity
|
||||
} else if (gameBit != "32" && contains64Update) {
|
||||
// 64位游戏且包含64位单独更新
|
||||
m64UpdateEntity
|
||||
} else {
|
||||
null
|
||||
}
|
||||
@ -1381,7 +1393,8 @@ object VHelper {
|
||||
*/
|
||||
private fun shouldShowVSpaceUpdate(
|
||||
updateEntity: AppEntity?,
|
||||
installedSpaceVersionCode: Int
|
||||
installedSpaceVersionCode: Int,
|
||||
isRelatedUpdate: Boolean = false
|
||||
): Boolean {
|
||||
if (updateEntity == null) return false
|
||||
|
||||
@ -1389,11 +1402,14 @@ object VHelper {
|
||||
|
||||
if (!hasNewerVersion) return false
|
||||
|
||||
// 关联更新忽略检查上次提示更新
|
||||
if (isRelatedUpdate) return true
|
||||
|
||||
if (updateEntity.isAlertEveryTime()) return true
|
||||
|
||||
val lastAlertUpdateUrl = updateEntity.url + updateEntity.alert
|
||||
if (updateEntity.isAlertOnceADay()
|
||||
&& SPUtils.getString(KEY_LAST_ALERT_UPDATE_URL) != lastAlertUpdateUrl
|
||||
&& SPUtils.getString(if (updateEntity.category == "32-bit") KEY_LAST_ALERT_32_UPDATE_URL else KEY_LAST_ALERT_64_UPDATE_URL) != lastAlertUpdateUrl
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user