From 8437c9631625e044b966a4b4c1d4c681bdfdedd2 Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 4 Jan 2024 16:33:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7=20uni-upgrade-center?= =?UTF-8?q?=20=E8=87=B3=200.7.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-upgrade-center-app/changelog.md | 6 ++ .../uni-upgrade-center-app.uvue | 65 ++------------ .../uni-upgrade-center-app/package.json | 4 +- .../pages/upgrade-popup.vue | 8 +- .../uts-progressNotification/changelog.md | 2 + .../uts-progressNotification/package.json | 2 +- .../utssdk/app-ios/config.json | 3 - .../utssdk/app-ios/index.uts | 85 ------------------- 8 files changed, 21 insertions(+), 154 deletions(-) delete mode 100644 uni_modules/uts-progressNotification/utssdk/app-ios/config.json delete mode 100644 uni_modules/uts-progressNotification/utssdk/app-ios/index.uts diff --git a/uni_modules/uni-upgrade-center-app/changelog.md b/uni_modules/uni-upgrade-center-app/changelog.md index ae79e92c..68a219dc 100644 --- a/uni_modules/uni-upgrade-center-app/changelog.md +++ b/uni_modules/uni-upgrade-center-app/changelog.md @@ -1,3 +1,9 @@ +## 0.7.8(2024-01-04) +- 新增 移除无用代码 +## 0.7.7(2024-01-04) +- 新增 uni-app x 项目中新增 @show 回调 +## 0.7.6(2023-12-21) +- 修复 iOS使用升级中心云打包时报错(使用新版的 [uts-progressNotification](https://ext.dcloud.net.cn/plugin?name=uts-progressNotification) 插件,如果之前下载过请删除 `uts-progressNotification\utssdk\app-ios` 文件夹) ## 0.7.5(2023-12-12) - 新增 通知栏进度条使用 uts-progressNotification 插件 - 新增 依赖 uni-installApk、uts-progressNotification。使用前要安装插件三方依赖 diff --git a/uni_modules/uni-upgrade-center-app/components/uni-upgrade-center-app/uni-upgrade-center-app.uvue b/uni_modules/uni-upgrade-center-app/components/uni-upgrade-center-app/uni-upgrade-center-app.uvue index ed0d1aa9..da2165b9 100644 --- a/uni_modules/uni-upgrade-center-app/components/uni-upgrade-center-app/uni-upgrade-center-app.uvue +++ b/uni_modules/uni-upgrade-center-app/components/uni-upgrade-center-app/uni-upgrade-center-app.uvue @@ -67,63 +67,17 @@ import { UniUpgradeCenterResult, StoreListItem } from '../../utils/call-check-version' import { openSchema } from '../../utils/utils.uts' - const localFilePathKey = 'UNI_ADMIN_UPGRADE_CENTER_LOCAL_FILE_PATH' const platform_iOS = 'iOS'; const platform_Android = 'Android'; const requiredKey = ['version', 'url', 'type'] let downloadTask : DownloadTask | null = null; let openSchemePromise: Promise | null = null; - let notificationAbortDownload: boolean = false - - /** - * 对比版本号,如需要,请自行修改判断规则 - * 支持比对 ("3.0.0.0.0.1.0.1", "3.0.0.0.0.1") ("3.0.0.1", "3.0") ("3.1.1", "3.1.1.1") 之类的 - * @param {Object} v1 - * @param {Object} v2 - * v1 > v2 return 1 - * v1 < v2 return -1 - * v1 == v2 return 0 - */ - function compare(v1 : string = '0', v2 : string = '0') : number { - const v1_array = v1.split('.') - const v2_array = v2.split('.') - const minVersionLens = Math.min(v1.length, v2.length); - - let result = 0; - for (let i = 0; i < minVersionLens; i++) { - const curV1 = parseInt(v1_array[i]) - const curV2 = parseInt(v2_array[i]) - - if (curV1 > curV2) { - result = 1 - break; - } else if (curV1 < curV2) { - result = -1 - break; - } - } - - if (result === 0 && (v1_array.length !== v2_array.length)) { - const v1BiggerThenv2 = v1_array.length > v2_array.length; - const maxLensVersion = v1BiggerThenv2 ? v1_array : v2_array; - for (let i = minVersionLens; i < maxLensVersion.length; i++) { - const curVersion = parseInt(maxLensVersion[i]) - if (curVersion > 0) { - v1BiggerThenv2 ? result = 1 : result = -1 - break; - } - } - } - - return result; - } export default { - emits: ['close'], + emits: ['close', 'show'], data() { return { shown: false, - showTabbar: false, // 从之前下载安装 installForBeforeFilePath: '', @@ -177,8 +131,6 @@ show(shown : boolean, localPackageInfo : UniUpgradeCenterResult | null) { if (localPackageInfo === null) return; - uni.hideTabBar()?.then(_ => { this.showTabbar = true })?.catch(_ => { }) - for (let key in localPackageInfo) { if (requiredKey.indexOf(key) != -1 && localPackageInfo[key] === null) { console.error(`参数 ${key} 必填,请检查后重试`) @@ -195,6 +147,8 @@ this.version = localPackageInfo.version this.store_list = localPackageInfo.store_list this.shown = shown + + this.$emit('show') }, askAbortDownload() { uni.showModal({ @@ -227,10 +181,6 @@ }, closePopup() { this.shown = false - if (this.showTabbar) { - uni.showTabBar()?.then(_ => { })?.catch(_ => { }) - } - this.downloadSuccess = false this.downloading = false this.downLoadPercent = 0 @@ -238,15 +188,11 @@ this.packageFileSize = 0 this.tempFilePath = '' - this.installing = false; + this.installing = false this.installed = false - this.showTabbar = false if (this.needNotificationProgress) cancelNotificationProgress() - - if (!notificationAbortDownload) this.$emit('close') - - notificationAbortDownload = false + this.$emit('close') }, updateApp() { const checkStoreScheme = this.checkStoreScheme() @@ -312,7 +258,6 @@ onClick: () => { if (!this.downloadSuccess) { this.askAbortDownload() - notificationAbortDownload = true } } } as CreateNotificationProgressOptions) diff --git a/uni_modules/uni-upgrade-center-app/package.json b/uni_modules/uni-upgrade-center-app/package.json index 5fd22e55..3ede503a 100644 --- a/uni_modules/uni-upgrade-center-app/package.json +++ b/uni_modules/uni-upgrade-center-app/package.json @@ -1,7 +1,7 @@ { "id": "uni-upgrade-center-app", "displayName": "升级中心 uni-upgrade-center - App", - "version": "0.7.5", + "version": "0.7.8", "description": "uni升级中心 - 客户端检查更新", "keywords": [ "uniCloud", @@ -11,7 +11,7 @@ ], "repository": "https://gitee.com/dcloud/uni-upgrade-center/tree/master/uni_modules/uni-upgrade-center-app", "engines": { - "HBuilderX": "^3.2.14" + "HBuilderX": "^3.97" }, "dcloudext": { "sale": { diff --git a/uni_modules/uni-upgrade-center-app/pages/upgrade-popup.vue b/uni_modules/uni-upgrade-center-app/pages/upgrade-popup.vue index dda288cc..4cfdaf10 100644 --- a/uni_modules/uni-upgrade-center-app/pages/upgrade-popup.vue +++ b/uni_modules/uni-upgrade-center-app/pages/upgrade-popup.vue @@ -64,7 +64,9 @@