fix: debug variant cannot use plugin files from server.

This commit is contained in:
yangfei
2024-03-13 11:46:40 +08:00
parent 807695f5cf
commit f11e34f815
2 changed files with 7 additions and 2 deletions

View File

@ -2001,10 +2001,13 @@ object VHelper {
@SuppressLint("CheckResult")
fun preparePluginUpdate() {
if(com.gh.gamecenter.BuildConfig.DEBUG) {
Utils.log(LOG_TAG, "开发者需要插件更新功能请push文件到手机或者【修改插件打包的配置为debug版本然后上传推送】")
return
}
Config.vNewSettingSubject.debounce(2, TimeUnit.SECONDS).doOnNext {
it?.vaPlugin?.let { vaPlugin ->
if (!vaPlugin.id.isNullOrEmpty()) {
Utils.log(LOG_TAG, "开发者需要插件更新功能请push文件到手机或者【修改插件打包的配置为debug版本然后上传推送】")
if (!vaPlugin.url64.isNullOrEmpty()) {
val installedPluginVersion = HostUtils.getPluginVersion()
if (installedPluginVersion?.isNotEmpty() == true
@ -2036,6 +2039,7 @@ object VHelper {
val currentPluginFile = File(HaloApp.getInstance().cacheDir, pluginFileName)
if (currentPluginFile.exists() && PluginFileUtils.isZipFile(currentPluginFile)) {
// 已经下载好了
Utils.log(LOG_TAG, "id:${id} file exists.")
fn(currentPluginFile)
} else {
val currentDownloadEntity = DownloadMessageHandler.findEntity(id)
@ -2066,6 +2070,7 @@ object VHelper {
override fun onStatusChanged(status: DownloadStatus) {
if (status == DownloadStatus.COMPLETED) {
Utils.log(LOG_TAG, "id:${id} file download complete.")
fn(currentPluginFile)
DownloadMessageHandler.unregisterListener(id, this)
}