[2.15.0] 优化obu升级

This commit is contained in:
lixiaopeng
2023-04-21 14:51:38 +08:00
parent 820c2fc0ac
commit aacc17446d
3 changed files with 15 additions and 36 deletions

View File

@@ -99,6 +99,7 @@ class UpgradeManager : IDownload {
}
override fun onFinished(downloadUrl: String?, threadBean: ThreadBean?, localPath: String) {
Log.d(TAG, "onFinished downloadUrl = $downloadUrl")
if (downloadUrl == null) {
return
}
@@ -244,14 +245,20 @@ class UpgradeManager : IDownload {
}
override fun onProgress(url: String?, length: Int) {
// CallerLogger.d("$M_DEVA$TAG", "updateUpgradeProgress onPause ----> length = $length")
if (length in 1..99) {
updateStatusBarDownloadView(true, "download", length)
val type = types[url]
if (type == APK || type == PATCH) {
if (length in 1..99) {
updateStatusBarDownloadView(true, "download", length)
}
}
}
override fun onFinished(url: String?, localPath: String) {
UiThreadHandler.postDelayed({
updateStatusBarDownloadView(false, "download", 100)
val type = types[url]
if (type == APK || type == PATCH) {
updateStatusBarDownloadView(false, "download", 100)
}
}, 1000)
}
@@ -271,7 +278,6 @@ class UpgradeManager : IDownload {
//下载完成,解压文件
try {
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", " onFinished localPath = $localPath")
Log.d("liyz", " onFinished localPath = $localPath")
val dest = File(localPath)
val files = ZipUtils.unzipFile(localPath, Config.downLoadUnzipObuPath)
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", " onFinished file = ${Config.downLoadObuPath + dest.name} -----files = $files ")
@@ -295,32 +301,4 @@ class UpgradeManager : IDownload {
e.printStackTrace()
}
}
/**
* obu升级包下载监听
*/
// fun updateObuUpgradeStatus(context: Context) {
// CallerDevaToolsUpgradeListenerManager.addListener(
// TAG,
// object : IMogoDevaToolsUpgradeListener {
// override fun onStart(url: String?) {
// CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "----updateObuUpgradeStatus onStart ")
// }
// override fun onPause(url: String?) {
// CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "----updateObuUpgradeStatus onPause ")
// }
// override fun onProgress(url: String?, length: Int) {
// }
//
// override fun onFinished(url: String?, localPath: String) {
//
// }
//
// override fun onError(url: String?, errorMsg: String?) {
// CallerLogger.e("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "----updateObuUpgradeStatus errorMsg = $errorMsg ")
// //下载失败,删除文件夹
// CallerObuApiManager.deleteObuFile()
// }
// })
// }
}