提交 432a3fe4 作者: 方治民

fix: 修复版本更新插件的异常问题

上级 3a54e42d
## 0.6.4(2023-09-01)
chore: 优化代码结构
## 0.6.3(2023-08-30)
- 修复 下载 wgt 时如果后缀名不正确,重命名后安装
## 0.6.2(2022-11-21)
......
{
"displayName": "升级中心 uni-upgrade-center - App",
"version": "0.6.3",
"version": "0.6.4",
"description": "uni升级中心 - 客户端检查更新",
"keywords": [
"uniCloud",
......
......@@ -281,15 +281,16 @@
if (res.statusCode == 200) {
this.downloadSuccess = true;
// fix: wgt 文件下载完成后后缀不是 wgt
if (this.isWGT && res.tempFilePath.split('.').slice(-1) !== 'wgt') {
if (this.isWGT && !res.tempFilePath.endsWith('.wgt')) {
const failCallback = (e) => {
console.log('[FILE RENAME FAIL]:', JSON.stringify(e));
}
plus.io.resolveLocalFileSystemURL(res.tempFilePath, function(entry) {
plus.io.resolveLocalFileSystemURL(res.tempFilePath, (entry) => {
const originName = entry.name
entry.getParent((parent) => {
const newName = `new_wgt_${Date.now()}.wgt`
entry.copyTo(parent, newName, (res) => {
this.tempFilePath = res.fullPath
entry.copyTo(parent, newName, (result) => {
this.tempFilePath = res.tempFilePath.replace(originName, newName)
this.downLoadComplete()
}, failCallback)
}, failCallback)
......@@ -328,6 +329,7 @@
if (this.isWGT) {
this.installing = true;
}
plus.runtime.install(this.tempFilePath, {
force: false
}, async res => {
......@@ -451,7 +453,8 @@
background-color: #fff;
box-sizing: border-box;
padding: 0 50rpx;
font-family: Source Han Sans CN;
font-family: -apple-system-font, BlinkMacSystemFont, 'Droid Sans', 'Noto Sans', 'PingFang SC', 'Heiti SC',
'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', SimSun, sans-serif;
}
.text {
......
......@@ -8,12 +8,6 @@ export default function() {
appVersion: plus.runtime.version,
wgtVersion: widgetInfo.version
}
data = {
"action": "checkVersion",
"appid": "__UNI__TEST__",
"appVersion": "1.0",
"wgtVersion": "1.0"
}
uniCloud.callFunction({
name: 'uni-upgrade-center',
data,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论