[3.2.0][应用升级] 优化升级弹窗展示逻辑,防止Activity未创建导致崩溃
This commit is contained in:
@@ -146,7 +146,15 @@ class UpgradeAppNetWorkManager private constructor() {
|
||||
Log.d("ApkInstaller", "EB5设备,直接走静默,不弹窗...")
|
||||
CallerDevaToolsManager.downLoadPackage(if (isGoFullUpgrade) APK else PATCH, downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1), downloadUrl)
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
var activity = AppStateManager.currentActivity()
|
||||
while (activity == null) {
|
||||
delay(2000)
|
||||
activity = AppStateManager.currentActivity()
|
||||
if (activity != null) {
|
||||
break
|
||||
}
|
||||
}
|
||||
activity?.lifeCycleScope?.launchWhenResumed {
|
||||
showUpgradeDialog(downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1), downloadUrl, info.result.installTitle, info.result.installContent, info.result.installType)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user