[dev_arch_opt_3.0] 添加删除文件逻辑
This commit is contained in:
@@ -81,4 +81,8 @@ class MoGoObuProvider : IMoGoObuProvider {
|
||||
override fun uploadObuPack(filePathArray: Array<String>) {
|
||||
MogoPrivateObuNewManager.INSTANCE.uploadObuPack(filePathArray)
|
||||
}
|
||||
|
||||
override fun deleteObuFile() {
|
||||
MogoPrivateObuNewManager.INSTANCE.deleteObuFile()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.datacenter.obu
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.*
|
||||
@@ -104,10 +103,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_CHECK_FAILED || status == ObuSoftwareUpgradeStatus.PACKAGE_UPLOAD_FAILED
|
||||
|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FAILED || status == ObuSoftwareUpgradeStatus.UNKNOWN) {
|
||||
|
||||
UiThreadHandler.post {
|
||||
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
|
||||
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
|
||||
}
|
||||
deleteObuFile()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +118,17 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除obu相关的文件夹
|
||||
*/
|
||||
fun deleteObuFile(){
|
||||
UiThreadHandler.post {
|
||||
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
|
||||
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听obu
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhjt.mogo_core_function_devatools.upgrade
|
||||
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst
|
||||
@@ -18,7 +17,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.FileUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ZipUtils
|
||||
import java.io.IOException
|
||||
|
||||
@@ -159,7 +157,8 @@ class UpgradeManager : IDownload {
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
override fun onError(url: String?, errorMsg: String?) {}
|
||||
override fun onError(url: String?, errorMsg: String?) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -194,16 +193,15 @@ class UpgradeManager : IDownload {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "updateObuUpgradeStatus ---md5Path = $md5Path -----tarPath = $tarPath ")
|
||||
CallerObuApiManager.uploadObuPack(arrayOf(md5Path, tarPath))
|
||||
} catch (e: IOException) {
|
||||
//解压失败
|
||||
com.mogo.eagle.core.utilcode.util.UiThreadHandler.post {
|
||||
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
|
||||
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
|
||||
}
|
||||
//解压失败,删除文件夹
|
||||
CallerObuApiManager.deleteObuFile()
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(url: String?, errorMsg: String?) {
|
||||
//下载失败,删除文件夹
|
||||
CallerObuApiManager.deleteObuFile()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user