提交 432a3fe4 作者: 方治民

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

上级 3a54e42d
## 0.6.4(2023-09-01)
chore: 优化代码结构
## 0.6.3(2023-08-30) ## 0.6.3(2023-08-30)
- 修复 下载 wgt 时如果后缀名不正确,重命名后安装 - 修复 下载 wgt 时如果后缀名不正确,重命名后安装
## 0.6.2(2022-11-21) ## 0.6.2(2022-11-21)
......
{ {
"displayName": "升级中心 uni-upgrade-center - App", "displayName": "升级中心 uni-upgrade-center - App",
"version": "0.6.3", "version": "0.6.4",
"description": "uni升级中心 - 客户端检查更新", "description": "uni升级中心 - 客户端检查更新",
"keywords": [ "keywords": [
"uniCloud", "uniCloud",
......
...@@ -281,16 +281,17 @@ ...@@ -281,16 +281,17 @@
if (res.statusCode == 200) { if (res.statusCode == 200) {
this.downloadSuccess = true; this.downloadSuccess = true;
// fix: wgt 文件下载完成后后缀不是 wgt // fix: wgt 文件下载完成后后缀不是 wgt
if (this.isWGT && res.tempFilePath.split('.').slice(-1) !== 'wgt') { if (this.isWGT && !res.tempFilePath.endsWith('.wgt')) {
const failCallback = (e) => { const failCallback = (e) => {
console.log('[FILE RENAME FAIL]:', JSON.stringify(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) => { entry.getParent((parent) => {
const newName = `new_wgt_${Date.now()}.wgt` const newName = `new_wgt_${Date.now()}.wgt`
entry.copyTo(parent, newName, (res) => { entry.copyTo(parent, newName, (result) => {
this.tempFilePath = res.fullPath this.tempFilePath = res.tempFilePath.replace(originName, newName)
this.downLoadComplete() this.downLoadComplete()
}, failCallback) }, failCallback)
}, failCallback) }, failCallback)
}, failCallback); }, failCallback);
...@@ -310,11 +311,11 @@ ...@@ -310,11 +311,11 @@
}, },
downLoadComplete() { downLoadComplete() {
this.downloading = false; this.downloading = false;
this.downLoadPercent = 0 this.downLoadPercent = 0
this.downloadedSize = 0 this.downloadedSize = 0
this.packageFileSize = 0 this.packageFileSize = 0
downloadTask = null; downloadTask = null;
// 强制更新,直接安装 // 强制更新,直接安装
...@@ -328,6 +329,7 @@ ...@@ -328,6 +329,7 @@
if (this.isWGT) { if (this.isWGT) {
this.installing = true; this.installing = true;
} }
plus.runtime.install(this.tempFilePath, { plus.runtime.install(this.tempFilePath, {
force: false force: false
}, async res => { }, async res => {
...@@ -451,7 +453,8 @@ ...@@ -451,7 +453,8 @@
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
padding: 0 50rpx; 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 { .text {
...@@ -551,4 +554,4 @@ ...@@ -551,4 +554,4 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
</style> </style>
\ No newline at end of file
...@@ -8,12 +8,6 @@ export default function() { ...@@ -8,12 +8,6 @@ export default function() {
appVersion: plus.runtime.version, appVersion: plus.runtime.version,
wgtVersion: widgetInfo.version wgtVersion: widgetInfo.version
} }
data = {
"action": "checkVersion",
"appid": "__UNI__TEST__",
"appVersion": "1.0",
"wgtVersion": "1.0"
}
uniCloud.callFunction({ uniCloud.callFunction({
name: 'uni-upgrade-center', name: 'uni-upgrade-center',
data, data,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论