q***@163.com
q***@163.com
  • 发布:2023-03-07 17:50
  • 更新:2023-03-07 17:50
  • 阅读:218

h5+app,wgt升级后,如何能够删除本次升级记录?再次进行wgt升级?

分类:HTML5+

各位大佬,现在有这么一种需求,wgt升级后,恢复到wgt升级前的版本信息,能够再次进行wgt升级。类似于android手机自带的清空全部数据功能。

目前我的做法是:
首先,H5+编译的app,可以通过plus.runtime获取版本信息。

let that = this  
plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {  
    console.log("apkUpdate")  
    console.log("当前的版本" + wgtinfo.version) // 1.0.2  
    console.log("系统当前的版本" + plus.runtime.version)  // 1.0.1  
    console.log("服务器版本" + that.downVersion) // 1.0.2  
    //  app的wgt和服务器上的wgt版本是否一致,不一致则进行更新  
    if (wgtinfo.version != this.downVersion) {  
        that.updateView(that.downInfo, that.openType) // 更新方法  
    }  
})

2、因为版本不一致,wgt下载、升级成功。当我想通过app内自己写的“清除数据”的功能,清除wgt升级记录,然后获取服务器最新的wgt包,做到可以再次/重新升级的功能,并没有成功,wgt版本信息依旧是app最后升级的那个wgt包,wgt升级记录一直存在。
如代码段1:apk版本是1.0.1,wgt版本是1.0.2,服务器版本是1.0.2。需求是能够通过某种方式,去掉wgt的升级记录和版本,将app恢复到版本1.0.1,可以再次提示有wgt更新,将wgt更新到1.0.2。

window.plus && window.plus.cache.clear(function () {  
    console.log('clear cache success')  
})  
window.plus && window.plus.storage.clearAsync(  
    function () {  
      window.plus && window.plus.navigator.removeAllCookie()  
      console.log('clearAsync success')  
      done()  
    },  
    function (e) {  
      console.log('clearAsync failed: ' + JSON.stringify(e))  
      done()  
    }  
)
2023-03-07 17:50 负责人:无 分享
已邀请:

要回复问题请先登录注册