已合并
hap master 同步 Release 6.0 #74
zouyousong创建于 2025年9月26日
hap master 同步 Release 6.0 #74
已合并
共 56 个文件变更+852-1687
| @@ -3,8 +3,8 @@ | |||
| 3 | "bundleName": "com.ohos.updateapp", | 3 | "bundleName": "com.ohos.updateapp", |
| 4 | "debug": false, | 4 | "debug": false, |
| 5 | "vendor": "example", | 5 | "vendor": "example", |
| 6 | - "versionCode": 2040000127, | 6 | + "versionCode": 2040000128, |
| 7 | - "versionName": "204.0.0.127", | 7 | + "versionName": "204.0.0.128", |
| 8 | "icon": "$media:app_icon", | 8 | "icon": "$media:app_icon", |
| 9 | "label": "$string:app_name", | 9 | "label": "$string:app_name", |
| 10 | "distributedNotificationEnabled": true | 10 | "distributedNotificationEnabled": true |
| @@ -1,11 +1,18 @@ | |||
| 1 | { | 1 | { |
| 2 | "app": { | 2 | "app": { |
| 3 | - "compileSdkVersion": 10, | ||
| 4 | - "compatibleSdkVersion": 10, | ||
| 5 | "products": [ | 3 | "products": [ |
| 6 | { | 4 | { |
| 7 | "name": "default", | 5 | "name": "default", |
| 8 | "signingConfig": "release", | 6 | "signingConfig": "release", |
| 7 | + "compileSdkVersion": 20, | ||
| 8 | + "compatibleSdkVersion": 20, | ||
| 9 | + "runtimeOS": "OpenHarmony", | ||
| 10 | + "buildOption": { | ||
| 11 | + "strictMode": { | ||
| 12 | + "caseSensitiveCheck": true, | ||
| 13 | + "useNormalizedOHMUrl": true | ||
| 14 | + } | ||
| 15 | + } | ||
| 9 | } | 16 | } |
| 10 | ] | 17 | ] |
| 11 | }, | 18 | }, |
| @@ -1,31 +0,0 @@ | |||
| 1 | -/* | ||
| 2 | - * Copyright (c) 2023 Huawei Device Co., Ltd. | ||
| 3 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | - * you may not use this file except in compliance with the License. | ||
| 5 | - * You may obtain a copy of the License at | ||
| 6 | - * | ||
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | - * | ||
| 9 | - * Unless required by applicable law or agreed to in writing, software | ||
| 10 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | - * See the License for the specific language governing permissions and | ||
| 13 | - * limitations under the License. | ||
| 14 | - */ | ||
| 15 | - | ||
| 16 | -export { CheckingDots } from './src/main/ets/component/CheckingDots'; | ||
| 17 | -export { HomeCardView } from './src/main/ets/component/HomeCardView'; | ||
| 18 | -export { TitleBar } from './src/main/ets/component/TitleBar'; | ||
| 19 | - | ||
| 20 | -export { UpdateState, OtaStatus, ErrorCode, UpdateConstant, Changelog, Language, | ||
| 21 | - Features, Feature, Icon, ChangelogType, Action, UpgradeData, UpgradeCallResult, PACKAGE_NAME, | ||
| 22 | - MAIN_ABILITY_NAME | ||
| 23 | -} from './src/main/ets/const/update_const'; | ||
| 24 | - | ||
| 25 | -export { UpdateManager } from './src/main/ets/manager/UpdateManager'; | ||
| 26 | - | ||
| 27 | -export { UpdateUtils } from './src/main/ets/util/UpdateUtils'; | ||
| 28 | -export { DeviceUtils } from './src/main/ets/util/DeviceUtils'; | ||
| 29 | -export { FormatUtils } from './src/main/ets/util/FormatUtils'; | ||
| 30 | -export { LogUtils } from './src/main/ets/util/LogUtils'; | ||
| 31 | -export { NetUtils } from './src/main/ets/util/NetUtils'; | ||
| @@ -5,9 +5,8 @@ | |||
| 5 | "org": "" | 5 | "org": "" |
| 6 | }, | 6 | }, |
| 7 | "version": "1.0.0", | 7 | "version": "1.0.0", |
| 8 | - "main": "index.ets", | ||
| 9 | "types": "", | 8 | "types": "", |
| 10 | - "repository": {}, | 9 | + "repository": "", |
| 11 | "license": "ISC", | 10 | "license": "ISC", |
| 12 | "dependencies": {}, | 11 | "dependencies": {}, |
| 13 | "type": "module" | 12 | "type": "module" |
| @@ -1,5 +0,0 @@ | |||
| 1 | -{ | ||
| 2 | - "name": "@ohos/common", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "lockfileVersion": 1 | ||
| 5 | -} | ||
| @@ -23,7 +23,7 @@ export struct CheckingDots { | |||
| 23 | @Prop @Watch('onDotTextPlayChange') | 23 | @Prop @Watch('onDotTextPlayChange') |
| 24 | private dotTextPlay: boolean; | 24 | private dotTextPlay: boolean; |
| 25 | private newVersionDotText: string= '.'; | 25 | private newVersionDotText: string= '.'; |
| 26 | - private checkingTid: number = null; | 26 | + private checkingTid: number | null = null; |
| 27 | @State private dotNumber: number = 0; | 27 | @State private dotNumber: number = 0; |
| 28 | 28 | ||
| 29 | aboutToDisappear() { | 29 | aboutToDisappear() { |
| @@ -28,8 +28,10 @@ export struct HomeCardView { | |||
| 28 | private indexVideo: number = 99; | 28 | private indexVideo: number = 99; |
| 29 | private aspectRatioHorizontal: number = 16 / 7; | 29 | private aspectRatioHorizontal: number = 16 / 7; |
| 30 | private aspectRatioVertical: number = 1 / 1; | 30 | private aspectRatioVertical: number = 1 / 1; |
| 31 | - private onVideoFinished: () => boolean; | 31 | + private onVideoFinished: () => boolean = () => { |
| 32 | - private videoController: VideoController; | 32 | + return false; |
| 33 | + }; | ||
| 34 | + private videoController: VideoController = new VideoController(); | ||
| 33 | @State private handleVideoPlay: boolean = false; | 35 | @State private handleVideoPlay: boolean = false; |
| 34 | 36 | ||
| 35 | onChange() { | 37 | onChange() { |
| @@ -45,7 +47,7 @@ export struct HomeCardView { | |||
| 45 | } | 47 | } |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | - @Builder showLogoMedia(constraintSize) { | 50 | + @Builder showLogoMedia(constraintSize: ConstraintSizeOptions) { |
| 49 | Stack({ alignContent: Alignment.Center }) { | 51 | Stack({ alignContent: Alignment.Center }) { |
| 50 | Video({ | 52 | Video({ |
| 51 | src: $r('app.media.video'), | 53 | src: $r('app.media.video'), |
| @@ -24,7 +24,7 @@ import { LogUtils } from '../util/LogUtils'; | |||
| 24 | @Component | 24 | @Component |
| 25 | export struct TitleBar { | 25 | export struct TitleBar { |
| 26 | private static readonly TAG = 'TitleBar'; | 26 | private static readonly TAG = 'TitleBar'; |
| 27 | - private title: string | Resource; | 27 | + private title: string | Resource = ''; |
| 28 | private onBack?: () => boolean; | 28 | private onBack?: () => boolean; |
| 29 | 29 | ||
| 30 | build() { | 30 | build() { |
| @@ -101,12 +101,12 @@ export interface OtaStatus { | |||
| 101 | /** | 101 | /** |
| 102 | * 状态 | 102 | * 状态 |
| 103 | */ | 103 | */ |
| 104 | - status: number; | 104 | + status?: number; |
| 105 | 105 | ||
| 106 | /** | 106 | /** |
| 107 | * 进度 | 107 | * 进度 |
| 108 | */ | 108 | */ |
| 109 | - percent: number; | 109 | + percent?: number; |
| 110 | 110 | ||
| 111 | /** | 111 | /** |
| 112 | * 终止原因 | 112 | * 终止原因 |
| @@ -145,47 +145,47 @@ export enum ErrorCode { | |||
| 145 | /** | 145 | /** |
| 146 | * 错误码--鉴权失败 | 146 | * 错误码--鉴权失败 |
| 147 | */ | 147 | */ |
| 148 | - AUTH_FAIL = '-208', | 148 | + AUTH_FAIL = -208, |
| 149 | 149 | ||
| 150 | /** | 150 | /** |
| 151 | * 错误码--鉴权失败服务错误 | 151 | * 错误码--鉴权失败服务错误 |
| 152 | */ | 152 | */ |
| 153 | - AUTH_SERVER_ERROR = '-209', | 153 | + AUTH_SERVER_ERROR = -209, |
| 154 | 154 | ||
| 155 | /** | 155 | /** |
| 156 | * 错误码--鉴权失败系统错误 | 156 | * 错误码--鉴权失败系统错误 |
| 157 | */ | 157 | */ |
| 158 | - AUTH_SYSTEM_ERROR = '-210', | 158 | + AUTH_SYSTEM_ERROR = -210, |
| 159 | 159 | ||
| 160 | /** | 160 | /** |
| 161 | * 错误码--网络错误 | 161 | * 错误码--网络错误 |
| 162 | */ | 162 | */ |
| 163 | - NETWORK_ERROR = '-301', | 163 | + NETWORK_ERROR = -301, |
| 164 | 164 | ||
| 165 | /** | 165 | /** |
| 166 | * 错误码--空间不足 | 166 | * 错误码--空间不足 |
| 167 | */ | 167 | */ |
| 168 | - NO_ENOUGH_MEMORY = '-304', | 168 | + NO_ENOUGH_MEMORY = -304, |
| 169 | 169 | ||
| 170 | /** | 170 | /** |
| 171 | * 错误码--检验失败 | 171 | * 错误码--检验失败 |
| 172 | */ | 172 | */ |
| 173 | - VERIFY_PACKAGE_FAIL = '-305', | 173 | + VERIFY_PACKAGE_FAIL = -305, |
| 174 | 174 | ||
| 175 | /** | 175 | /** |
| 176 | * 错误码--部分升級失敗 | 176 | * 错误码--部分升級失敗 |
| 177 | */ | 177 | */ |
| 178 | - UPDATE_PART_FAIL = '-409', | 178 | + UPDATE_PART_FAIL = -409, |
| 179 | 179 | ||
| 180 | /** | 180 | /** |
| 181 | * 错误码--电量不足 | 181 | * 错误码--电量不足 |
| 182 | */ | 182 | */ |
| 183 | - NO_ENOUGH_BATTERY = '-830', | 183 | + NO_ENOUGH_BATTERY = -830, |
| 184 | 184 | ||
| 185 | /** | 185 | /** |
| 186 | * 错误码--网络不允许 | 186 | * 错误码--网络不允许 |
| 187 | */ | 187 | */ |
| 188 | - NETWORK_NOT_ALLOW = '3148800' | 188 | + NETWORK_NOT_ALLOW = 3148800 |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /** | 191 | /** |
| @@ -258,17 +258,17 @@ export interface Features { | |||
| 258 | /** | 258 | /** |
| 259 | * 标题 | 259 | * 标题 |
| 260 | */ | 260 | */ |
| 261 | - title: string; | 261 | + title?: string; |
| 262 | 262 | ||
| 263 | /** | 263 | /** |
| 264 | * 标识 | 264 | * 标识 |
| 265 | */ | 265 | */ |
| 266 | - id: string; | 266 | + id?: string; |
| 267 | 267 | ||
| 268 | /** | 268 | /** |
| 269 | * 特性类型 | 269 | * 特性类型 |
| 270 | */ | 270 | */ |
| 271 | - featureModuleType: string; | 271 | + featureModuleType?: string; |
| 272 | 272 | ||
| 273 | /** | 273 | /** |
| 274 | * 特性数组 | 274 | * 特性数组 |
| @@ -278,7 +278,7 @@ export interface Features { | |||
| 278 | /** | 278 | /** |
| 279 | * 图标 | 279 | * 图标 |
| 280 | */ | 280 | */ |
| 281 | - icon: Icon; | 281 | + icon?: Icon; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | /** | 284 | /** |
| @@ -290,7 +290,7 @@ export interface Feature { | |||
| 290 | /** | 290 | /** |
| 291 | * 子标题 | 291 | * 子标题 |
| 292 | */ | 292 | */ |
| 293 | - subTitle: string; | 293 | + subTitle?: string; |
| 294 | 294 | ||
| 295 | /** | 295 | /** |
| 296 | * 内容数组 | 296 | * 内容数组 |
| @@ -307,17 +307,17 @@ export interface Icon { | |||
| 307 | /** | 307 | /** |
| 308 | * 标识 | 308 | * 标识 |
| 309 | */ | 309 | */ |
| 310 | - id: string; | 310 | + id?: string; |
| 311 | 311 | ||
| 312 | /** | 312 | /** |
| 313 | * 包名 | 313 | * 包名 |
| 314 | */ | 314 | */ |
| 315 | - pkg: string; | 315 | + pkg?: string; |
| 316 | 316 | ||
| 317 | /** | 317 | /** |
| 318 | * 数据流字串 | 318 | * 数据流字串 |
| 319 | */ | 319 | */ |
| 320 | - res: string; | 320 | + res?: string; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | /** | 323 | /** |
| @@ -473,4 +473,21 @@ export const PACKAGE_NAME = 'com.ohos.updateapp'; | |||
| 473 | /** | 473 | /** |
| 474 | * 主ability名 | 474 | * 主ability名 |
| 475 | */ | 475 | */ |
| 476 | -export const MAIN_ABILITY_NAME = 'com.ohos.updateapp.MainAbility'; | 476 | +export const MAIN_ABILITY_NAME = 'com.ohos.updateapp.MainAbility'; |
| 477 | + | ||
| 478 | +/** | ||
| 479 | + * Updater Event information | ||
| 480 | + * | ||
| 481 | + * 2024-08-27 | ||
| 482 | + */ | ||
| 483 | +export interface CustomEventInfo { | ||
| 484 | + /** | ||
| 485 | + * Task event id | ||
| 486 | + */ | ||
| 487 | + eventId: number; | ||
| 488 | + | ||
| 489 | + /** | ||
| 490 | + * Task body info | ||
| 491 | + */ | ||
| 492 | + taskBody: update.TaskBody; | ||
| 493 | +} | ||
| @@ -18,7 +18,6 @@ import update from '@ohos.update'; | |||
| 18 | import { PACKAGE_NAME, UpdateState, UpgradeCallResult, } from '../const/update_const'; | 18 | import { PACKAGE_NAME, UpdateState, UpgradeCallResult, } from '../const/update_const'; |
| 19 | import type { BusinessError, OtaStatus, UpgradeData} from '../const/update_const'; | 19 | import type { BusinessError, OtaStatus, UpgradeData} from '../const/update_const'; |
| 20 | import { LogUtils } from '../util/LogUtils'; | 20 | import { LogUtils } from '../util/LogUtils'; |
| 21 | -import { UpdateUtils } from '../util/UpdateUtils'; | ||
| 22 | 21 | ||
| 23 | /** | 22 | /** |
| 24 | * 方法超时控制装饰器 | 23 | * 方法超时控制装饰器 |
| @@ -55,7 +54,7 @@ export function enableTimeOutCheck<T>(timeout?: number): MethodDecorator { | |||
| 55 | result.then(innerRes => { | 54 | result.then(innerRes => { |
| 56 | clearTimeout(requestTimeout); | 55 | clearTimeout(requestTimeout); |
| 57 | resolve(innerRes); | 56 | resolve(innerRes); |
| 58 | - }).catch(err => { | 57 | + }).catch((err: BusinessError) => { |
| 59 | LogUtils.error('UpdateManager', 'err: ' + JSON.stringify(err)); | 58 | LogUtils.error('UpdateManager', 'err: ' + JSON.stringify(err)); |
| 60 | clearTimeout(requestTimeout); | 59 | clearTimeout(requestTimeout); |
| 61 | upgradeData.callResult = UpgradeCallResult.ERROR; | 60 | upgradeData.callResult = UpgradeCallResult.ERROR; |
| @@ -68,7 +67,6 @@ export function enableTimeOutCheck<T>(timeout?: number): MethodDecorator { | |||
| 68 | } | 67 | } |
| 69 | 68 | ||
| 70 | export interface IUpdate { | 69 | export interface IUpdate { |
| 71 | - bind(subType: number, callback : Function): void; | ||
| 72 | getOtaStatus(): Promise<UpgradeData<OtaStatus>>; | 70 | getOtaStatus(): Promise<UpgradeData<OtaStatus>>; |
| 73 | getNewVersion(): Promise<UpgradeData<update.NewVersionInfo>>; | 71 | getNewVersion(): Promise<UpgradeData<update.NewVersionInfo>>; |
| 74 | getNewVersionDescription(descVersionDigest: string, descFormat: update.DescriptionFormat, | 72 | getNewVersionDescription(descVersionDigest: string, descFormat: update.DescriptionFormat, |
| @@ -90,30 +88,62 @@ export interface IUpdate { | |||
| 90 | export class UpdateManager implements IUpdate { | 88 | export class UpdateManager implements IUpdate { |
| 91 | private otaUpdater: update.Updater; | 89 | private otaUpdater: update.Updater; |
| 92 | 90 | ||
| 93 | - public constructor() { | 91 | + public constructor(subType: number, upgradeDeviceId?: string, deviceType?: number, packageName?: string) { |
| 94 | - } | ||
| 95 | - | ||
| 96 | - /** | ||
| 97 | - * 绑定DUE | ||
| 98 | - * | ||
| 99 | - * subType 升级类型 | ||
| 100 | - * callback 回调 | ||
| 101 | - */ | ||
| 102 | - bind(subType: number, callback: update.UpgradeTaskCallback): void { | ||
| 103 | let upgradeInfo: update.UpgradeInfo = { | 92 | let upgradeInfo: update.UpgradeInfo = { |
| 104 | - upgradeApp: PACKAGE_NAME, | 93 | + upgradeApp: packageName ?? PACKAGE_NAME, |
| 105 | businessType: { | 94 | businessType: { |
| 106 | vendor: update.BusinessVendor.PUBLIC, | 95 | vendor: update.BusinessVendor.PUBLIC, |
| 107 | subType: subType | 96 | subType: subType |
| 108 | } | 97 | } |
| 109 | }; | 98 | }; |
| 110 | - | ||
| 111 | try { | 99 | try { |
| 112 | this.otaUpdater = update.getOnlineUpdater(upgradeInfo); | 100 | this.otaUpdater = update.getOnlineUpdater(upgradeInfo); |
| 113 | - let eventClassifyInfo: update.EventClassifyInfo = { eventClassify: 0x01000000, extraInfo: '' }; | 101 | + } catch (error) { |
| 102 | + LogUtils.error('UpdateManager', `getOnlineUpdater fail ${error?.code} ${error?.message}`); | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * 绑定UpdateService | ||
| 108 | + * | ||
| 109 | + * callback 回调 | ||
| 110 | + */ | ||
| 111 | + on(callback: update.UpgradeTaskCallback): void { | ||
| 112 | + if (!callback) { | ||
| 113 | + LogUtils.error('UpdateManager', 'on callback null'); | ||
| 114 | + return; | ||
| 115 | + } | ||
| 116 | + let eventClassifyInfo: update.EventClassifyInfo = { | ||
| 117 | + eventClassify: update.EventClassify.TASK, | ||
| 118 | + extraInfo: '' | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + try { | ||
| 114 | this.otaUpdater?.on(eventClassifyInfo, callback); | 122 | this.otaUpdater?.on(eventClassifyInfo, callback); |
| 115 | } catch (error) { | 123 | } catch (error) { |
| 116 | - LogUtils.error('UpdateManager', 'otaUpdater init fail ' + JSON.stringify(error)); | 124 | + LogUtils.error('UpdateManager', `otaUpdater on fail ${error?.code} ${error?.message}`); |
| 125 | + } | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * 取消绑定UpdateService | ||
| 130 | + * | ||
| 131 | + * callback 回调 | ||
| 132 | + */ | ||
| 133 | + off(callback: update.UpgradeTaskCallback): void { | ||
| 134 | + if (!callback) { | ||
| 135 | + LogUtils.error('UpdateManager', 'off callback null'); | ||
| 136 | + return; | ||
| 137 | + } | ||
| 138 | + let eventClassifyInfo: update.EventClassifyInfo = { | ||
| 139 | + eventClassify: update.EventClassify.TASK, | ||
| 140 | + extraInfo: '' | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + try { | ||
| 144 | + this.otaUpdater?.off(eventClassifyInfo, callback); | ||
| 145 | + } catch (error) { | ||
| 146 | + LogUtils.error('UpdateManager', `otaUpdater off fail ${error?.code} ${error?.message}`); | ||
| 117 | } | 147 | } |
| 118 | } | 148 | } |
| 119 | 149 | ||
| @@ -150,7 +180,7 @@ export class UpdateManager implements IUpdate { | |||
| 150 | } | 180 | } |
| 151 | 181 | ||
| 152 | /** | 182 | /** |
| 153 | - * 从due数据库取新版本信息 | 183 | + * 从UpdateService数据库取新版本信息 |
| 154 | * | 184 | * |
| 155 | * resolve 新版本信息/reject 错误信息 | 185 | * resolve 新版本信息/reject 错误信息 |
| 156 | */ | 186 | */ |
| @@ -237,7 +267,7 @@ export class UpdateManager implements IUpdate { | |||
| 237 | data: [{ errorCode: err?.data?.[0]?.errorCode }] | 267 | data: [{ errorCode: err?.data?.[0]?.errorCode }] |
| 238 | } | 268 | } |
| 239 | }; | 269 | }; |
| 240 | - if (!UpdateUtils.isSuccessCallback(result, err)) { | 270 | + if (!result && err) { |
| 241 | this.logError('getCurrentVersionDescription error is ${JSON.stringify(err)}'); | 271 | this.logError('getCurrentVersionDescription error is ${JSON.stringify(err)}'); |
| 242 | upgradeData.callResult = UpgradeCallResult.ERROR; | 272 | upgradeData.callResult = UpgradeCallResult.ERROR; |
| 243 | } | 273 | } |
| @@ -496,9 +526,9 @@ export interface Message { | |||
| 496 | */ | 526 | */ |
| 497 | export class MessageQueue { | 527 | export class MessageQueue { |
| 498 | private queue: Array<Message>; | 528 | private queue: Array<Message>; |
| 499 | - private handleMessage: (context: common.Context, eventInfo: update.EventInfo) => Promise<void>; | 529 | + private handleMessage: (message: Message) => Promise<void>; |
| 500 | 530 | ||
| 501 | - constructor(handleMessage: (context: common.Context, eventInfo: update.EventInfo) => Promise<void>) { | 531 | + constructor(handleMessage: (message: Message) => Promise<void>) { |
| 502 | this.queue = new Array<Message>(); | 532 | this.queue = new Array<Message>(); |
| 503 | this.handleMessage = handleMessage; | 533 | this.handleMessage = handleMessage; |
| 504 | } | 534 | } |
| @@ -520,7 +550,7 @@ export class MessageQueue { | |||
| 520 | private async loop(): Promise<void> { | 550 | private async loop(): Promise<void> { |
| 521 | let message: Message = this.peek(); | 551 | let message: Message = this.peek(); |
| 522 | if (message) { | 552 | if (message) { |
| 523 | - await this.handleMessage?.(message.context, message.eventInfo).catch(err => { | 553 | + await this.handleMessage?.(message).catch((err: BusinessError) => { |
| 524 | LogUtils.error('MessageQueue', 'loop err:' + JSON.stringify(err)); | 554 | LogUtils.error('MessageQueue', 'loop err:' + JSON.stringify(err)); |
| 525 | }); | 555 | }); |
| 526 | this.poll(); | 556 | this.poll(); |
| @@ -0,0 +1,142 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2025 Huawei Device Co., Ltd. | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + */ | ||
| 15 | + | ||
| 16 | +import type update from '@ohos.update'; | ||
| 17 | +import type common from '@ohos.app.ability.common'; | ||
| 18 | +import { StartOptions } from '@kit.AbilityKit'; | ||
| 19 | +import { MAIN_ABILITY_NAME, PACKAGE_NAME, UpdateState, OtaStatus } from '../const/update_const'; | ||
| 20 | +import type { BusinessError } from '../const/update_const'; | ||
| 21 | +import { LogUtils } from './LogUtils'; | ||
| 22 | + | ||
| 23 | +const TIME_OUT_FOR_START_ABILITY = 500; | ||
| 24 | +type unionContext = common.UIAbilityContext | common.ServiceExtensionContext | common.UIExtensionContext; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 接口工具 | ||
| 28 | + * | ||
| 29 | + * 2025-06-07 | ||
| 30 | + */ | ||
| 31 | +export class CommonUtils { | ||
| 32 | + /** | ||
| 33 | + * 判空处理 | ||
| 34 | + * | ||
| 35 | + * value 值 | ||
| 36 | + * 是否为空 | ||
| 37 | + */ | ||
| 38 | + static isEmpty<T>(value: T): boolean { | ||
| 39 | + return value === null || value === undefined; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * JSON stringify方法封装 | ||
| 45 | + * | ||
| 46 | + * value JS对象 | ||
| 47 | + * json字符串 | ||
| 48 | + */ | ||
| 49 | + static stringify<T>(value: T): string { | ||
| 50 | + if (value) { | ||
| 51 | + try { | ||
| 52 | + return JSON.stringify(value); | ||
| 53 | + } catch (exception) { | ||
| 54 | + LogUtils.error('CommonUtils', 'JSON.stringify failed !!'); | ||
| 55 | + return ''; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + return ''; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * json 字符串解析 | ||
| 63 | + * | ||
| 64 | + * content json 字符串 | ||
| 65 | + * T 解析后返回值 | ||
| 66 | + */ | ||
| 67 | + static parseJson<T>(content: string): T { | ||
| 68 | + if (!content) { | ||
| 69 | + return null; | ||
| 70 | + } | ||
| 71 | + try { | ||
| 72 | + return JSON.parse(content) as T; | ||
| 73 | + } catch (exception) { | ||
| 74 | + LogUtils.error('CommonUtils', 'paramJson failed !!'); | ||
| 75 | + } | ||
| 76 | + return null; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * string判空处理 | ||
| 81 | + * | ||
| 82 | + * value string值 | ||
| 83 | + * 是否为空 | ||
| 84 | + */ | ||
| 85 | + static isStringEmpty(value: string | undefined | null): boolean { | ||
| 86 | + return value === null || value === undefined || value === ''; | ||
| 87 | + } | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +/** | ||
| 91 | + * 装饰器--弹框时,前台判断处理 | ||
| 92 | + */ | ||
| 93 | +export function foregroundCheck() { | ||
| 94 | + return (target: Object, propertyKey: string, descriptor: PropertyDescriptor): void => { | ||
| 95 | + const original = descriptor.value; | ||
| 96 | + descriptor.value = (context: common.Context, otaStatus: OtaStatus, | ||
| 97 | + eventId?: update.EventId, ...args): void => { | ||
| 98 | + if (globalThis.AbilityStatus !== 'ON_FOREGROUND') { | ||
| 99 | + globalThis.reNotify = true; | ||
| 100 | + globalThis.otaStatusFromService = otaStatus; | ||
| 101 | + globalThis.eventIdFromService = eventId; | ||
| 102 | + LogUtils.log('foregroundCheck', 'do startMainAbilityIndex.'); | ||
| 103 | + | ||
| 104 | + // 应用在后台时,无法弹框,需杀掉ability后,重新拉起界面弹框 | ||
| 105 | + globalThis.abilityContext?.terminateSelf(); | ||
| 106 | + setTimeout(() => { | ||
| 107 | + startMainAbilityIndex(context); | ||
| 108 | + }, TIME_OUT_FOR_START_ABILITY); | ||
| 109 | + return; | ||
| 110 | + } | ||
| 111 | + original.call(this, ...args); | ||
| 112 | + }; | ||
| 113 | + }; | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | +/** | ||
| 117 | + * 启动Ability | ||
| 118 | + * | ||
| 119 | + * context 要启动Ability的context | ||
| 120 | + * want 要启动Ability的want | ||
| 121 | + * options 配置项 | ||
| 122 | + */ | ||
| 123 | +export function startAbility(context: common.Context, want: Want, options?: StartOptions): void { | ||
| 124 | + if (!context || !want) { | ||
| 125 | + LogUtils.error('CommonUtils', 'Failed to start ability with error: context or want is null.'); | ||
| 126 | + return; | ||
| 127 | + } | ||
| 128 | + (context as unionContext).startAbility(want, options).then(() => { | ||
| 129 | + LogUtils.info('CommonUtils', 'Succeed to start ability' ); | ||
| 130 | + }).catch((error: BusinessError) => { | ||
| 131 | + LogUtils.error('CommonUtils', 'Failed to start ability with error: ' + JSON.stringify(error)); | ||
| 132 | + }); | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +export function startMainAbilityIndex(context: common.Context): void { | ||
| 136 | + let want: Want = { | ||
| 137 | + bundleName: PACKAGE_NAME, | ||
| 138 | + abilityName: MAIN_ABILITY_NAME, | ||
| 139 | + uri: 'pages/newVersion', | ||
| 140 | + }; | ||
| 141 | + startAbility(context, want, undefined); | ||
| 142 | +} | ||
| @@ -17,13 +17,14 @@ import type common from '@ohos.app.ability.common'; | |||
| 17 | import { DeviceUtils } from '../util/DeviceUtils'; | 17 | import { DeviceUtils } from '../util/DeviceUtils'; |
| 18 | import { LogUtils } from './LogUtils'; | 18 | import { LogUtils } from './LogUtils'; |
| 19 | 19 | ||
| 20 | +const DECIMAL_POINT = 2; | ||
| 21 | + | ||
| 20 | /** | 22 | /** |
| 21 | * 格式化工具 | 23 | * 格式化工具 |
| 22 | * | 24 | * |
| 23 | * @since 2022-06-06 | 25 | * @since 2022-06-06 |
| 24 | */ | 26 | */ |
| 25 | -export namespace FormatUtils { | 27 | +export class FormatUtils { |
| 26 | - const DECIMAL_POINT = 2; | ||
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| 29 | * 格式化文件大小 | 30 | * 格式化文件大小 |
| @@ -32,7 +33,7 @@ export namespace FormatUtils { | |||
| 32 | * @param decimalPoint 精确到小数点后两位 | 33 | * @param decimalPoint 精确到小数点后两位 |
| 33 | * @return 格式化后的字符串 | 34 | * @return 格式化后的字符串 |
| 34 | */ | 35 | */ |
| 35 | - export function formatFileSize(bytes: number, decimalPoint = DECIMAL_POINT): string { | 36 | + static formatFileSize(bytes: number, decimalPoint = DECIMAL_POINT): string { |
| 36 | if (bytes <= 0) { | 37 | if (bytes <= 0) { |
| 37 | return '0 Bytes'; | 38 | return '0 Bytes'; |
| 38 | } | 39 | } |
| @@ -54,7 +55,7 @@ export namespace FormatUtils { | |||
| 54 | * @param args 待匹配的内容 | 55 | * @param args 待匹配的内容 |
| 55 | * @return 格式化后的字符串 | 56 | * @return 格式化后的字符串 |
| 56 | */ | 57 | */ |
| 57 | - export function formatStr(message: string, ...args: (string | number)[]): string { | 58 | + static formatStr(message: string, ...args: (string | number)[]): string { |
| 58 | if (!message) { | 59 | if (!message) { |
| 59 | return ''; | 60 | return ''; |
| 60 | } | 61 | } |
| @@ -78,7 +79,7 @@ export namespace FormatUtils { | |||
| 78 | * @param args 待匹配的内容 | 79 | * @param args 待匹配的内容 |
| 79 | * @return 转大写后的字符串 | 80 | * @return 转大写后的字符串 |
| 80 | */ | 81 | */ |
| 81 | - export function toUpperCase(context: common.Context, text: ResourceStr, ...args: (string | number)[]): string { | 82 | + static toUpperCase(context: common.Context, text: ResourceStr, ...args: (string | number)[]): string { |
| 82 | if (!text) { | 83 | if (!text) { |
| 83 | return ''; | 84 | return ''; |
| 84 | } | 85 | } |
| @@ -86,7 +87,7 @@ export namespace FormatUtils { | |||
| 86 | return text.toUpperCase(); | 87 | return text.toUpperCase(); |
| 87 | } else { | 88 | } else { |
| 88 | let message: string = context?.resourceManager.getStringSync(text.id); | 89 | let message: string = context?.resourceManager.getStringSync(text.id); |
| 89 | - return formatStr(message, ...args).toUpperCase(); | 90 | + return FormatUtils.formatStr(message, ...args).toUpperCase(); |
| 90 | } | 91 | } |
| 91 | } | 92 | } |
| 92 | 93 | ||
| @@ -96,45 +97,9 @@ export namespace FormatUtils { | |||
| 96 | * @param num 待格式化数字 | 97 | * @param num 待格式化数字 |
| 97 | * @return 格式化之后的数字 | 98 | * @return 格式化之后的数字 |
| 98 | */ | 99 | */ |
| 99 | - export function getNumberFormat(num: number): string { | 100 | + static getNumberFormat(num: number): string { |
| 100 | let language: string = DeviceUtils.getSystemLanguage(); | 101 | let language: string = DeviceUtils.getSystemLanguage(); |
| 101 | let numfmt: Intl.NumberFormat = new Intl.NumberFormat(language, {style:'percent', notation:'standard'}); | 102 | let numfmt: Intl.NumberFormat = new Intl.NumberFormat(language, {style:'percent', notation:'standard'}); |
| 102 | return numfmt.format(num); | 103 | return numfmt.format(num); |
| 103 | } | 104 | } |
| 104 | - | ||
| 105 | - /** | ||
| 106 | - * JSON stringify方法封装 | ||
| 107 | - * | ||
| 108 | - * @param value JS对象 | ||
| 109 | - * @return json字符串 | ||
| 110 | - */ | ||
| 111 | - export function stringify<T>(value: T): string { | ||
| 112 | - if (value) { | ||
| 113 | - try { | ||
| 114 | - return JSON.stringify(value); | ||
| 115 | - } catch (exception) { | ||
| 116 | - LogUtils.error('FormateUtils', 'JSON.stringify failed !!'); | ||
| 117 | - return ''; | ||
| 118 | - } | ||
| 119 | - } | ||
| 120 | - return ''; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - /** | ||
| 124 | - * json 字符串解析 | ||
| 125 | - * | ||
| 126 | - * @param content json 字符串 | ||
| 127 | - * @return T 解析后返回值 | ||
| 128 | - */ | ||
| 129 | - export function parseJson<T>(content: string): T | null { | ||
| 130 | - if (!content) { | ||
| 131 | - return null; | ||
| 132 | - } | ||
| 133 | - try { | ||
| 134 | - return JSON.parse(content) as T; | ||
| 135 | - } catch (exception) { | ||
| 136 | - LogUtils.error('FormateUtils', 'paramJson failed !!'); | ||
| 137 | - } | ||
| 138 | - return null; | ||
| 139 | - } | ||
| 140 | } | 105 | } |
| @@ -14,7 +14,8 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | import connection from '@ohos.net.connection'; | 16 | import connection from '@ohos.net.connection'; |
| 17 | -import { LogUtils } from '../util/LogUtils'; | 17 | +import { BusinessError } from '../const/update_const'; |
| 18 | +import { LogUtils } from './LogUtils'; | ||
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * 网络判断工具类 | 21 | * 网络判断工具类 |
| @@ -34,11 +35,11 @@ export namespace NetUtils { | |||
| 34 | connection.getNetCapabilities(netHandle).then((info) => { | 35 | connection.getNetCapabilities(netHandle).then((info) => { |
| 35 | LogUtils.log('NetUtils', 'getNetCapabilities data ' + JSON.stringify(info)); | 36 | LogUtils.log('NetUtils', 'getNetCapabilities data ' + JSON.stringify(info)); |
| 36 | resolve(info?.bearerTypes?.length !== 0); | 37 | resolve(info?.bearerTypes?.length !== 0); |
| 37 | - }).catch((err) => { | 38 | + }).catch((err: BusinessError) => { |
| 38 | LogUtils.log('NetUtils', 'getNetCapabilities err ' + JSON.stringify(err)); | 39 | LogUtils.log('NetUtils', 'getNetCapabilities err ' + JSON.stringify(err)); |
| 39 | resolve(false); | 40 | resolve(false); |
| 40 | }); | 41 | }); |
| 41 | - }).catch((err) => { | 42 | + }).catch((err: BusinessError) => { |
| 42 | LogUtils.log('NetUtils', 'getDefaultNet err ' + JSON.stringify(err)); | 43 | LogUtils.log('NetUtils', 'getDefaultNet err ' + JSON.stringify(err)); |
| 43 | resolve(false); | 44 | resolve(false); |
| 44 | }); | 45 | }); |
| @@ -57,11 +58,11 @@ export namespace NetUtils { | |||
| 57 | connection.getNetCapabilities(netHandle).then((info) => { | 58 | connection.getNetCapabilities(netHandle).then((info) => { |
| 58 | LogUtils.log('NetUtils', 'getNetCapabilities data ' + JSON.stringify(info)); | 59 | LogUtils.log('NetUtils', 'getNetCapabilities data ' + JSON.stringify(info)); |
| 59 | resolve(info?.bearerTypes?.length === 1 && info?.bearerTypes?.[0] === connection.NetBearType.BEARER_CELLULAR); | 60 | resolve(info?.bearerTypes?.length === 1 && info?.bearerTypes?.[0] === connection.NetBearType.BEARER_CELLULAR); |
| 60 | - }).catch((err) => { | 61 | + }).catch((err: BusinessError) => { |
| 61 | LogUtils.log('NetUtils', 'getNetCapabilities err ' + JSON.stringify(err)); | 62 | LogUtils.log('NetUtils', 'getNetCapabilities err ' + JSON.stringify(err)); |
| 62 | resolve(false); | 63 | resolve(false); |
| 63 | }); | 64 | }); |
| 64 | - }).catch((err) => { | 65 | + }).catch((err: BusinessError) => { |
| 65 | LogUtils.log('NetUtils', 'getDefaultNet err ' + JSON.stringify(err)); | 66 | LogUtils.log('NetUtils', 'getDefaultNet err ' + JSON.stringify(err)); |
| 66 | resolve(false); | 67 | resolve(false); |
| 67 | }); | 68 | }); |
| @@ -14,12 +14,16 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | import update from '@ohos.update'; | 16 | import update from '@ohos.update'; |
| 17 | +import { StartOptions } from '@kit.AbilityKit'; | ||
| 18 | +import type { BusinessError } from '../const/update_const'; | ||
| 19 | +import type common from '@ohos.app.ability.common'; | ||
| 17 | import { LogUtils } from './LogUtils'; | 20 | import { LogUtils } from './LogUtils'; |
| 18 | 21 | ||
| 19 | /** | 22 | /** |
| 20 | * 日志TAG | 23 | * 日志TAG |
| 21 | */ | 24 | */ |
| 22 | const TAG = 'UpdateUtils'; | 25 | const TAG = 'UpdateUtils'; |
| 26 | +type unionContext = common.UIAbilityContext | common.ServiceExtensionContext | common.UIExtensionContext; | ||
| 23 | 27 | ||
| 24 | /** | 28 | /** |
| 25 | * 接口工具 | 29 | * 接口工具 |
| @@ -58,14 +62,14 @@ export namespace UpdateUtils { | |||
| 58 | * @param want 要启动Ability的want | 62 | * @param want 要启动Ability的want |
| 59 | * @param options 配置项 | 63 | * @param options 配置项 |
| 60 | */ | 64 | */ |
| 61 | - export function startAbility(context: any, want, options): void { | 65 | + export function startAbility(context: common.Context, want: Want, options?: StartOptions): void { |
| 62 | if (!context || !want) { | 66 | if (!context || !want) { |
| 63 | LogUtils.error(TAG, 'Failed to start ability with error: context or want is null.'); | 67 | LogUtils.error(TAG, 'Failed to start ability with error: context or want is null.'); |
| 64 | return; | 68 | return; |
| 65 | } | 69 | } |
| 66 | - context.startAbility(want, options).then((data) => { | 70 | + (context as unionContext).startAbility(want, options).then(() => { |
| 67 | - LogUtils.info(TAG, 'Succeed to start ability with data: ' + JSON.stringify(data)); | 71 | + LogUtils.info(TAG, 'Succeed to start ability'); |
| 68 | - }).catch((error) => { | 72 | + }).catch((error: BusinessError) => { |
| 69 | LogUtils.error(TAG, 'Failed to start ability with error: ' + JSON.stringify(error)); | 73 | LogUtils.error(TAG, 'Failed to start ability with error: ' + JSON.stringify(error)); |
| 70 | }); | 74 | }); |
| 71 | } | 75 | } |
| @@ -76,7 +80,7 @@ export namespace UpdateUtils { | |||
| 76 | * @param err 返回信息 | 80 | * @param err 返回信息 |
| 77 | * @param return 接口调用结果 | 81 | * @param return 接口调用结果 |
| 78 | */ | 82 | */ |
| 79 | - export function isSuccessCallback(result: unknown, err: any): boolean { | 83 | + export function isSuccessCallback(result: Object, err: Object): boolean { |
| 80 | - return result && !err; | 84 | + return !!result && !err; |
| 81 | } | 85 | } |
| 82 | } | 86 | } |
| @@ -0,0 +1,19 @@ | |||
| 1 | +{ | ||
| 2 | + "meta": { | ||
| 3 | + "stableOrder": true, | ||
| 4 | + "enableUnifiedLockfile": false | ||
| 5 | + }, | ||
| 6 | + "lockfileVersion": 3, | ||
| 7 | + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. Do NOT EDIT THIS FILE DIRECTLY.", | ||
| 8 | + "specifiers": { | ||
| 9 | + "@ohos/common@../../common": "@ohos/common@../../common" | ||
| 10 | + }, | ||
| 11 | + "packages": { | ||
| 12 | + "@ohos/common@../../common": { | ||
| 13 | + "name": "@ohos/common", | ||
| 14 | + "version": "1.0.0", | ||
| 15 | + "resolved": "../../common", | ||
| 16 | + "registryType": "local" | ||
| 17 | + } | ||
| 18 | + } | ||
| 19 | +} | ||
| @@ -1,16 +1,9 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "ota", | 2 | "name": "ota", |
| 3 | "description": "a npm package which contains arkUI2.0 page", | 3 | "description": "a npm package which contains arkUI2.0 page", |
| 4 | - "ohos": { | ||
| 5 | - "org": "" | ||
| 6 | - }, | ||
| 7 | "version": "1.0.0", | 4 | "version": "1.0.0", |
| 8 | - "main": "index.ets", | ||
| 9 | - "types": "", | ||
| 10 | - "repository": {}, | ||
| 11 | "license": "ISC", | 5 | "license": "ISC", |
| 12 | "dependencies": { | 6 | "dependencies": { |
| 13 | "@ohos/common": "file:../../common" | 7 | "@ohos/common": "file:../../common" |
| 14 | }, | 8 | }, |
| 15 | - "type": "module" | ||
| 16 | } | 9 | } |
| @@ -1,11 +0,0 @@ | |||
| 1 | -{ | ||
| 2 | - "name": "ota", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "lockfileVersion": 1, | ||
| 5 | - "requires": true, | ||
| 6 | - "dependencies": { | ||
| 7 | - "@ohos/common": { | ||
| 8 | - "version": "file:../../common" | ||
| 9 | - } | ||
| 10 | - } | ||
| 11 | -} | ||
| @@ -24,8 +24,8 @@ import type { INotify, IPage } from '@ohos/common/src/main/ets/manager/UpgradeIn | |||
| 24 | * @since 2022-12-01 | 24 | * @since 2022-12-01 |
| 25 | */ | 25 | */ |
| 26 | export class UpgradeAdapter { | 26 | export class UpgradeAdapter { |
| 27 | - private _notifyInstance: INotify; | 27 | + private _notifyInstance: INotify | undefined = undefined; |
| 28 | - private _page: IPage; | 28 | + private _page: IPage | undefined = undefined; |
| 29 | 29 | ||
| 30 | private constructor() { | 30 | private constructor() { |
| 31 | globalThis.upgradeAdapter = this; | 31 | globalThis.upgradeAdapter = this; |
| @@ -32,19 +32,19 @@ import ChangelogParseUtils from '../util/ChangelogParseUtils'; | |||
| 32 | */ | 32 | */ |
| 33 | @Component | 33 | @Component |
| 34 | export struct ChangelogContent { | 34 | export struct ChangelogContent { |
| 35 | - @State private changelogInfoList: Array<ChangelogInfo> = null; | 35 | + @State private changelogInfoList: Array<ChangelogInfo> | null = null; |
| 36 | - private isCurrentPage: boolean; | 36 | + private isCurrentPage: boolean = false; |
| 37 | - isNeedFold: boolean; | 37 | + isNeedFold: boolean = false; |
| 38 | @Prop @Watch('parseChangelog') description: string; | 38 | @Prop @Watch('parseChangelog') description: string; |
| 39 | @State private isParseChangelogFinished: boolean = false; | 39 | @State private isParseChangelogFinished: boolean = false; |
| 40 | 40 | ||
| 41 | @Builder buildChangelog() { | 41 | @Builder buildChangelog() { |
| 42 | Column() { | 42 | Column() { |
| 43 | if (this.changelogInfoList && this.isParseChangelogFinished) { | 43 | if (this.changelogInfoList && this.isParseChangelogFinished) { |
| 44 | - ForEach(this.changelogInfoList, (item: ChangelogInfo, index?: number) => { | 44 | + ForEach(this.changelogInfoList, (item: ChangelogInfo, index: number = 0) => { |
| 45 | ChangelogCard({ | 45 | ChangelogCard({ |
| 46 | changelogInfo: item, | 46 | changelogInfo: item, |
| 47 | - index: this.changelogInfoList?.length > 1 ? index + 1 : 0, | 47 | + index: (this.changelogInfoList && this.changelogInfoList?.length > 1) ? index + 1 : 0, |
| 48 | isCurrentPage: this.isCurrentPage | 48 | isCurrentPage: this.isCurrentPage |
| 49 | }); | 49 | }); |
| 50 | }) | 50 | }) |
| @@ -66,12 +66,12 @@ export struct ChangelogContent { | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | @Builder setEndFeature() { | 68 | @Builder setEndFeature() { |
| 69 | - Text(this.changelogInfoList?.[0].endFeatures.title) | 69 | + Text(this.changelogInfoList?.[0].endFeatures?.title) |
| 70 | .fontSize($r('app.float.changelog_content_end_title')) | 70 | .fontSize($r('app.float.changelog_content_end_title')) |
| 71 | .fontColor($r('sys.color.ohos_fa_text_secondary')) | 71 | .fontColor($r('sys.color.ohos_fa_text_secondary')) |
| 72 | .fontWeight(FontWeight.Medium) | 72 | .fontWeight(FontWeight.Medium) |
| 73 | .width('100%') | 73 | .width('100%') |
| 74 | - ForEach(this.changelogInfoList?.[0].endFeatures.featureList, (feature: Feature) => { | 74 | + ForEach(this.changelogInfoList?.[0].endFeatures?.featureList, (feature: Feature) => { |
| 75 | Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { | 75 | Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { |
| 76 | ForEach(feature.contents, (content: string) => { | 76 | ForEach(feature.contents, (content: string) => { |
| 77 | Text(content) | 77 | Text(content) |
| @@ -79,7 +79,7 @@ export struct ChangelogContent { | |||
| 79 | .fontSize($r('app.float.changelog_end_word')) | 79 | .fontSize($r('app.float.changelog_end_word')) |
| 80 | .fontWeight(FontWeight.Regular) | 80 | .fontWeight(FontWeight.Regular) |
| 81 | .align(Alignment.Start) | 81 | .align(Alignment.Start) |
| 82 | - .padding({ top: this.changelogInfoList?.[0].endFeatures.featureList.indexOf(feature) == 0 ? | 82 | + .padding({ top: this.changelogInfoList?.[0].endFeatures?.featureList.indexOf(feature) == 0 ? |
| 83 | $r('app.float.changelog_tablet_has_feature_padding_top') : | 83 | $r('app.float.changelog_tablet_has_feature_padding_top') : |
| 84 | $r('app.float.changelog_tablet_no_feature_padding_top') | 84 | $r('app.float.changelog_tablet_no_feature_padding_top') |
| 85 | }); | 85 | }); |
| @@ -95,7 +95,7 @@ export struct ChangelogContent { | |||
| 95 | 95 | ||
| 96 | private parseChangelog(): void { | 96 | private parseChangelog(): void { |
| 97 | this.logInfo('parseChangelog'); | 97 | this.logInfo('parseChangelog'); |
| 98 | - let list: ChangelogInfo[] = null; | 98 | + let list: ChangelogInfo[] | null = null; |
| 99 | if (this.description) { | 99 | if (this.description) { |
| 100 | list = JSON.parse(this.description); | 100 | list = JSON.parse(this.description); |
| 101 | } | 101 | } |
| @@ -119,17 +119,17 @@ export struct ChangelogContent { | |||
| 119 | }); | 119 | }); |
| 120 | }); | 120 | }); |
| 121 | this.isParseChangelogFinished = true; | 121 | this.isParseChangelogFinished = true; |
| 122 | - this.changelogInfoList = isParseSuccess ? list : null; | 122 | + this.changelogInfoList = isParseSuccess ? list : []; |
| 123 | } else { | 123 | } else { |
| 124 | this.logInfo('description is null'); | 124 | this.logInfo('description is null'); |
| 125 | } | 125 | } |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | - private getHeaderFeatures(changelog: Changelog, language: string): Features { | 128 | + private getHeaderFeatures(changelog: Changelog, language: string): Features | undefined { |
| 129 | return this.getTargetFeatures(changelog, language, 'header'); | 129 | return this.getTargetFeatures(changelog, language, 'header'); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | - private getEndFeatures(changelog: Changelog, language: string): Features{ | 132 | + private getEndFeatures(changelog: Changelog, language: string): Features | undefined { |
| 133 | return this.getTargetFeatures(changelog, language, 'end'); | 133 | return this.getTargetFeatures(changelog, language, 'end'); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -138,7 +138,7 @@ export struct ChangelogContent { | |||
| 138 | if (changelog == null || language == null) { | 138 | if (changelog == null || language == null) { |
| 139 | return featuresList; | 139 | return featuresList; |
| 140 | } | 140 | } |
| 141 | - let lang: Language = changelog.language.get(language); | 141 | + let lang: Language | undefined = changelog.language.get(language); |
| 142 | if (lang == null) { | 142 | if (lang == null) { |
| 143 | return featuresList; | 143 | return featuresList; |
| 144 | } | 144 | } |
| @@ -152,20 +152,22 @@ export struct ChangelogContent { | |||
| 152 | return featuresList; | 152 | return featuresList; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | - private getTargetFeatures(changelog: Changelog, language: string, type: string): Features { | 155 | + private getTargetFeatures(changelog: Changelog, language: string, type: string): Features | undefined { |
| 156 | if (changelog == null || language == null) { | 156 | if (changelog == null || language == null) { |
| 157 | - return null; | 157 | + return; |
| 158 | } | 158 | } |
| 159 | - let lang: Language = changelog.language.get(language); | 159 | + let lang: Language | undefined = changelog.language.get(language); |
| 160 | if (lang == null) { | 160 | if (lang == null) { |
| 161 | - return null; | 161 | + return; |
| 162 | } | 162 | } |
| 163 | + let _features: Features | undefined; | ||
| 163 | for (let index = 0; index < lang.featuresArray.length; index++) { | 164 | for (let index = 0; index < lang.featuresArray.length; index++) { |
| 164 | const features = lang.featuresArray[index]; | 165 | const features = lang.featuresArray[index]; |
| 165 | if (features != null && features.featureModuleType == type) { | 166 | if (features != null && features.featureModuleType == type) { |
| 166 | return features; | 167 | return features; |
| 167 | } | 168 | } |
| 168 | } | 169 | } |
| 170 | + return _features; | ||
| 169 | } | 171 | } |
| 170 | 172 | ||
| 171 | build(): void{ | 173 | build(): void{ |
| @@ -188,8 +190,8 @@ export struct ChangelogContent { | |||
| 188 | */ | 190 | */ |
| 189 | @Component | 191 | @Component |
| 190 | struct ChangelogCard { | 192 | struct ChangelogCard { |
| 191 | - changelogInfo: ChangelogInfo; | 193 | + changelogInfo: ChangelogInfo | null = null; |
| 192 | - index: number; | 194 | + index: number = 0; |
| 193 | isCurrentPage: boolean = false; | 195 | isCurrentPage: boolean = false; |
| 194 | 196 | ||
| 195 | aboutToAppear() { | 197 | aboutToAppear() { |
| @@ -241,7 +243,7 @@ struct ChangelogCard { | |||
| 241 | } | 243 | } |
| 242 | 244 | ||
| 243 | @Builder setStartFeature(changelogInfo: ChangelogInfo) { | 245 | @Builder setStartFeature(changelogInfo: ChangelogInfo) { |
| 244 | - if (changelogInfo.headFeatures.featureList) { | 246 | + if (changelogInfo.headFeatures && changelogInfo.headFeatures.featureList) { |
| 245 | this.setFeatureContent(changelogInfo.headFeatures.featureList) | 247 | this.setFeatureContent(changelogInfo.headFeatures.featureList) |
| 246 | } | 248 | } |
| 247 | } | 249 | } |
| @@ -21,10 +21,10 @@ import { StateManager, UpdateAction } from '../manager/StateManager'; | |||
| 21 | * @param progress 进度值 | 21 | * @param progress 进度值 |
| 22 | * @return 显示进度值 | 22 | * @return 显示进度值 |
| 23 | */ | 23 | */ |
| 24 | -function getDisplayProgress(progress): number { | 24 | +function getDisplayProgress(progress: number): number { |
| 25 | let displayProgress = 0; | 25 | let displayProgress = 0; |
| 26 | if (!isNaN(progress)) { | 26 | if (!isNaN(progress)) { |
| 27 | - displayProgress = (progress).toFixed(0); | 27 | + displayProgress = Number((progress).toFixed(0)); |
| 28 | } | 28 | } |
| 29 | return displayProgress; | 29 | return displayProgress; |
| 30 | } | 30 | } |
| @@ -37,9 +37,9 @@ function getDisplayProgress(progress): number { | |||
| 37 | @Component | 37 | @Component |
| 38 | export struct ProgressContent { | 38 | export struct ProgressContent { |
| 39 | @StorageProp('updateStatus') | 39 | @StorageProp('updateStatus') |
| 40 | - private updateStatus: number = AppStorage.Get('updateStatus'); | 40 | + private updateStatus: number = AppStorage.Get('updateStatus') as number; |
| 41 | @StorageProp('downloadProgress') | 41 | @StorageProp('downloadProgress') |
| 42 | - private downloadProgress: number = AppStorage.Get('downloadProgress'); | 42 | + private downloadProgress: number = AppStorage.Get('downloadProgress') as number; |
| 43 | 43 | ||
| 44 | @Builder ProgressView() { | 44 | @Builder ProgressView() { |
| 45 | Stack({ alignContent: Alignment.Center }) { | 45 | Stack({ alignContent: Alignment.Center }) { |
| @@ -24,7 +24,7 @@ import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils' | |||
| 24 | @CustomDialog | 24 | @CustomDialog |
| 25 | export struct CountDownInstallDialogBuilder { | 25 | export struct CountDownInstallDialogBuilder { |
| 26 | @StorageProp('configLanguage') | 26 | @StorageProp('configLanguage') |
| 27 | - @Watch('onLanguageChange') private configLanguage: string = AppStorage.Get('configLanguage'); | 27 | + @Watch('onLanguageChange') private configLanguage: string = AppStorage.Get('configLanguage') as string; |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * 控制器 | 30 | * 控制器 |
| @@ -34,7 +34,7 @@ export struct CountDownInstallDialogBuilder { | |||
| 34 | /** | 34 | /** |
| 35 | * 文本显示内容 | 35 | * 文本显示内容 |
| 36 | */ | 36 | */ |
| 37 | - textString: Resource | string; | 37 | + textString: Resource | string = ''; |
| 38 | 38 | ||
| 39 | /** | 39 | /** |
| 40 | * 取消按钮显示内容 | 40 | * 取消按钮显示内容 |
| @@ -49,7 +49,7 @@ export struct CountDownInstallDialogBuilder { | |||
| 49 | /** | 49 | /** |
| 50 | * 弹窗类型 | 50 | * 弹窗类型 |
| 51 | */ | 51 | */ |
| 52 | - dialogType: CountDownDialogType; | 52 | + dialogType: CountDownDialogType | undefined = undefined; |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | * 倒计时 | 55 | * 倒计时 |
| @@ -59,14 +59,16 @@ export struct CountDownInstallDialogBuilder { | |||
| 59 | /** | 59 | /** |
| 60 | * 取消回调 | 60 | * 取消回调 |
| 61 | */ | 61 | */ |
| 62 | - cancel: () => void; | 62 | + cancel: () => void = () => { |
| 63 | + }; | ||
| 63 | 64 | ||
| 64 | /** | 65 | /** |
| 65 | * 确认回调 | 66 | * 确认回调 |
| 66 | */ | 67 | */ |
| 67 | - confirm: () => void; | 68 | + confirm: () => void = () => { |
| 69 | + }; | ||
| 68 | 70 | ||
| 69 | - private intervalID: number = null; | 71 | + private intervalID: number | null = null; |
| 70 | 72 | ||
| 71 | aboutToAppear() { | 73 | aboutToAppear() { |
| 72 | this.getCount(); | 74 | this.getCount(); |
| @@ -95,7 +97,7 @@ export struct CountDownInstallDialogBuilder { | |||
| 95 | 97 | ||
| 96 | private initButtonText(): void { | 98 | private initButtonText(): void { |
| 97 | this.cancelBtnText = FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.later')); | 99 | this.cancelBtnText = FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.later')); |
| 98 | - let confirmBtnRes = null; | 100 | + let confirmBtnRes: ResourceStr = ''; |
| 99 | if (this.dialogType == CountDownDialogType.OTA) { | 101 | if (this.dialogType == CountDownDialogType.OTA) { |
| 100 | confirmBtnRes = $r('app.string.install_now'); | 102 | confirmBtnRes = $r('app.string.install_now'); |
| 101 | } else if (this.dialogType == CountDownDialogType.OTA_AB) { | 103 | } else if (this.dialogType == CountDownDialogType.OTA_AB) { |
| @@ -13,9 +13,72 @@ | |||
| 13 | * limitations under the License. | 13 | * limitations under the License. |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | +import update from '@ohos.update'; | ||
| 16 | import { DeviceUtils } from '@ohos/common/src/main/ets/util/DeviceUtils'; | 17 | import { DeviceUtils } from '@ohos/common/src/main/ets/util/DeviceUtils'; |
| 17 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 18 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 18 | import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; | 19 | import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; |
| 20 | +import { UpdateState } from '@ohos/common/src/main/ets/const/update_const'; | ||
| 21 | +import { OtaUpdateManager } from '../manager/OtaUpdateManager'; | ||
| 22 | +import RouterUtils from '../util/RouterUtils'; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * 弹框操作接口 | ||
| 26 | + * | ||
| 27 | + * @since 2022-06-05 | ||
| 28 | + */ | ||
| 29 | +export interface DialogOperator { | ||
| 30 | + /** | ||
| 31 | + * 取消 | ||
| 32 | + */ | ||
| 33 | + onCancel(): void; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 确认 | ||
| 37 | + */ | ||
| 38 | + onConfirm(): void; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +/** | ||
| 42 | + * 重试检测动作 | ||
| 43 | + */ | ||
| 44 | +class RetryCheckAction implements DialogOperator { | ||
| 45 | + onConfirm(): void { | ||
| 46 | + RouterUtils.singletonHomePage(); | ||
| 47 | + } | ||
| 48 | + onCancel(): void { | ||
| 49 | + RouterUtils.singletonHomePage(); | ||
| 50 | + } | ||
| 51 | +}; | ||
| 52 | + | ||
| 53 | +export const retryCheckAction: DialogOperator = new RetryCheckAction(); | ||
| 54 | + | ||
| 55 | +/** | ||
| 56 | + * 重试下载动作 | ||
| 57 | + */ | ||
| 58 | +class RetryDownloadAction implements DialogOperator { | ||
| 59 | + onConfirm(): void { | ||
| 60 | + OtaUpdateManager.getInstance().setUpdateState(UpdateState.CHECK_SUCCESS); | ||
| 61 | + } | ||
| 62 | + onCancel(): void { | ||
| 63 | + OtaUpdateManager.getInstance().setUpdateState(UpdateState.CHECK_SUCCESS); | ||
| 64 | + } | ||
| 65 | +}; | ||
| 66 | + | ||
| 67 | +const retryDownloadAction: DialogOperator = new RetryDownloadAction(); | ||
| 68 | + | ||
| 69 | +/** | ||
| 70 | + * 重试安装动作 | ||
| 71 | + */ | ||
| 72 | +class RetryUpgradeAction implements DialogOperator { | ||
| 73 | + onConfirm(): void { | ||
| 74 | + OtaUpdateManager.getInstance().setUpdateState(UpdateState.DOWNLOAD_SUCCESS); | ||
| 75 | + } | ||
| 76 | + onCancel(): void { | ||
| 77 | + OtaUpdateManager.getInstance().setUpdateState(UpdateState.DOWNLOAD_SUCCESS); | ||
| 78 | + } | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +const retryUpgradeAction: DialogOperator = new RetryUpgradeAction(); | ||
| 19 | 82 | ||
| 20 | /** | 83 | /** |
| 21 | * 弹框辅助者 | 84 | * 弹框辅助者 |
| @@ -23,29 +86,12 @@ import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; | |||
| 23 | * @since 2022-06-05 | 86 | * @since 2022-06-05 |
| 24 | */ | 87 | */ |
| 25 | export namespace DialogHelper { | 88 | export namespace DialogHelper { |
| 26 | - /** | ||
| 27 | - * 弹框操作接口 | ||
| 28 | - * | ||
| 29 | - * @since 2022-06-05 | ||
| 30 | - */ | ||
| 31 | - export interface DialogOperator { | ||
| 32 | - /** | ||
| 33 | - * 取消 | ||
| 34 | - */ | ||
| 35 | - onCancel?: () => void; | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 确认 | ||
| 39 | - */ | ||
| 40 | - onConfirm?: () => void; | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | /** | 89 | /** |
| 44 | * 网络弹框 | 90 | * 网络弹框 |
| 45 | * | 91 | * |
| 46 | * @param operator 回调 | 92 | * @param operator 回调 |
| 47 | */ | 93 | */ |
| 48 | - export function displayNetworkDialog(operator: DialogOperator): void { | 94 | + export function displayNetworkDialog(): void { |
| 49 | AlertDialog.show( | 95 | AlertDialog.show( |
| 50 | { | 96 | { |
| 51 | title: $r('app.string.software_update'), | 97 | title: $r('app.string.software_update'), |
| @@ -54,7 +100,8 @@ export namespace DialogHelper { | |||
| 54 | value: FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.cancel')), | 100 | value: FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.cancel')), |
| 55 | action: () => { | 101 | action: () => { |
| 56 | logInfo('Callback when the first button is clicked'); | 102 | logInfo('Callback when the first button is clicked'); |
| 57 | - operator.onCancel?.(); | 103 | + onCancel: () => { |
| 104 | + }; | ||
| 58 | }, | 105 | }, |
| 59 | backgroundColor: $r('sys.float.ohos_id_corner_radius_button') | 106 | backgroundColor: $r('sys.float.ohos_id_corner_radius_button') |
| 60 | }, | 107 | }, |
| @@ -62,7 +109,9 @@ export namespace DialogHelper { | |||
| 62 | value: $r('app.string.ok'), | 109 | value: $r('app.string.ok'), |
| 63 | action: () => { | 110 | action: () => { |
| 64 | logInfo('Callback when the second button is clicked'); | 111 | logInfo('Callback when the second button is clicked'); |
| 65 | - operator.onConfirm?.(); | 112 | + onConfirm: () => { |
| 113 | + OtaUpdateManager.getInstance().download(update.NetType.CELLULAR); | ||
| 114 | + }; | ||
| 66 | }, | 115 | }, |
| 67 | backgroundColor: $r('sys.float.ohos_id_corner_radius_button') | 116 | backgroundColor: $r('sys.float.ohos_id_corner_radius_button') |
| 68 | }, | 117 | }, |
| @@ -84,8 +133,8 @@ export namespace DialogHelper { | |||
| 84 | * | 133 | * |
| 85 | * @param operator 回调 | 134 | * @param operator 回调 |
| 86 | */ | 135 | */ |
| 87 | - export function displayUpgradeFailDialog(operator ?: DialogOperator): void { | 136 | + export function displayUpgradeFailDialog(): void { |
| 88 | - defaultNoTitleDialog($r('app.string.update_fail'), operator); | 137 | + defaultNoTitleDialog($r('app.string.update_fail'), retryCheckAction); |
| 89 | } | 138 | } |
| 90 | 139 | ||
| 91 | /** | 140 | /** |
| @@ -93,8 +142,8 @@ export namespace DialogHelper { | |||
| 93 | * | 142 | * |
| 94 | * @param operator 回调 | 143 | * @param operator 回调 |
| 95 | */ | 144 | */ |
| 96 | - export function displayDownloadFailDialog(operator ?: DialogOperator): void { | 145 | + export function displayDownloadFailDialog(): void { |
| 97 | - defaultNoTitleDialog($r('app.string.download_fail'), operator); | 146 | + defaultNoTitleDialog($r('app.string.download_fail'), retryCheckAction); |
| 98 | } | 147 | } |
| 99 | 148 | ||
| 100 | /** | 149 | /** |
| @@ -102,8 +151,8 @@ export namespace DialogHelper { | |||
| 102 | * | 151 | * |
| 103 | * @param operator 回调 | 152 | * @param operator 回调 |
| 104 | */ | 153 | */ |
| 105 | - export function displayNoNetworkDialog(operator ?: DialogOperator): void { | 154 | + export function displayNoNetworkDialog(): void { |
| 106 | - defaultKnowDialog($r('app.string.net_error_title'), $r('app.string.net_error_content'), operator); | 155 | + defaultKnowDialog($r('app.string.net_error_title'), $r('app.string.net_error_content')); |
| 107 | } | 156 | } |
| 108 | 157 | ||
| 109 | /** | 158 | /** |
| @@ -111,9 +160,19 @@ export namespace DialogHelper { | |||
| 111 | * | 160 | * |
| 112 | * @param operator 回调 | 161 | * @param operator 回调 |
| 113 | */ | 162 | */ |
| 114 | - export function displayNotEnoughBatteryDialog(operator ?: DialogOperator): void { | 163 | + export function displayNotEnoughBatteryDialog(): void { |
| 115 | defaultKnowDialog($r('app.string.battery_not_enough_title'), $r('app.string.battery_not_enough_content', | 164 | defaultKnowDialog($r('app.string.battery_not_enough_title'), $r('app.string.battery_not_enough_content', |
| 116 | - FormatUtils.getNumberFormat(0.3)), operator); | 165 | + FormatUtils.getNumberFormat(0.3))); |
| 166 | + } | ||
| 167 | + | ||
| 168 | +/** | ||
| 169 | + * 下载空间不足弹框 | ||
| 170 | + * | ||
| 171 | + * @param operator 回调 | ||
| 172 | + */ | ||
| 173 | + export function displayDownloadNotEnoughSpaceDialog(): void { | ||
| 174 | + defaultKnowDialog($r('app.string.space_not_enough_title'), $r('app.string.space_not_enough_content'), | ||
| 175 | + retryDownloadAction); | ||
| 117 | } | 176 | } |
| 118 | 177 | ||
| 119 | /** | 178 | /** |
| @@ -121,8 +180,9 @@ export namespace DialogHelper { | |||
| 121 | * | 180 | * |
| 122 | * @param operator 回调 | 181 | * @param operator 回调 |
| 123 | */ | 182 | */ |
| 124 | - export function displayNotEnoughSpaceDialog(operator ?: DialogOperator): void { | 183 | + export function displayUpgradeNotEnoughSpaceDialog(): void { |
| 125 | - defaultKnowDialog($r('app.string.space_not_enough_title'), $r('app.string.space_not_enough_content'), operator); | 184 | + defaultKnowDialog($r('app.string.space_not_enough_title'), $r('app.string.space_not_enough_content'), |
| 185 | + retryUpgradeAction); | ||
| 126 | } | 186 | } |
| 127 | 187 | ||
| 128 | /** | 188 | /** |
| @@ -130,8 +190,8 @@ export namespace DialogHelper { | |||
| 130 | * | 190 | * |
| 131 | * @param operator 回调 | 191 | * @param operator 回调 |
| 132 | */ | 192 | */ |
| 133 | - export function displayVerifyFailDialog(operator ?: DialogOperator): void { | 193 | + export function displayVerifyFailDialog(): void { |
| 134 | - defaultNoTitleDialog($r('app.string.package_verify_fail'), operator); | 194 | + defaultNoTitleDialog($r('app.string.package_verify_fail'), retryCheckAction); |
| 135 | } | 195 | } |
| 136 | 196 | ||
| 137 | /** | 197 | /** |
| @@ -163,7 +223,7 @@ export namespace DialogHelper { | |||
| 163 | * @param confirmText 确认按钮显示内容 | 223 | * @param confirmText 确认按钮显示内容 |
| 164 | * @param operator 回调 | 224 | * @param operator 回调 |
| 165 | */ | 225 | */ |
| 166 | - function showDialog(title: string | Resource, message: string | Resource, confirmText?: string | Resource, | 226 | + function showDialog(title: string | Resource | null, message: string | Resource, confirmText?: string | Resource, |
| 167 | operator ?: DialogOperator): void { | 227 | operator ?: DialogOperator): void { |
| 168 | AlertDialog.show( | 228 | AlertDialog.show( |
| 169 | { | 229 | { |
| @@ -173,7 +233,7 @@ export namespace DialogHelper { | |||
| 173 | value: confirmText, | 233 | value: confirmText, |
| 174 | action: () => { | 234 | action: () => { |
| 175 | logInfo('defaultKnowDialog button is clicked'); | 235 | logInfo('defaultKnowDialog button is clicked'); |
| 176 | - if (operator) { | 236 | + if (operator && operator.onConfirm) { |
| 177 | operator.onConfirm(); | 237 | operator.onConfirm(); |
| 178 | } | 238 | } |
| 179 | }, | 239 | }, |
| @@ -181,8 +241,8 @@ export namespace DialogHelper { | |||
| 181 | }, | 241 | }, |
| 182 | cancel: () => { | 242 | cancel: () => { |
| 183 | logInfo('Closed callbacks'); | 243 | logInfo('Closed callbacks'); |
| 184 | - if(operator) { | 244 | + if(operator && operator.onCancel) { |
| 185 | - operator.onCancel(); | 245 | + operator?.onCancel(); |
| 186 | } | 246 | } |
| 187 | }, | 247 | }, |
| 188 | alignment: DeviceUtils.getDialogLocation(), | 248 | alignment: DeviceUtils.getDialogLocation(), |
Rfeature/ota/src/main/ets/dialog/DialogUtils.ts→feature/ota/src/main/ets/dialog/DialogUtils.ets+42-55
| @@ -19,82 +19,69 @@ import type { OtaStatus } from '@ohos/common/src/main/ets/const/update_const'; | |||
| 19 | import { MAIN_ABILITY_NAME, PACKAGE_NAME, UpdateState } from '@ohos/common/src/main/ets/const/update_const'; | 19 | import { MAIN_ABILITY_NAME, PACKAGE_NAME, UpdateState } from '@ohos/common/src/main/ets/const/update_const'; |
| 20 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 20 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 21 | import { UpdateUtils } from '@ohos/common/src/main/ets/util/UpdateUtils'; | 21 | import { UpdateUtils } from '@ohos/common/src/main/ets/util/UpdateUtils'; |
| 22 | +import { foregroundCheck } from '@ohos/common/src/main/ets/util/CommonUtils'; | ||
| 22 | import { OtaUpdateManager } from '../manager/OtaUpdateManager'; | 23 | import { OtaUpdateManager } from '../manager/OtaUpdateManager'; |
| 23 | import RouterUtils from '../util/RouterUtils'; | 24 | import RouterUtils from '../util/RouterUtils'; |
| 24 | import { DialogHelper } from './DialogHelper'; | 25 | import { DialogHelper } from './DialogHelper'; |
| 25 | 26 | ||
| 26 | -const TIME_OUT_FOR_START_ABILITY = 500; | ||
| 27 | - | ||
| 28 | /** | 27 | /** |
| 29 | - * 装饰器--弹框时,前台判断处理 | 28 | + * 弹框操作接口 |
| 29 | + * @since 2025-06-09 | ||
| 30 | */ | 30 | */ |
| 31 | -function foregroundCheck<T>() { | 31 | +interface DialogOperator { |
| 32 | - return function inner(target: unknown, propertyKey: string, descriptor: PropertyDescriptor): void { | 32 | + /** |
| 33 | - const original = descriptor.value; | 33 | + * 取消 |
| 34 | - descriptor.value = function (context: common.Context, otaStatus: OtaStatus, | 34 | + */ |
| 35 | - eventId?: update.EventId, ...args): void { | 35 | + onCancel(): void; |
| 36 | - if (globalThis.AbilityStatus !== 'ON_FOREGROUND') { | ||
| 37 | - globalThis.reNotify = true; | ||
| 38 | - globalThis.otaStatusFromService = otaStatus; | ||
| 39 | - globalThis.eventIdFromService = eventId; | ||
| 40 | - LogUtils.log('foregroundCheck', 'do startMainAbilityIndex.'); | ||
| 41 | 36 | ||
| 42 | - // 应用在后台时,无法弹框,需杀掉ability后,重新拉起界面弹框 | 37 | + /** |
| 43 | - globalThis.abilityContext?.terminateSelf(); | 38 | + * 确认 |
| 44 | - setTimeout(() => { | 39 | + */ |
| 45 | - startMainAbilityIndex(context); | 40 | + onConfirm(): void; |
| 46 | - }, TIME_OUT_FOR_START_ABILITY); | ||
| 47 | - return; | ||
| 48 | - } | ||
| 49 | - original.call(this, ...args); | ||
| 50 | - }; | ||
| 51 | - }; | ||
| 52 | -} | ||
| 53 | - | ||
| 54 | -function startMainAbilityIndex(context: common.Context): void { | ||
| 55 | - let want = { | ||
| 56 | - bundleName: PACKAGE_NAME, | ||
| 57 | - abilityName: MAIN_ABILITY_NAME, | ||
| 58 | - uri: 'pages/newVersion', | ||
| 59 | - }; | ||
| 60 | - UpdateUtils.startAbility(context, want, null); | ||
| 61 | } | 41 | } |
| 62 | 42 | ||
| 63 | /** | 43 | /** |
| 64 | * 重试下载动作 | 44 | * 重试下载动作 |
| 65 | */ | 45 | */ |
| 66 | -const retryDownloadAction = { | 46 | +class RetryDownloadAction implements DialogOperator { |
| 67 | - onConfirm: (): void => { | 47 | + onConfirm(): void { |
| 68 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.CHECK_SUCCESS); | 48 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.CHECK_SUCCESS); |
| 69 | - }, | 49 | + } |
| 70 | - onCancel: (): void => { | 50 | + onCancel(): void { |
| 71 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.CHECK_SUCCESS); | 51 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.CHECK_SUCCESS); |
| 72 | - }, | 52 | + } |
| 73 | }; | 53 | }; |
| 74 | 54 | ||
| 55 | +const retryDownloadAction: DialogOperator = new RetryDownloadAction(); | ||
| 56 | + | ||
| 75 | /** | 57 | /** |
| 76 | * 重试安装动作 | 58 | * 重试安装动作 |
| 77 | */ | 59 | */ |
| 78 | -const retryUpgradeAction = { | 60 | +class RetryUpgradeAction implements DialogOperator { |
| 79 | - onConfirm: (): void => { | 61 | + onConfirm(): void { |
| 80 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.DOWNLOAD_SUCCESS); | 62 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.DOWNLOAD_SUCCESS); |
| 81 | - }, | 63 | + } |
| 82 | - onCancel: (): void => { | 64 | + onCancel(): void { |
| 83 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.DOWNLOAD_SUCCESS); | 65 | OtaUpdateManager.getInstance().setUpdateState(UpdateState.DOWNLOAD_SUCCESS); |
| 84 | - }, | 66 | + } |
| 85 | -}; | 67 | +} |
| 68 | + | ||
| 69 | +const retryUpgradeAction: DialogOperator = new RetryUpgradeAction(); | ||
| 86 | 70 | ||
| 87 | /** | 71 | /** |
| 88 | * 重试检测动作 | 72 | * 重试检测动作 |
| 89 | */ | 73 | */ |
| 90 | -const retryCheckAction = { | 74 | +class RetryCheckAction implements DialogOperator { |
| 91 | - onConfirm: (): void => { | 75 | + onConfirm(): void { |
| 92 | RouterUtils.singletonHomePage(); | 76 | RouterUtils.singletonHomePage(); |
| 93 | - }, onCancel: (): void => { | 77 | + } |
| 78 | + onCancel(): void { | ||
| 94 | RouterUtils.singletonHomePage(); | 79 | RouterUtils.singletonHomePage(); |
| 95 | - }, | 80 | + } |
| 96 | }; | 81 | }; |
| 97 | 82 | ||
| 83 | + export const retryCheckAction: DialogOperator = new RetryCheckAction(); | ||
| 84 | + | ||
| 98 | /** | 85 | /** |
| 99 | * 弹框工具类 | 86 | * 弹框工具类 |
| 100 | * | 87 | * |
| @@ -110,7 +97,7 @@ export class DialogUtils { | |||
| 110 | static showDownloadNotEnoughSpaceDialog(context: common.Context, otaStatus: OtaStatus, | 97 | static showDownloadNotEnoughSpaceDialog(context: common.Context, otaStatus: OtaStatus, |
| 111 | eventId?: update.EventId): void { | 98 | eventId?: update.EventId): void { |
| 112 | LogUtils.log('DialogUtils', 'showDownloadNotEnoughSpaceDialog'); | 99 | LogUtils.log('DialogUtils', 'showDownloadNotEnoughSpaceDialog'); |
| 113 | - DialogHelper.displayNotEnoughSpaceDialog(retryDownloadAction); | 100 | + DialogHelper.displayDownloadNotEnoughSpaceDialog(); |
| 114 | } | 101 | } |
| 115 | 102 | ||
| 116 | /** | 103 | /** |
| @@ -131,9 +118,9 @@ export class DialogUtils { | |||
| 131 | * @param context 上下文 | 118 | * @param context 上下文 |
| 132 | */ | 119 | */ |
| 133 | @foregroundCheck() | 120 | @foregroundCheck() |
| 134 | - static showVerifyFailDialog(context: common.Context, otaStatus: OtaStatus, eventId?: update.EventId): void { | 121 | + static showVerifyFailDialog(context: common.Context, otaStatus?: OtaStatus, eventId?: update.EventId): void { |
| 135 | LogUtils.log('DialogUtils', 'showVerifyFailDialog'); | 122 | LogUtils.log('DialogUtils', 'showVerifyFailDialog'); |
| 136 | - DialogHelper.displayVerifyFailDialog(retryCheckAction); | 123 | + DialogHelper.displayVerifyFailDialog(); |
| 137 | } | 124 | } |
| 138 | 125 | ||
| 139 | /** | 126 | /** |
| @@ -142,9 +129,9 @@ export class DialogUtils { | |||
| 142 | * @param context 上下文 | 129 | * @param context 上下文 |
| 143 | */ | 130 | */ |
| 144 | @foregroundCheck() | 131 | @foregroundCheck() |
| 145 | - static showDownloadFailDialog(context: common.Context, otaStatus: OtaStatus, eventId?: update.EventId): void { | 132 | + static showDownloadFailDialog(context: common.Context, otaStatus?: OtaStatus, eventId?: update.EventId): void { |
| 146 | LogUtils.log('DialogUtils', 'showDownloadFailDialog'); | 133 | LogUtils.log('DialogUtils', 'showDownloadFailDialog'); |
| 147 | - DialogHelper.displayDownloadFailDialog(retryCheckAction); | 134 | + DialogHelper.displayDownloadFailDialog(); |
| 148 | } | 135 | } |
| 149 | 136 | ||
| 150 | /** | 137 | /** |
| @@ -156,7 +143,7 @@ export class DialogUtils { | |||
| 156 | static showUpgradeNotEnoughSpaceDialog(context: common.Context, otaStatus: OtaStatus, | 143 | static showUpgradeNotEnoughSpaceDialog(context: common.Context, otaStatus: OtaStatus, |
| 157 | eventId?: update.EventId): void { | 144 | eventId?: update.EventId): void { |
| 158 | LogUtils.log('DialogUtils', 'showUpgradeNotEnoughSpaceDialog'); | 145 | LogUtils.log('DialogUtils', 'showUpgradeNotEnoughSpaceDialog'); |
| 159 | - DialogHelper.displayNotEnoughSpaceDialog(retryUpgradeAction); | 146 | + DialogHelper.displayUpgradeNotEnoughSpaceDialog(); |
| 160 | } | 147 | } |
| 161 | 148 | ||
| 162 | /** | 149 | /** |
| @@ -177,8 +164,8 @@ export class DialogUtils { | |||
| 177 | * @param context 上下文 | 164 | * @param context 上下文 |
| 178 | */ | 165 | */ |
| 179 | @foregroundCheck() | 166 | @foregroundCheck() |
| 180 | - static showUpgradeFailDialog(context: common.Context, otaStatus: OtaStatus, eventId?: update.EventId): void { | 167 | + static showUpgradeFailDialog(context: common.Context, otaStatus?: OtaStatus, eventId?: update.EventId): void { |
| 181 | LogUtils.log('DialogUtils', 'showUpgradeFailDialog'); | 168 | LogUtils.log('DialogUtils', 'showUpgradeFailDialog'); |
| 182 | - DialogHelper.displayUpgradeFailDialog(retryCheckAction); | 169 | + DialogHelper.displayUpgradeFailDialog(); |
| 183 | } | 170 | } |
| 184 | } | 171 | } |
| @@ -23,7 +23,7 @@ export struct MessageDialogBuilder { | |||
| 23 | /** | 23 | /** |
| 24 | * 内容 | 24 | * 内容 |
| 25 | */ | 25 | */ |
| 26 | - message: ResourceStr; | 26 | + message: ResourceStr = ''; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * 控制器 | 29 | * 控制器 |
| @@ -17,9 +17,10 @@ import type common from '@ohos.app.ability.common'; | |||
| 17 | import update from '@ohos.update'; | 17 | import update from '@ohos.update'; |
| 18 | import type Want from '@ohos.app.ability.Want'; | 18 | import type Want from '@ohos.app.ability.Want'; |
| 19 | import { ErrorCode } from '@ohos/common/src/main/ets/const/update_const'; | 19 | import { ErrorCode } from '@ohos/common/src/main/ets/const/update_const'; |
| 20 | -import type { OtaStatus, UpgradeData, } from '@ohos/common/src/main/ets/const/update_const'; | 20 | +import type { BusinessError, OtaStatus, UpgradeData, CustomEventInfo } |
| 21 | + from '@ohos/common/src/main/ets/const/update_const'; | ||
| 21 | import { UpdateState, UpgradeCallResult, } from '@ohos/common/src/main/ets/const/update_const'; | 22 | import { UpdateState, UpgradeCallResult, } from '@ohos/common/src/main/ets/const/update_const'; |
| 22 | -import type { Message } from '@ohos/common/src/main/ets/manager/UpdateManager'; | 23 | +import { Message } from '@ohos/common/src/main/ets/manager/UpdateManager'; |
| 23 | import { | 24 | import { |
| 24 | UpdateManager, | 25 | UpdateManager, |
| 25 | MessageQueue, | 26 | MessageQueue, |
| @@ -31,6 +32,7 @@ import type { BaseState } from '../manager/StateManager'; | |||
| 31 | import { StateManager } from '../manager/StateManager'; | 32 | import { StateManager } from '../manager/StateManager'; |
| 32 | import { NotificationManager } from '../notify/NotificationManager'; | 33 | import { NotificationManager } from '../notify/NotificationManager'; |
| 33 | import VersionUtils from '../util/VersionUtils'; | 34 | import VersionUtils from '../util/VersionUtils'; |
| 35 | +import { CommonUtils } from '@ohos/common/src/main/ets/util/CommonUtils'; | ||
| 34 | import { UpgradeAdapter } from '../UpgradeAdapter'; | 36 | import { UpgradeAdapter } from '../UpgradeAdapter'; |
| 35 | import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; | 37 | import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; |
| 36 | 38 | ||
| @@ -41,13 +43,14 @@ import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; | |||
| 41 | */ | 43 | */ |
| 42 | export class OtaUpdateManager { | 44 | export class OtaUpdateManager { |
| 43 | private static readonly KEY = 'EventInfo'; | 45 | private static readonly KEY = 'EventInfo'; |
| 44 | - private _updateStatus: number; | 46 | + private _updateStatus: number | null = null; |
| 45 | - private _downloadProgress: number; | 47 | + private _downloadProgress?: number; |
| 46 | - private lastStatus: number; | 48 | + private lastStatus?: number; |
| 47 | - private stateObj: BaseState; | 49 | + private stateObj?: BaseState; |
| 48 | private otaStatusHolder: OtaStatusHolder; | 50 | private otaStatusHolder: OtaStatusHolder; |
| 49 | private updateManager: UpdateManager; | 51 | private updateManager: UpdateManager; |
| 50 | private messageQueue: MessageQueue; | 52 | private messageQueue: MessageQueue; |
| 53 | + private otaUpdaterCallBack: update.UpgradeTaskCallback; | ||
| 51 | 54 | ||
| 52 | /** | 55 | /** |
| 53 | * 单例--升级管理类对象实例 | 56 | * 单例--升级管理类对象实例 |
| @@ -62,10 +65,21 @@ export class OtaUpdateManager { | |||
| 62 | this.log('OtaUpdateManager init.'); | 65 | this.log('OtaUpdateManager init.'); |
| 63 | globalThis.otaUpdateManager = this; | 66 | globalThis.otaUpdateManager = this; |
| 64 | this.otaStatusHolder = new OtaStatusHolder(); | 67 | this.otaStatusHolder = new OtaStatusHolder(); |
| 65 | - this.messageQueue = new MessageQueue(this.handleMessage.bind(this)); | 68 | + this.messageQueue = new MessageQueue((message: Message): Promise<void> => this.handleMessage(message)); |
| 69 | + this.updateManager = new UpdateManager(update.BusinessSubType.FIRMWARE); | ||
| 70 | + this.otaUpdaterCallBack = (eventInfo: update.EventInfo): void => { | ||
| 71 | + this.notifyUpdateStatusRemote(eventInfo); | ||
| 72 | + }; | ||
| 73 | + } | ||
| 66 | 74 | ||
| 67 | - this.updateManager = new UpdateManager(); | 75 | + off(): void { |
| 68 | - this.updateManager.bind(update.BusinessSubType.FIRMWARE, this.notifyUpdateStatusRemote.bind(this)); | 76 | + this.log('otaUpdater off'); |
| 77 | + this.updateManager.off(this.otaUpdaterCallBack); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + on(): void { | ||
| 81 | + this.log('otaUpdater on'); | ||
| 82 | + this.updateManager.on(this.otaUpdaterCallBack); | ||
| 69 | } | 83 | } |
| 70 | 84 | ||
| 71 | /** | 85 | /** |
| @@ -77,7 +91,7 @@ export class OtaUpdateManager { | |||
| 77 | return new Promise((resolve, reject) => { | 91 | return new Promise((resolve, reject) => { |
| 78 | this.updateManager.getOtaStatus().then((result: UpgradeData<OtaStatus>) => { | 92 | this.updateManager.getOtaStatus().then((result: UpgradeData<OtaStatus>) => { |
| 79 | if (result?.callResult === UpgradeCallResult.OK) { | 93 | if (result?.callResult === UpgradeCallResult.OK) { |
| 80 | - this.refreshState(result?.data); | 94 | + this.refreshState(result?.data as OtaStatus); |
| 81 | } | 95 | } |
| 82 | resolve(result); | 96 | resolve(result); |
| 83 | }); | 97 | }); |
| @@ -85,7 +99,7 @@ export class OtaUpdateManager { | |||
| 85 | } | 99 | } |
| 86 | 100 | ||
| 87 | /** | 101 | /** |
| 88 | - * 从due数据库取新版本信息 | 102 | + * 从UpdateService数据库取新版本信息 |
| 89 | * | 103 | * |
| 90 | * @return resolve 新版本信息/reject 错误信息 | 104 | * @return resolve 新版本信息/reject 错误信息 |
| 91 | */ | 105 | */ |
| @@ -151,11 +165,11 @@ export class OtaUpdateManager { | |||
| 151 | return new Promise((resolve, reject) => { | 165 | return new Promise((resolve, reject) => { |
| 152 | this.updateManager.upgrade(versionDigest, order).then(()=> { | 166 | this.updateManager.upgrade(versionDigest, order).then(()=> { |
| 153 | resolve(); | 167 | resolve(); |
| 154 | - }).catch(err => { | 168 | + }).catch((err: BusinessError) => { |
| 155 | let status: OtaStatus = { | 169 | let status: OtaStatus = { |
| 156 | status: order === update.Order.APPLY ? UpdateState.INSTALL_SUCCESS : UpdateState.DOWNLOAD_SUCCESS, | 170 | status: order === update.Order.APPLY ? UpdateState.INSTALL_SUCCESS : UpdateState.DOWNLOAD_SUCCESS, |
| 157 | percent: 100, | 171 | percent: 100, |
| 158 | - endReason: err?.data?.[0]?.errorCode?.toString() || ErrorCode.DEFAULT_ERROR, | 172 | + endReason: err?.data?.[0]?.errorCode?.toString() || ErrorCode.DEFAULT_ERROR.toString(), |
| 159 | }; | 173 | }; |
| 160 | this.notifyUpdateStatus(status, globalThis.abilityContext); | 174 | this.notifyUpdateStatus(status, globalThis.abilityContext); |
| 161 | this.logError('upgrade err:' + JSON.stringify(err)); | 175 | this.logError('upgrade err:' + JSON.stringify(err)); |
| @@ -174,7 +188,7 @@ export class OtaUpdateManager { | |||
| 174 | let versionDigest: string = await VersionUtils.getNewVersionDigest(); | 188 | let versionDigest: string = await VersionUtils.getNewVersionDigest(); |
| 175 | this.setDownloadProgress(0); | 189 | this.setDownloadProgress(0); |
| 176 | this.updateManager.download(versionDigest, downloadNetwork, update.Order.DOWNLOAD) | 190 | this.updateManager.download(versionDigest, downloadNetwork, update.Order.DOWNLOAD) |
| 177 | - .catch(err => { | 191 | + .catch((err: BusinessError) => { |
| 178 | let status: OtaStatus = { | 192 | let status: OtaStatus = { |
| 179 | status: UpdateState.CHECK_SUCCESS, | 193 | status: UpdateState.CHECK_SUCCESS, |
| 180 | percent: 0, | 194 | percent: 0, |
| @@ -192,7 +206,7 @@ export class OtaUpdateManager { | |||
| 192 | this.setUpdateState(UpdateState.DOWNLOADING); | 206 | this.setUpdateState(UpdateState.DOWNLOADING); |
| 193 | this.updateManager.resumeDownload(versionDigest, update.NetType.WIFI).then(result => { | 207 | this.updateManager.resumeDownload(versionDigest, update.NetType.WIFI).then(result => { |
| 194 | this.log('resumeDownload result:' + JSON.stringify(result)); | 208 | this.log('resumeDownload result:' + JSON.stringify(result)); |
| 195 | - }).catch(err => { | 209 | + }).catch((err: BusinessError) => { |
| 196 | let status: OtaStatus = { | 210 | let status: OtaStatus = { |
| 197 | status: UpdateState.DOWNLOAD_PAUSE, | 211 | status: UpdateState.DOWNLOAD_PAUSE, |
| 198 | percent: this.getDownloadProgress(), | 212 | percent: this.getDownloadProgress(), |
| @@ -226,7 +240,7 @@ export class OtaUpdateManager { | |||
| 226 | * | 240 | * |
| 227 | * @return 升级状态 | 241 | * @return 升级状态 |
| 228 | */ | 242 | */ |
| 229 | - getUpdateState(): number { | 243 | + getUpdateState(): number | null { |
| 230 | return this._updateStatus; | 244 | return this._updateStatus; |
| 231 | } | 245 | } |
| 232 | 246 | ||
| @@ -235,7 +249,7 @@ export class OtaUpdateManager { | |||
| 235 | * | 249 | * |
| 236 | * @param value 状态 | 250 | * @param value 状态 |
| 237 | */ | 251 | */ |
| 238 | - setUpdateState(value): void { | 252 | + setUpdateState(value: number): void { |
| 239 | if (this._updateStatus !== Number(value) && value !== undefined && value !== null) { | 253 | if (this._updateStatus !== Number(value) && value !== undefined && value !== null) { |
| 240 | this._updateStatus = Number(value); | 254 | this._updateStatus = Number(value); |
| 241 | AppStorage.Set('updateStatus', this._updateStatus); | 255 | AppStorage.Set('updateStatus', this._updateStatus); |
| @@ -247,7 +261,7 @@ export class OtaUpdateManager { | |||
| 247 | * | 261 | * |
| 248 | * @return 升级进度 | 262 | * @return 升级进度 |
| 249 | */ | 263 | */ |
| 250 | - getDownloadProgress(): number { | 264 | + getDownloadProgress(): number | undefined { |
| 251 | return this._downloadProgress; | 265 | return this._downloadProgress; |
| 252 | } | 266 | } |
| 253 | 267 | ||
| @@ -256,7 +270,7 @@ export class OtaUpdateManager { | |||
| 256 | * | 270 | * |
| 257 | * @param value 进度 | 271 | * @param value 进度 |
| 258 | */ | 272 | */ |
| 259 | - setDownloadProgress(value): void { | 273 | + setDownloadProgress(value: number): void { |
| 260 | if (this._downloadProgress !== value && value !== undefined && value !== null) { | 274 | if (this._downloadProgress !== value && value !== undefined && value !== null) { |
| 261 | this._downloadProgress = value; | 275 | this._downloadProgress = value; |
| 262 | AppStorage.Set('downloadProgress', this._downloadProgress); | 276 | AppStorage.Set('downloadProgress', this._downloadProgress); |
| @@ -301,13 +315,14 @@ export class OtaUpdateManager { | |||
| 301 | this.messageQueue.execute(message); | 315 | this.messageQueue.execute(message); |
| 302 | } | 316 | } |
| 303 | 317 | ||
| 304 | - private async handleMessage(context: common.Context, eventInfo: update.EventInfo): Promise<void> { | 318 | + private async handleMessage(message: Message): Promise<void> { |
| 319 | + let eventInfo: CustomEventInfo = message.eventInfo as CustomEventInfo; | ||
| 305 | let otaStatus: OtaStatus = this.getFormattedOtaStatus(eventInfo); | 320 | let otaStatus: OtaStatus = this.getFormattedOtaStatus(eventInfo); |
| 306 | if (this.isTerminalState(otaStatus)) { | 321 | if (this.isTerminalState(otaStatus)) { |
| 307 | globalThis.lastVersionName = await VersionUtils.obtainNewVersionName(eventInfo?.taskBody); | 322 | globalThis.lastVersionName = await VersionUtils.obtainNewVersionName(eventInfo?.taskBody); |
| 308 | } | 323 | } |
| 309 | let versionDigest: string = eventInfo?.taskBody?.versionDigestInfo?.versionDigest ?? ''; | 324 | let versionDigest: string = eventInfo?.taskBody?.versionDigestInfo?.versionDigest ?? ''; |
| 310 | - await this.notifyUpdateStatus(otaStatus, context, versionDigest, eventInfo?.eventId); | 325 | + await this.notifyUpdateStatus(otaStatus, message.context, versionDigest, eventInfo?.eventId); |
| 311 | } | 326 | } |
| 312 | 327 | ||
| 313 | private async notifyUpdateStatus(otaStatus: OtaStatus, context: common.Context, verDigest?: string, | 328 | private async notifyUpdateStatus(otaStatus: OtaStatus, context: common.Context, verDigest?: string, |
| @@ -327,6 +342,9 @@ export class OtaUpdateManager { | |||
| 327 | } | 342 | } |
| 328 | 343 | ||
| 329 | private isTerminalState(otaStatus: OtaStatus): boolean { | 344 | private isTerminalState(otaStatus: OtaStatus): boolean { |
| 345 | + if (CommonUtils.isEmpty(otaStatus)) { | ||
| 346 | + return false; | ||
| 347 | + } | ||
| 330 | let status = otaStatus?.status ?? UpdateState.INIT; | 348 | let status = otaStatus?.status ?? UpdateState.INIT; |
| 331 | if (status === UpdateState.INIT || status === UpdateState.DOWNLOAD_FAILED || | 349 | if (status === UpdateState.INIT || status === UpdateState.DOWNLOAD_FAILED || |
| 332 | status === UpdateState.INSTALL_FAILED || status === UpdateState.UPGRADE_SUCCESS || | 350 | status === UpdateState.INSTALL_FAILED || status === UpdateState.UPGRADE_SUCCESS || |
| @@ -369,11 +387,11 @@ export class OtaUpdateManager { | |||
| 369 | public async handleWant(want: Want, context: common.Context): Promise<void> { | 387 | public async handleWant(want: Want, context: common.Context): Promise<void> { |
| 370 | let action: string = want?.action ?? ''; | 388 | let action: string = want?.action ?? ''; |
| 371 | if (await NotificationManager.handleAction(action, context)) { | 389 | if (await NotificationManager.handleAction(action, context)) { |
| 372 | - this.log('handleWant:' + FormatUtils.stringify(want)); | 390 | + this.log('handleWant:' + CommonUtils.stringify(want)); |
| 373 | return; | 391 | return; |
| 374 | } | 392 | } |
| 375 | let eventInfo = this.wantParser(want); | 393 | let eventInfo = this.wantParser(want); |
| 376 | - this.log('handleWant: eventInfo is ' + FormatUtils.stringify(eventInfo)); | 394 | + this.log('handleWant: eventInfo is ' + CommonUtils.stringify(eventInfo)); |
| 377 | if (!eventInfo?.eventId) { | 395 | if (!eventInfo?.eventId) { |
| 378 | this.log('eventInfo?.eventId is null'); | 396 | this.log('eventInfo?.eventId is null'); |
| 379 | return; | 397 | return; |
| @@ -387,13 +405,13 @@ export class OtaUpdateManager { | |||
| 387 | * @return 是否升级终止 | 405 | * @return 是否升级终止 |
| 388 | */ | 406 | */ |
| 389 | public isTerminal(): boolean { | 407 | public isTerminal(): boolean { |
| 390 | - return this.isTerminalState(this.stateObj?.otaStatus); | 408 | + return this.isTerminalState(this.stateObj?.otaStatus as OtaStatus); |
| 391 | } | 409 | } |
| 392 | 410 | ||
| 393 | private wantParser(want: Want): update.EventInfo { | 411 | private wantParser(want: Want): update.EventInfo { |
| 394 | let eventInfo: update.EventInfo = want?.parameters?.[OtaUpdateManager.KEY] as update.EventInfo; | 412 | let eventInfo: update.EventInfo = want?.parameters?.[OtaUpdateManager.KEY] as update.EventInfo; |
| 395 | if (typeof eventInfo === 'string') { | 413 | if (typeof eventInfo === 'string') { |
| 396 | - eventInfo = FormatUtils.parseJson(eventInfo); | 414 | + eventInfo = CommonUtils.parseJson(eventInfo); |
| 397 | } | 415 | } |
| 398 | return eventInfo; | 416 | return eventInfo; |
| 399 | } | 417 | } |
| @@ -418,7 +436,7 @@ export class OtaUpdateManager { | |||
| 418 | let otaStatus: OtaStatus = { | 436 | let otaStatus: OtaStatus = { |
| 419 | status: eventInfo.taskBody?.status, | 437 | status: eventInfo.taskBody?.status, |
| 420 | percent: eventInfo.taskBody?.progress, | 438 | percent: eventInfo.taskBody?.progress, |
| 421 | - endReason: !endReason || endReason === '0' ? null : endReason, | 439 | + endReason: !endReason || endReason === '0' ? '' : endReason, |
| 422 | }; | 440 | }; |
| 423 | if (!otaStatus.status) { | 441 | if (!otaStatus.status) { |
| 424 | otaStatus.status = this.getUpdateStateFromEventId(eventInfo.eventId); | 442 | otaStatus.status = this.getUpdateStateFromEventId(eventInfo.eventId); |
| @@ -426,8 +444,8 @@ export class OtaUpdateManager { | |||
| 426 | return otaStatus; | 444 | return otaStatus; |
| 427 | } | 445 | } |
| 428 | 446 | ||
| 429 | - private getUpdateStateFromEventId(eventId: update.EventId): UpdateState { | 447 | + private getUpdateStateFromEventId(eventId: update.EventId): UpdateState | undefined { |
| 430 | - let status: UpdateState; | 448 | + let status: UpdateState | undefined = undefined; |
| 431 | switch (eventId) { | 449 | switch (eventId) { |
| 432 | case update.EventId.EVENT_TASK_RECEIVE: | 450 | case update.EventId.EVENT_TASK_RECEIVE: |
| 433 | status = UpdateState.CHECK_SUCCESS; | 451 | status = UpdateState.CHECK_SUCCESS; |
| @@ -78,7 +78,7 @@ export namespace StateManager { | |||
| 78 | * @param status 状态 | 78 | * @param status 状态 |
| 79 | * @return 按钮点击行为 | 79 | * @return 按钮点击行为 |
| 80 | */ | 80 | */ |
| 81 | - export function getButtonClickAction(status: number): UpdateAction { | 81 | + export function getButtonClickAction(status: number): UpdateAction | undefined { |
| 82 | return OtaUpdateManager.getInstance().getStateObj(status).buttonClickAction; | 82 | return OtaUpdateManager.getInstance().getStateObj(status).buttonClickAction; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -89,8 +89,8 @@ export namespace StateManager { | |||
| 89 | * @return 实例对象 | 89 | * @return 实例对象 |
| 90 | */ | 90 | */ |
| 91 | export function createInstance(status: OtaStatus | number): BaseState { | 91 | export function createInstance(status: OtaStatus | number): BaseState { |
| 92 | - let state: number = (typeof status === 'number') ? status : status?.status; | 92 | + let state: number = (typeof status === 'number') ? status : Number(status?.status); |
| 93 | - let stateObject: BaseState = null; | 93 | + let stateObject: BaseState | null = null; |
| 94 | switch (state) { | 94 | switch (state) { |
| 95 | case UpdateState.DOWNLOAD_CANCEL: // fall through | 95 | case UpdateState.DOWNLOAD_CANCEL: // fall through |
| 96 | case UpdateState.CHECK_SUCCESS: | 96 | case UpdateState.CHECK_SUCCESS: |
| @@ -108,9 +108,6 @@ export namespace StateManager { | |||
| 108 | case UpdateState.INSTALLING: | 108 | case UpdateState.INSTALLING: |
| 109 | stateObject = new Installing(); | 109 | stateObject = new Installing(); |
| 110 | break; | 110 | break; |
| 111 | - case UpdateState.INSTALL_PAUSE: | ||
| 112 | - stateObject = new InstallPaused(); | ||
| 113 | - break; | ||
| 114 | case UpdateState.INSTALL_FAILED: | 111 | case UpdateState.INSTALL_FAILED: |
| 115 | stateObject = new InstallFailed(); | 112 | stateObject = new InstallFailed(); |
| 116 | break; | 113 | break; |
| @@ -196,7 +193,7 @@ export class BaseState { | |||
| 196 | /** | 193 | /** |
| 197 | * 状态对象 | 194 | * 状态对象 |
| 198 | */ | 195 | */ |
| 199 | - public otaStatus: OtaStatus; | 196 | + public otaStatus?: OtaStatus; |
| 200 | 197 | ||
| 201 | /** | 198 | /** |
| 202 | * 进度 | 199 | * 进度 |
| @@ -231,7 +228,7 @@ export class BaseState { | |||
| 231 | /** | 228 | /** |
| 232 | * 按钮对应的升级行为 | 229 | * 按钮对应的升级行为 |
| 233 | */ | 230 | */ |
| 234 | - public buttonClickAction: UpdateAction; | 231 | + public buttonClickAction?: UpdateAction; |
| 235 | 232 | ||
| 236 | /** | 233 | /** |
| 237 | * 数据刷新 | 234 | * 数据刷新 |
| @@ -240,8 +237,8 @@ export class BaseState { | |||
| 240 | */ | 237 | */ |
| 241 | refresh(otaStatus: OtaStatus): void { | 238 | refresh(otaStatus: OtaStatus): void { |
| 242 | this.otaStatus = otaStatus; | 239 | this.otaStatus = otaStatus; |
| 243 | - if (this.otaStatus?.percent) { | 240 | + if (this.otaStatus?.percent !== undefined && this.otaStatus?.percent !== null) { |
| 244 | - this.percent = otaStatus?.percent; | 241 | + this.percent = otaStatus?.percent as number; |
| 245 | } | 242 | } |
| 246 | } | 243 | } |
| 247 | 244 | ||
| @@ -283,10 +280,10 @@ export class CheckSuccess extends BaseState { | |||
| 283 | this.buttonClickAction = UpdateAction.DOWNLOAD; | 280 | this.buttonClickAction = UpdateAction.DOWNLOAD; |
| 284 | } | 281 | } |
| 285 | 282 | ||
| 286 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | 283 | + async notify(context: common.Context, eventId?: update.EventId): Promise<void> { |
| 287 | if (this.otaStatus?.endReason) { | 284 | if (this.otaStatus?.endReason) { |
| 288 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 285 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 289 | - switch (this.otaStatus.endReason) { | 286 | + switch (Number(this.otaStatus.endReason)) { |
| 290 | case ErrorCode.NETWORK_ERROR: | 287 | case ErrorCode.NETWORK_ERROR: |
| 291 | let message = await context.resourceManager.getString($r('app.string.network_err_toast').id); | 288 | let message = await context.resourceManager.getString($r('app.string.network_err_toast').id); |
| 292 | ToastUtils.showToast(message); | 289 | ToastUtils.showToast(message); |
| @@ -318,7 +315,7 @@ export class Downloading extends BaseState { | |||
| 318 | this.buttonClickAction = UpdateAction.CANCEL; | 315 | this.buttonClickAction = UpdateAction.CANCEL; |
| 319 | } | 316 | } |
| 320 | 317 | ||
| 321 | - async notify(context?: common.Context): Promise<void> { | 318 | + async notify(context: common.Context): Promise<void> { |
| 322 | if (this.percent == 100) { | 319 | if (this.percent == 100) { |
| 323 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 320 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 324 | return; | 321 | return; |
| @@ -330,35 +327,6 @@ export class Downloading extends BaseState { | |||
| 330 | } | 327 | } |
| 331 | } | 328 | } |
| 332 | 329 | ||
| 333 | -export class InstallPaused extends BaseState { | ||
| 334 | - constructor() { | ||
| 335 | - super(); | ||
| 336 | - this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); | ||
| 337 | - this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); | ||
| 338 | - | ||
| 339 | - this.actionSet.push(UpdateAction.INSTALL); | ||
| 340 | - | ||
| 341 | - this.state = UpdateState.INSTALL_PAUSE; | ||
| 342 | - this.downloadStateText = $r('app.string.download_status_download_pause'); | ||
| 343 | - this.buttonText = $r('app.string.continue'); | ||
| 344 | - this.buttonClickAction = UpdateAction.INSTALL; | ||
| 345 | - | ||
| 346 | - this.isButtonClickable = true; | ||
| 347 | - } | ||
| 348 | - | ||
| 349 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | ||
| 350 | - if (!VersionUtils.isInNewVersionPage()) { | ||
| 351 | - return; | ||
| 352 | - } | ||
| 353 | - if (this.otaStatus?.endReason) { | ||
| 354 | - await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | ||
| 355 | - let message = await context.resourceManager.getString($r('app.string.install_pause_message').id); | ||
| 356 | - ToastUtils.showToast(message); | ||
| 357 | - } | ||
| 358 | - | ||
| 359 | - } | ||
| 360 | -} | ||
| 361 | - | ||
| 362 | /** | 330 | /** |
| 363 | * 状态--下载暂停 | 331 | * 状态--下载暂停 |
| 364 | * | 332 | * |
| @@ -376,13 +344,13 @@ export class DownloadPause extends BaseState { | |||
| 376 | this.buttonClickAction = UpdateAction.RESUME; | 344 | this.buttonClickAction = UpdateAction.RESUME; |
| 377 | } | 345 | } |
| 378 | 346 | ||
| 379 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | 347 | + async notify(context: common.Context, eventId?: update.EventId): Promise<void> { |
| 380 | if (!VersionUtils.isInNewVersionPage()) { | 348 | if (!VersionUtils.isInNewVersionPage()) { |
| 381 | return; | 349 | return; |
| 382 | } | 350 | } |
| 383 | if (this.otaStatus?.endReason) { | 351 | if (this.otaStatus?.endReason) { |
| 384 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 352 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 385 | - switch (this.otaStatus?.endReason) { | 353 | + switch (Number(this.otaStatus?.endReason)) { |
| 386 | case ErrorCode.NETWORK_ERROR: | 354 | case ErrorCode.NETWORK_ERROR: |
| 387 | if (eventId == update.EventId.EVENT_DOWNLOAD_PAUSE) { | 355 | if (eventId == update.EventId.EVENT_DOWNLOAD_PAUSE) { |
| 388 | DialogUtils.showDownloadNoNetworkDialog(context, this.otaStatus, eventId); | 356 | DialogUtils.showDownloadNoNetworkDialog(context, this.otaStatus, eventId); |
| @@ -421,9 +389,9 @@ export class DownloadFailed extends BaseState { | |||
| 421 | this.buttonClickAction = UpdateAction.CANCEL; | 389 | this.buttonClickAction = UpdateAction.CANCEL; |
| 422 | } | 390 | } |
| 423 | 391 | ||
| 424 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | 392 | + async notify(context: common.Context, eventId?: update.EventId): Promise<void> { |
| 425 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 393 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 426 | - switch (this.otaStatus.endReason) { | 394 | + switch (Number(this.otaStatus?.endReason)) { |
| 427 | case ErrorCode.VERIFY_PACKAGE_FAIL: | 395 | case ErrorCode.VERIFY_PACKAGE_FAIL: |
| 428 | DialogUtils.showVerifyFailDialog(context, this.otaStatus, eventId); | 396 | DialogUtils.showVerifyFailDialog(context, this.otaStatus, eventId); |
| 429 | break; | 397 | break; |
| @@ -452,7 +420,7 @@ export class DownloadSuccess extends BaseState { | |||
| 452 | this.buttonClickAction = UpdateAction.INSTALL; | 420 | this.buttonClickAction = UpdateAction.INSTALL; |
| 453 | } | 421 | } |
| 454 | 422 | ||
| 455 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | 423 | + async notify(context: common.Context, eventId?: update.EventId): Promise<void> { |
| 456 | let isABInstall = await VersionUtils.isABInstall(); | 424 | let isABInstall = await VersionUtils.isABInstall(); |
| 457 | LogUtils.info('StateManager:', 'notify ab flag ' + isABInstall + ',eventId:' + eventId); | 425 | LogUtils.info('StateManager:', 'notify ab flag ' + isABInstall + ',eventId:' + eventId); |
| 458 | if (eventId == update.EventId.EVENT_DOWNLOAD_SUCCESS && isABInstall) { | 426 | if (eventId == update.EventId.EVENT_DOWNLOAD_SUCCESS && isABInstall) { |
| @@ -470,7 +438,7 @@ export class DownloadSuccess extends BaseState { | |||
| 470 | } | 438 | } |
| 471 | 439 | ||
| 472 | if (this.otaStatus?.endReason) { | 440 | if (this.otaStatus?.endReason) { |
| 473 | - switch (this.otaStatus.endReason) { | 441 | + switch (Number(this.otaStatus.endReason)) { |
| 474 | case ErrorCode.NO_ENOUGH_MEMORY: | 442 | case ErrorCode.NO_ENOUGH_MEMORY: |
| 475 | DialogUtils.showUpgradeNotEnoughSpaceDialog(context, this.otaStatus, eventId); | 443 | DialogUtils.showUpgradeNotEnoughSpaceDialog(context, this.otaStatus, eventId); |
| 476 | break; | 444 | break; |
| @@ -512,7 +480,7 @@ export class Installing extends BaseState { | |||
| 512 | } | 480 | } |
| 513 | } | 481 | } |
| 514 | 482 | ||
| 515 | - async notify(context?: common.Context): Promise<void> { | 483 | + async notify(context: common.Context): Promise<void> { |
| 516 | if (this.percent == 100) { | 484 | if (this.percent == 100) { |
| 517 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 485 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 518 | return; | 486 | return; |
| @@ -542,7 +510,7 @@ export class InstallSuccess extends BaseState { | |||
| 542 | this.buttonClickAction = UpdateAction.REBOOT; | 510 | this.buttonClickAction = UpdateAction.REBOOT; |
| 543 | } | 511 | } |
| 544 | 512 | ||
| 545 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | 513 | + async notify(context: common.Context, eventId?: update.EventId): Promise<void> { |
| 546 | if (eventId == update.EventId.EVENT_APPLY_WAIT) { | 514 | if (eventId == update.EventId.EVENT_APPLY_WAIT) { |
| 547 | LogUtils.info('StateManager', 'ab install complete to count down'); | 515 | LogUtils.info('StateManager', 'ab install complete to count down'); |
| 548 | if (!VersionUtils.isInNewVersionPage()) { | 516 | if (!VersionUtils.isInNewVersionPage()) { |
| @@ -569,14 +537,14 @@ export class InstallFailed extends BaseState { | |||
| 569 | this.isButtonClickable = false; | 537 | this.isButtonClickable = false; |
| 570 | } | 538 | } |
| 571 | 539 | ||
| 572 | - async notify(context?: common.Context): Promise<void> { | 540 | + async notify(context: common.Context): Promise<void> { |
| 573 | AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); | 541 | AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); |
| 574 | await UpgradeAdapter.getInstance().getNotifyInstance()?.isServiceReady(); | 542 | await UpgradeAdapter.getInstance().getNotifyInstance()?.isServiceReady(); |
| 575 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 543 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 576 | if (VersionUtils.isInNewVersionPage()) { | 544 | if (VersionUtils.isInNewVersionPage()) { |
| 577 | DialogUtils.showUpgradeFailDialog(context, this.otaStatus); | 545 | DialogUtils.showUpgradeFailDialog(context, this.otaStatus); |
| 578 | } else { | 546 | } else { |
| 579 | - let versionName = globalThis.lastVersionName; | 547 | + let versionName: string = globalThis.lastVersionName as string; |
| 580 | LogUtils.log('StateManager', 'InstallFailed versionName is ' + versionName); | 548 | LogUtils.log('StateManager', 'InstallFailed versionName is ' + versionName); |
| 581 | await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeFailed(versionName, context); | 549 | await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeFailed(versionName, context); |
| 582 | } | 550 | } |
| @@ -621,13 +589,13 @@ export class UpgradeSuccess extends BaseState { | |||
| 621 | this.isButtonClickable = false; | 589 | this.isButtonClickable = false; |
| 622 | } | 590 | } |
| 623 | 591 | ||
| 624 | - async notify(context?: common.Context, eventId?: update.EventId): Promise<void> { | 592 | + async notify(context: common.Context, eventId?: update.EventId): Promise<void> { |
| 625 | if (eventId == update.EventId.EVENT_UPGRADE_SUCCESS) { | 593 | if (eventId == update.EventId.EVENT_UPGRADE_SUCCESS) { |
| 626 | LogUtils.info('StateManager', 'Upgrade success'); | 594 | LogUtils.info('StateManager', 'Upgrade success'); |
| 627 | AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); | 595 | AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); |
| 628 | await UpgradeAdapter.getInstance().getNotifyInstance()?.isServiceReady(); | 596 | await UpgradeAdapter.getInstance().getNotifyInstance()?.isServiceReady(); |
| 629 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); | 597 | await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); |
| 630 | - let versionName = globalThis.lastVersionName; | 598 | + let versionName: string = globalThis.lastVersionName as string; |
| 631 | LogUtils.info('StateManager', 'UpgradeSuccess versionName is ' + versionName); | 599 | LogUtils.info('StateManager', 'UpgradeSuccess versionName is ' + versionName); |
| 632 | await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeSuccess(versionName, context); | 600 | await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeSuccess(versionName, context); |
| 633 | } else { | 601 | } else { |
| @@ -16,7 +16,7 @@ | |||
| 16 | import notification from '@ohos.notificationManager'; | 16 | import notification from '@ohos.notificationManager'; |
| 17 | import wantAgent from '@ohos.app.ability.wantAgent'; | 17 | import wantAgent from '@ohos.app.ability.wantAgent'; |
| 18 | import type common from '@ohos.app.ability.common'; | 18 | import type common from '@ohos.app.ability.common'; |
| 19 | -import { Action, PACKAGE_NAME } from '@ohos/common/src/main/ets/const/update_const'; | 19 | +import { BusinessError, Action, PACKAGE_NAME } from '@ohos/common/src/main/ets/const/update_const'; |
| 20 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 20 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 21 | import { INotify } from '@ohos/common/src/main/ets/manager/UpgradeInterface'; | 21 | import { INotify } from '@ohos/common/src/main/ets/manager/UpgradeInterface'; |
| 22 | 22 | ||
| @@ -29,13 +29,13 @@ export class NotificationHelper implements INotify { | |||
| 29 | /** | 29 | /** |
| 30 | * 跳转信息--跳转到搜包页面 | 30 | * 跳转信息--跳转到搜包页面 |
| 31 | */ | 31 | */ |
| 32 | - private checkWantAgentInfo = { | 32 | + private checkWantAgentInfo: wantAgent.WantAgentInfo = { |
| 33 | wants: [{ | 33 | wants: [{ |
| 34 | bundleName: PACKAGE_NAME, | 34 | bundleName: PACKAGE_NAME, |
| 35 | abilityName: 'ServiceExtAbility', | 35 | abilityName: 'ServiceExtAbility', |
| 36 | action: Action.NOTIFICATION_CHECK | 36 | action: Action.NOTIFICATION_CHECK |
| 37 | }], | 37 | }], |
| 38 | - operationType: wantAgent.OperationType.START_ABILITY, | 38 | + actionType: wantAgent.OperationType.START_ABILITY, |
| 39 | requestCode: 0, | 39 | requestCode: 0, |
| 40 | wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], | 40 | wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], |
| 41 | }; | 41 | }; |
| @@ -43,13 +43,13 @@ export class NotificationHelper implements INotify { | |||
| 43 | /** | 43 | /** |
| 44 | * 跳转信息--下载中拉起界面 | 44 | * 跳转信息--下载中拉起界面 |
| 45 | */ | 45 | */ |
| 46 | - private downloadingWantAgentInfo = { | 46 | + private downloadingWantAgentInfo: wantAgent.WantAgentInfo = { |
| 47 | wants: [{ | 47 | wants: [{ |
| 48 | bundleName: PACKAGE_NAME, | 48 | bundleName: PACKAGE_NAME, |
| 49 | abilityName: 'ServiceExtAbility', | 49 | abilityName: 'ServiceExtAbility', |
| 50 | action: Action.NOTIFICATION_DETAIL | 50 | action: Action.NOTIFICATION_DETAIL |
| 51 | }], | 51 | }], |
| 52 | - operationType: wantAgent.OperationType.START_ABILITY, | 52 | + actionType: wantAgent.OperationType.START_ABILITY, |
| 53 | requestCode: 0, | 53 | requestCode: 0, |
| 54 | wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], | 54 | wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], |
| 55 | }; | 55 | }; |
| @@ -61,10 +61,10 @@ export class NotificationHelper implements INotify { | |||
| 61 | * @param progress 进度 | 61 | * @param progress 进度 |
| 62 | * @param context 上下文 | 62 | * @param context 上下文 |
| 63 | */ | 63 | */ |
| 64 | - async showDownloading(version, progress, context): Promise<void> { | 64 | + async showDownloading(version: string, progress: number, context: common.Context): Promise<void> { |
| 65 | let templateName: string = 'downloadTemplate'; | 65 | let templateName: string = 'downloadTemplate'; |
| 66 | if (!globalThis.isSupportTemplate) { | 66 | if (!globalThis.isSupportTemplate) { |
| 67 | - globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch(err => { | 67 | + globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch((err: BusinessError) => { |
| 68 | this.logError('showDownloading isSupportTemplate failed because ' + JSON.stringify(err)); | 68 | this.logError('showDownloading isSupportTemplate failed because ' + JSON.stringify(err)); |
| 69 | return false; | 69 | return false; |
| 70 | }); | 70 | }); |
| @@ -73,9 +73,9 @@ export class NotificationHelper implements INotify { | |||
| 73 | this.logError('showDownloading is not supportTemplate'); | 73 | this.logError('showDownloading is not supportTemplate'); |
| 74 | return; | 74 | return; |
| 75 | } | 75 | } |
| 76 | - var notificationRequest = { | 76 | + let notificationRequest: notification.NotificationRequest = { |
| 77 | content: { | 77 | content: { |
| 78 | - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, | 78 | + notificationContentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, |
| 79 | normal: { | 79 | normal: { |
| 80 | title: await context.resourceManager.getString($r('app.string.software_update').id), | 80 | title: await context.resourceManager.getString($r('app.string.software_update').id), |
| 81 | text: await context.resourceManager.getString($r('app.string.software_download_progress').id) | 81 | text: await context.resourceManager.getString($r('app.string.software_download_progress').id) |
| @@ -92,10 +92,12 @@ export class NotificationHelper implements INotify { | |||
| 92 | wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), | 92 | wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), |
| 93 | id: 5, | 93 | id: 5, |
| 94 | label: '111', | 94 | label: '111', |
| 95 | - slotType: notification.SlotType.SERVICE_INFORMATION, | 95 | + notificationSlotType: notification.SlotType.SERVICE_INFORMATION, |
| 96 | deliveryTime: new Date().getTime() | 96 | deliveryTime: new Date().getTime() |
| 97 | } | 97 | } |
| 98 | - await notification.publish(notificationRequest).catch((err) => { | 98 | + await notification.publish(notificationRequest).then(() => { |
| 99 | + this.logInfo(`showDownloading publish promise success.`); | ||
| 100 | + }).catch((err: BusinessError) => { | ||
| 99 | this.logError('showDownloading notification publish failed because ' + JSON.stringify(err)); | 101 | this.logError('showDownloading notification publish failed because ' + JSON.stringify(err)); |
| 100 | }); | 102 | }); |
| 101 | } | 103 | } |
| @@ -107,10 +109,10 @@ export class NotificationHelper implements INotify { | |||
| 107 | * @param progress 进度 | 109 | * @param progress 进度 |
| 108 | * @param context 上下文 | 110 | * @param context 上下文 |
| 109 | */ | 111 | */ |
| 110 | - async showInstalling(version, progress, context): Promise<void> { | 112 | + async showInstalling(version: string, progress: number, context: common.Context): Promise<void> { |
| 111 | let templateName: string = 'installTemplate'; | 113 | let templateName: string = 'installTemplate'; |
| 112 | if (!globalThis.isSupportTemplate) { | 114 | if (!globalThis.isSupportTemplate) { |
| 113 | - globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch(err => { | 115 | + globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch((err: BusinessError) => { |
| 114 | this.logError('showInstalling isSupportTemplate failed because ' + JSON.stringify(err)); | 116 | this.logError('showInstalling isSupportTemplate failed because ' + JSON.stringify(err)); |
| 115 | return false; | 117 | return false; |
| 116 | }); | 118 | }); |
| @@ -119,9 +121,9 @@ export class NotificationHelper implements INotify { | |||
| 119 | this.logError('showInstalling is not supportTemplate'); | 121 | this.logError('showInstalling is not supportTemplate'); |
| 120 | return; | 122 | return; |
| 121 | } | 123 | } |
| 122 | - var notificationRequest = { | 124 | + let notificationRequest: notification.NotificationRequest = { |
| 123 | content: { | 125 | content: { |
| 124 | - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, | 126 | + notificationContentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, |
| 125 | normal: { | 127 | normal: { |
| 126 | title: await context.resourceManager.getString($r('app.string.software_update').id), | 128 | title: await context.resourceManager.getString($r('app.string.software_update').id), |
| 127 | text: await context.resourceManager.getString($r('app.string.software_install_progress').id) | 129 | text: await context.resourceManager.getString($r('app.string.software_install_progress').id) |
| @@ -138,10 +140,10 @@ export class NotificationHelper implements INotify { | |||
| 138 | wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), | 140 | wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), |
| 139 | id: 5, | 141 | id: 5, |
| 140 | label: '111', | 142 | label: '111', |
| 141 | - slotType: notification.SlotType.SERVICE_INFORMATION, | 143 | + notificationSlotType: notification.SlotType.SERVICE_INFORMATION, |
| 142 | deliveryTime: new Date().getTime() | 144 | deliveryTime: new Date().getTime() |
| 143 | } | 145 | } |
| 144 | - await notification.publish(notificationRequest).catch((err) => { | 146 | + await notification.publish(notificationRequest).catch((err: BusinessError) => { |
| 145 | this.logError('showInstalling publish failed because ' + JSON.stringify(err)); | 147 | this.logError('showInstalling publish failed because ' + JSON.stringify(err)); |
| 146 | }); | 148 | }); |
| 147 | } | 149 | } |
| @@ -152,9 +154,9 @@ export class NotificationHelper implements INotify { | |||
| 152 | * @param context 实上下文 | 154 | * @param context 实上下文 |
| 153 | */ | 155 | */ |
| 154 | async showUpgradeFailed(versionName: string, context: common.Context): Promise<void> { | 156 | async showUpgradeFailed(versionName: string, context: common.Context): Promise<void> { |
| 155 | - let request = { | 157 | + let request: notification.NotificationRequest = { |
| 156 | content: { | 158 | content: { |
| 157 | - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, | 159 | + notificationContentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, |
| 158 | normal: { | 160 | normal: { |
| 159 | title: await context.resourceManager.getString($r('app.string.install_fail_message').id), | 161 | title: await context.resourceManager.getString($r('app.string.install_fail_message').id), |
| 160 | text: versionName | 162 | text: versionName |
| @@ -162,11 +164,11 @@ export class NotificationHelper implements INotify { | |||
| 162 | }, | 164 | }, |
| 163 | wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), | 165 | wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), |
| 164 | id: 3, | 166 | id: 3, |
| 165 | - slotType: notification.SlotType.SERVICE_INFORMATION | 167 | + notificationSlotType: notification.SlotType.SERVICE_INFORMATION |
| 166 | } | 168 | } |
| 167 | await notification.publish(request).then(() => { | 169 | await notification.publish(request).then(() => { |
| 168 | this.logInfo('showUpgradeFailed publish promise success.'); | 170 | this.logInfo('showUpgradeFailed publish promise success.'); |
| 169 | - }).catch((err) => { | 171 | + }).catch((err: BusinessError) => { |
| 170 | this.logError('showUpgradeFailed publish promise failed because ' + JSON.stringify(err)); | 172 | this.logError('showUpgradeFailed publish promise failed because ' + JSON.stringify(err)); |
| 171 | }); | 173 | }); |
| 172 | } | 174 | } |
| @@ -177,9 +179,9 @@ export class NotificationHelper implements INotify { | |||
| 177 | * @param context 实上下文 | 179 | * @param context 实上下文 |
| 178 | */ | 180 | */ |
| 179 | async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { | 181 | async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { |
| 180 | - let request = { | 182 | + let request: notification.NotificationRequest = { |
| 181 | content: { | 183 | content: { |
| 182 | - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, | 184 | + notificationContentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, |
| 183 | normal: { | 185 | normal: { |
| 184 | title: await context.resourceManager.getString($r('app.string.install_success_message').id), | 186 | title: await context.resourceManager.getString($r('app.string.install_success_message').id), |
| 185 | text: versionName | 187 | text: versionName |
| @@ -187,11 +189,11 @@ export class NotificationHelper implements INotify { | |||
| 187 | }, | 189 | }, |
| 188 | wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), | 190 | wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), |
| 189 | id: 4, | 191 | id: 4, |
| 190 | - slotType: notification.SlotType.SERVICE_INFORMATION | 192 | + notificationSlotType: notification.SlotType.SERVICE_INFORMATION |
| 191 | } | 193 | } |
| 192 | await notification.publish(request).then(() => { | 194 | await notification.publish(request).then(() => { |
| 193 | this.logInfo('showUpgradeSuccess publish promise success.'); | 195 | this.logInfo('showUpgradeSuccess publish promise success.'); |
| 194 | - }).catch((err) => { | 196 | + }).catch((err: BusinessError) => { |
| 195 | this.logError('showUpgradeSuccess publish promise failed because ' + JSON.stringify(err)); | 197 | this.logError('showUpgradeSuccess publish promise failed because ' + JSON.stringify(err)); |
| 196 | }); | 198 | }); |
| 197 | } | 199 | } |
Rfeature/ota/src/main/ets/notify/NotificationManager.ts→feature/ota/src/main/ets/notify/NotificationManager.ets+9-8
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | import type common from '@ohos.app.ability.common'; | 16 | import type common from '@ohos.app.ability.common'; |
| 17 | +import { StartOptions } from '@kit.AbilityKit'; | ||
| 17 | import { | 18 | import { |
| 18 | Action, | 19 | Action, |
| 19 | PACKAGE_NAME, | 20 | PACKAGE_NAME, |
| @@ -42,10 +43,10 @@ export class NotificationManager { | |||
| 42 | static async handleAction(action: string, context: common.Context): Promise<boolean> { | 43 | static async handleAction(action: string, context: common.Context): Promise<boolean> { |
| 43 | switch (action) { | 44 | switch (action) { |
| 44 | case Action.NOTIFICATION_CHECK: | 45 | case Action.NOTIFICATION_CHECK: |
| 45 | - this.handleCheckAction(context); | 46 | + NotificationManager.handleCheckAction(context); |
| 46 | return true; | 47 | return true; |
| 47 | case Action.NOTIFICATION_DETAIL: | 48 | case Action.NOTIFICATION_DETAIL: |
| 48 | - await this.handleDetailAction(context); | 49 | + await NotificationManager.handleDetailAction(context); |
| 49 | return true; | 50 | return true; |
| 50 | default: | 51 | default: |
| 51 | return false; | 52 | return false; |
| @@ -54,31 +55,31 @@ export class NotificationManager { | |||
| 54 | 55 | ||
| 55 | private static handleCheckAction(context: common.Context): void { | 56 | private static handleCheckAction(context: common.Context): void { |
| 56 | LogUtils.log(TAG, 'handleCheckAction'); | 57 | LogUtils.log(TAG, 'handleCheckAction'); |
| 57 | - this.startAbility('pages/index', context); | 58 | + NotificationManager.startAbility('pages/index', context); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | private static async handleDetailAction(context: common.Context): Promise<void> { | 61 | private static async handleDetailAction(context: common.Context): Promise<void> { |
| 61 | LogUtils.log(TAG, 'handleDetailAction'); | 62 | LogUtils.log(TAG, 'handleDetailAction'); |
| 62 | if (await RouterUtils.isCanToNewVersion()) { | 63 | if (await RouterUtils.isCanToNewVersion()) { |
| 63 | - this.startAbility('pages/newVersion', context); | 64 | + NotificationManager.startAbility('pages/newVersion', context); |
| 64 | } else { | 65 | } else { |
| 65 | - this.startAbility('pages/index', context); | 66 | + NotificationManager.startAbility('pages/index', context); |
| 66 | } | 67 | } |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | public static async startToNewVersion(context: common.Context): Promise<void> { | 70 | public static async startToNewVersion(context: common.Context): Promise<void> { |
| 70 | if (await RouterUtils.isCanToNewVersion()) { | 71 | if (await RouterUtils.isCanToNewVersion()) { |
| 71 | - this.startAbility('pages/newVersion', context); | 72 | + NotificationManager.startAbility('pages/newVersion', context); |
| 72 | } | 73 | } |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | private static startAbility(uri: string, context: common.Context): void { | 76 | private static startAbility(uri: string, context: common.Context): void { |
| 76 | - let want = { | 77 | + let want: Want = { |
| 77 | bundleName: PACKAGE_NAME, | 78 | bundleName: PACKAGE_NAME, |
| 78 | abilityName: MAIN_ABILITY_NAME, | 79 | abilityName: MAIN_ABILITY_NAME, |
| 79 | uri: uri | 80 | uri: uri |
| 80 | }; | 81 | }; |
| 81 | - let options = { | 82 | + let options: StartOptions = { |
| 82 | windowMode: 0, | 83 | windowMode: 0, |
| 83 | displayId: 2 | 84 | displayId: 2 |
| 84 | }; | 85 | }; |
| @@ -16,6 +16,35 @@ | |||
| 16 | import convertXml from '@ohos.convertxml'; | 16 | import convertXml from '@ohos.convertxml'; |
| 17 | import type { Features, Language, Feature, Changelog, Icon } from '@ohos/common/src/main/ets/const/update_const'; | 17 | import type { Features, Language, Feature, Changelog, Icon } from '@ohos/common/src/main/ets/const/update_const'; |
| 18 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 18 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 19 | +import { CommonUtils } from '@ohos/common/src/main/ets/util/CommonUtils'; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * xml 元素 | ||
| 23 | + * | ||
| 24 | + * @since 2025-06-09 | ||
| 25 | + */ | ||
| 26 | +interface XmlElement { | ||
| 27 | + _elements?: XmlElement[]; | ||
| 28 | + _name?: string; | ||
| 29 | + _type?: string; | ||
| 30 | + _text?: string; | ||
| 31 | + _attributes?: XmlAttributes | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +/** | ||
| 35 | + * xml 元素属性 | ||
| 36 | + * | ||
| 37 | + * @since 2025-06-09 | ||
| 38 | + */ | ||
| 39 | +interface XmlAttributes { | ||
| 40 | + name?: string; | ||
| 41 | + id?:string; | ||
| 42 | + pkg?: string; | ||
| 43 | + res?: string; | ||
| 44 | + module?: string; | ||
| 45 | + type?: string; | ||
| 46 | + title?: string; | ||
| 47 | +} | ||
| 19 | 48 | ||
| 20 | let conv = new convertXml.ConvertXML(); | 49 | let conv = new convertXml.ConvertXML(); |
| 21 | 50 | ||
| @@ -48,24 +77,24 @@ namespace ChangelogParseUtils { | |||
| 48 | * @param res 待解析的string | 77 | * @param res 待解析的string |
| 49 | * @param callback 解析结果回调 | 78 | * @param callback 解析结果回调 |
| 50 | */ | 79 | */ |
| 51 | - export function parseXml(res: string, callback: (data: Changelog) => void): void { | 80 | + export function parseXml(res: string, callback: (data?: Changelog) => void): void { |
| 52 | logInfo('read file parse start'); | 81 | logInfo('read file parse start'); |
| 53 | changelog = { language: new Map() }; | 82 | changelog = { language: new Map() }; |
| 54 | if (!res) { | 83 | if (!res) { |
| 55 | logError('res is null!'); | 84 | logError('res is null!'); |
| 56 | - callback(null); | 85 | + callback(); |
| 57 | return; | 86 | return; |
| 58 | } | 87 | } |
| 59 | - let xmlResult: Object = conv.convert(res, options); | 88 | + let xmlResult: XmlElement = conv.convert(res, options) as XmlElement; |
| 60 | - if (!xmlResult || !xmlResult['_elements'] || xmlResult['_elements'].length <= 0) { | 89 | + if (!xmlResult || !xmlResult._elements || xmlResult._elements.length <= 0) { |
| 61 | logError('xmlResult is null! ' + JSON.stringify(xmlResult)); | 90 | logError('xmlResult is null! ' + JSON.stringify(xmlResult)); |
| 62 | - callback(null); | 91 | + callback(); |
| 63 | return; | 92 | return; |
| 64 | } | 93 | } |
| 65 | - let root = xmlResult['_elements'][0]; | 94 | + let root: XmlElement | undefined = xmlResult._elements[0]; |
| 66 | - if (!root || !root['_elements'] || root['_elements'].length <= 0) { | 95 | + if (!root || !root._elements || root._elements.length <= 0) { |
| 67 | logError('root is null! ' + JSON.stringify(root)); | 96 | logError('root is null! ' + JSON.stringify(root)); |
| 68 | - callback(null); | 97 | + callback(); |
| 69 | return; | 98 | return; |
| 70 | } | 99 | } |
| 71 | parseRoot(root); | 100 | parseRoot(root); |
| @@ -73,44 +102,47 @@ namespace ChangelogParseUtils { | |||
| 73 | callback(changelog); | 102 | callback(changelog); |
| 74 | } | 103 | } |
| 75 | 104 | ||
| 76 | - function parseRoot(root: any): void { | 105 | + function parseRoot(root: XmlElement): void { |
| 77 | // 倒序解析,先解析Icon | 106 | // 倒序解析,先解析Icon |
| 78 | - let icons = {}; | 107 | + let icons: Map<string, Icon> = new Map(); |
| 79 | - logInfo('root length ' + root['_elements'].length); | 108 | + if (root?._elements === undefined) { |
| 80 | - for (let index = root['_elements'].length; index > 0; index--) { | 109 | + return; |
| 81 | - let element = root['_elements'][index - 1]; | 110 | + } |
| 111 | + logInfo('root length ' + root?._elements?.length); | ||
| 112 | + for (let index = root?._elements?.length; index > 0; index--) { | ||
| 113 | + let element = root?._elements[index - 1]; | ||
| 82 | if (!element) { | 114 | if (!element) { |
| 83 | logError('element is null! ' + JSON.stringify(element)); | 115 | logError('element is null! ' + JSON.stringify(element)); |
| 84 | continue; | 116 | continue; |
| 85 | } | 117 | } |
| 86 | - if (element['_type'] === 'element' && element['_name'] === 'default-language') { | 118 | + if (element._type === 'element' && element._name === 'default-language') { |
| 87 | - let attribute = element['_attributes']['name']; | 119 | + let attribute = element._attributes?.name; |
| 88 | logInfo('default-language :' + attribute); | 120 | logInfo('default-language :' + attribute); |
| 89 | changelog.defLanguage = attribute; | 121 | changelog.defLanguage = attribute; |
| 90 | } | 122 | } |
| 91 | - if (element['_type'] === 'element' && element['_name'] === 'displayType') { | 123 | + if (element._type === 'element' && element._name === 'displayType') { |
| 92 | - let attribute = element['_elements']?.[0]?.['_text']; | 124 | + let attribute = Number(element._elements?.[0]?._text); |
| 93 | logInfo('displayType :' + attribute); | 125 | logInfo('displayType :' + attribute); |
| 94 | changelog.displayType = attribute; | 126 | changelog.displayType = attribute; |
| 95 | } | 127 | } |
| 96 | - if (element['_type'] === 'element' && element['_name'] === 'icons') { | 128 | + if (element._type === 'element' && element._name === 'icons') { |
| 97 | - let iconsElement = element['_elements']; | 129 | + let iconsElement = element._elements ?? []; |
| 98 | parseIcons(iconsElement, icons); | 130 | parseIcons(iconsElement, icons); |
| 99 | } | 131 | } |
| 100 | parseLanguage(element, icons); | 132 | parseLanguage(element, icons); |
| 101 | } | 133 | } |
| 102 | } | 134 | } |
| 103 | 135 | ||
| 104 | - function parseLanguage(element: any, icons: Object): void { | 136 | + function parseLanguage(element: XmlElement, icons: Map<string, Icon>): void { |
| 105 | let language: Language = { featuresArray: [] }; | 137 | let language: Language = { featuresArray: [] }; |
| 106 | - if (element['_type'] === 'element' && element['_name'] === 'language') { | 138 | + if (element._type === 'element' && element._name === 'language') { |
| 107 | let attribute: string; | 139 | let attribute: string; |
| 108 | - if (!element['_attributes']) { | 140 | + if (!element._attributes) { |
| 109 | - logError('language is null :' + JSON.stringify(element['_attributes'])); | 141 | + logError('language is null :' + JSON.stringify(element._attributes)); |
| 110 | return; | 142 | return; |
| 111 | } | 143 | } |
| 112 | - attribute = element['_attributes']['name']; | 144 | + attribute = element._attributes.name ?? ''; |
| 113 | - let languageElement = element['_elements']; | 145 | + let languageElement = element._elements; |
| 114 | language.language = attribute; | 146 | language.language = attribute; |
| 115 | changelog.language.set(language.language, language); | 147 | changelog.language.set(language.language, language); |
| 116 | 148 | ||
| @@ -122,7 +154,11 @@ namespace ChangelogParseUtils { | |||
| 122 | } | 154 | } |
| 123 | } | 155 | } |
| 124 | 156 | ||
| 125 | - function parseIcons(iconsElement: any, icons: Object): void { | 157 | + function parseIcons(iconsElement: XmlElement[], icons: Map<string, Icon>): void { |
| 158 | + if (CommonUtils.isEmpty(iconsElement)) { | ||
| 159 | + logError(`iconsElement is null${JSON.stringify(iconsElement)}`); | ||
| 160 | + return; | ||
| 161 | + } | ||
| 126 | let icon: Icon; | 162 | let icon: Icon; |
| 127 | for (let index = 0; index < iconsElement.length; index++) { | 163 | for (let index = 0; index < iconsElement.length; index++) { |
| 128 | let iconElement = iconsElement[index]; | 164 | let iconElement = iconsElement[index]; |
| @@ -130,18 +166,20 @@ namespace ChangelogParseUtils { | |||
| 130 | logError('iconElement is null :' + JSON.stringify(iconElement)); | 166 | logError('iconElement is null :' + JSON.stringify(iconElement)); |
| 131 | continue; | 167 | continue; |
| 132 | } | 168 | } |
| 133 | - if (iconElement['_type'] === 'element' && iconElement['_name'] === 'icon') { | 169 | + if (iconElement._type === 'element' && iconElement._name === 'icon') { |
| 134 | icon = { | 170 | icon = { |
| 135 | - id: iconElement['_attributes']['id'], | 171 | + id: iconElement?._attributes?.id, |
| 136 | - pkg: iconElement['_attributes']['pkg'], | 172 | + pkg: iconElement?._attributes?.pkg, |
| 137 | - res: iconElement['_attributes']['res'], | 173 | + res: iconElement?._attributes?.res, |
| 138 | }; | 174 | }; |
| 139 | - icons[icon.id] = icon; | 175 | + if (icon?.id !== null && icon.id !== undefined) { |
| 176 | + icons.set(icon?.id, icon); | ||
| 177 | + } | ||
| 140 | } | 178 | } |
| 141 | } | 179 | } |
| 142 | } | 180 | } |
| 143 | 181 | ||
| 144 | - function parseFeatures(languageElement: any, language: Language, icons: Object): void { | 182 | + function parseFeatures(languageElement: XmlElement[], language: Language, icons: Map<string, Icon>): void { |
| 145 | let features: Features; | 183 | let features: Features; |
| 146 | for (let index = 0; index < languageElement.length; index++) { | 184 | for (let index = 0; index < languageElement.length; index++) { |
| 147 | let featuresElement = languageElement[index]; | 185 | let featuresElement = languageElement[index]; |
| @@ -150,19 +188,21 @@ namespace ChangelogParseUtils { | |||
| 150 | continue; | 188 | continue; |
| 151 | } | 189 | } |
| 152 | 190 | ||
| 153 | - if (featuresElement['_type'] === 'element' && featuresElement['_name'] === 'features') { | 191 | + if (featuresElement._type === 'element' && featuresElement._name === 'features') { |
| 154 | - let moduleString = featuresElement['_attributes']['module']; | 192 | + let moduleString = featuresElement._attributes?.module; |
| 155 | - let typeString = featuresElement['_attributes']['type']; | 193 | + let typeString = featuresElement._attributes?.type; |
| 156 | - let id = featuresElement['_attributes']['id']; | 194 | + let id = featuresElement?._attributes?.id; |
| 157 | - let featureElement = featuresElement['_elements']; | 195 | + let featureElement = featuresElement._elements; |
| 158 | let featureList: Feature[] = []; | 196 | let featureList: Feature[] = []; |
| 159 | features = { | 197 | features = { |
| 160 | title: moduleString, | 198 | title: moduleString, |
| 161 | id: id, | 199 | id: id, |
| 162 | featureModuleType: typeString, | 200 | featureModuleType: typeString, |
| 163 | featureList: featureList, | 201 | featureList: featureList, |
| 164 | - icon: icons[id], | ||
| 165 | }; | 202 | }; |
| 203 | + if (id !== null && id !== undefined) { | ||
| 204 | + features.icon = icons.get(id) | ||
| 205 | + } | ||
| 166 | language.featuresArray.push(features); | 206 | language.featuresArray.push(features); |
| 167 | 207 | ||
| 168 | if (!featureElement || featureElement.length <= 0) { | 208 | if (!featureElement || featureElement.length <= 0) { |
| @@ -174,11 +214,11 @@ namespace ChangelogParseUtils { | |||
| 174 | } | 214 | } |
| 175 | } | 215 | } |
| 176 | 216 | ||
| 177 | - function parseFeature(featureElement: any, featureList: Array<Feature>): void { | 217 | + function parseFeature(featureElement: XmlElement[], featureList: Array<Feature>): void { |
| 178 | - let feature: Feature; | 218 | + let feature: Feature | null = null; |
| 179 | for (let index = 0; index < featureElement.length; index++) { | 219 | for (let index = 0; index < featureElement.length; index++) { |
| 180 | let featureItem = featureElement[index]; | 220 | let featureItem = featureElement[index]; |
| 181 | - if (featureItem['_type'] !== 'element' || featureItem['_name'] !== 'feature') { | 221 | + if (featureItem._type !== 'element' || featureItem._name !== 'feature') { |
| 182 | continue; | 222 | continue; |
| 183 | } | 223 | } |
| 184 | if (!featureItem) { | 224 | if (!featureItem) { |
| @@ -186,13 +226,13 @@ namespace ChangelogParseUtils { | |||
| 186 | continue; | 226 | continue; |
| 187 | } | 227 | } |
| 188 | 228 | ||
| 189 | - let title: string; | 229 | + let title: string | undefined; |
| 190 | - if (featureItem['_attributes']) { | 230 | + if (featureItem._attributes) { |
| 191 | - title = featureItem['_attributes']['title']; | 231 | + title = featureItem._attributes.title; |
| 192 | } | 232 | } |
| 193 | - let content: string; | 233 | + let content: string | undefined; |
| 194 | - if (featureItem['_elements']) { | 234 | + if (featureItem._elements) { |
| 195 | - content = featureItem['_elements'][0]['_text']; | 235 | + content = featureItem._elements[0]._text as string; |
| 196 | } | 236 | } |
| 197 | if (title) { | 237 | if (title) { |
| 198 | feature = { subTitle: title, contents: [] }; | 238 | feature = { subTitle: title, contents: [] }; |
| @@ -82,7 +82,8 @@ namespace RouterUtils { | |||
| 82 | if (upgradeData.data?.status === UpdateState.UPGRADING) { | 82 | if (upgradeData.data?.status === UpdateState.UPGRADING) { |
| 83 | resolve(false); | 83 | resolve(false); |
| 84 | } else { | 84 | } else { |
| 85 | - let isAllow: boolean = StateManager.isAllowExecute(upgradeData.data?.status, UpdateAction.SHOW_NEW_VERSION); | 85 | + let isAllow: boolean = StateManager.isAllowExecute(upgradeData.data?.status as number, |
| 86 | + UpdateAction.SHOW_NEW_VERSION); | ||
| 86 | resolve(isAllow); | 87 | resolve(isAllow); |
| 87 | } | 88 | } |
| 88 | } else { | 89 | } else { |
| @@ -52,7 +52,7 @@ export namespace VersionUtils { | |||
| 52 | * @return 新版本名称 | 52 | * @return 新版本名称 |
| 53 | */ | 53 | */ |
| 54 | export async function obtainNewVersionName(info: update.NewVersionInfo | update.TaskBody): Promise<string> { | 54 | export async function obtainNewVersionName(info: update.NewVersionInfo | update.TaskBody): Promise<string> { |
| 55 | - let component: update.VersionComponent = sortComponents(info?.versionComponents)?.[0]; | 55 | + let component: update.VersionComponent | undefined = sortComponents(info?.versionComponents)?.[0]; |
| 56 | return component?.displayVersion ?? ''; | 56 | return component?.displayVersion ?? ''; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -80,7 +80,7 @@ export namespace VersionUtils { | |||
| 80 | * @param components 升级包集合 | 80 | * @param components 升级包集合 |
| 81 | * @return 升级包集合 | 81 | * @return 升级包集合 |
| 82 | */ | 82 | */ |
| 83 | - export function sortComponents(components: Array<update.VersionComponent>): Array<update.VersionComponent> { | 83 | + export function sortComponents(components: Array<update.VersionComponent>): Array<update.VersionComponent> | null { |
| 84 | if (components) { | 84 | if (components) { |
| 85 | return components.sort((component: update.VersionComponent, nextComponent: update.VersionComponent) => { | 85 | return components.sort((component: update.VersionComponent, nextComponent: update.VersionComponent) => { |
| 86 | return component.componentType - nextComponent.componentType; | 86 | return component.componentType - nextComponent.componentType; |
| @@ -118,13 +118,14 @@ export namespace VersionUtils { | |||
| 118 | * @return 是否是AB升级 | 118 | * @return 是否是AB升级 |
| 119 | */ | 119 | */ |
| 120 | export async function isABInstall(): Promise<boolean> { | 120 | export async function isABInstall(): Promise<boolean> { |
| 121 | - let newVersionInfo = globalThis.cachedNewVersionInfo || await OtaUpdateManager.getInstance().getNewVersion() | 121 | + let newVersionInfo: update.NewVersionInfo = globalThis.cachedNewVersionInfo || |
| 122 | + await OtaUpdateManager.getInstance().getNewVersion() | ||
| 122 | .then(upgradeData => { | 123 | .then(upgradeData => { |
| 123 | - this.log(`isABInstall upgradeData: ${upgradeData}`); | 124 | + LogUtils.info(TAG, `isABInstall upgradeData: ${upgradeData}`); |
| 124 | return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; | 125 | return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; |
| 125 | }); | 126 | }); |
| 126 | - let components: update.VersionComponent[] = VersionUtils.sortComponents(newVersionInfo?.versionComponents); | 127 | + let components: update.VersionComponent[] | null = VersionUtils.sortComponents(newVersionInfo?.versionComponents); |
| 127 | - let component: update.VersionComponent = components?.filter((component: update.VersionComponent) => { | 128 | + let component: update.VersionComponent | undefined = components?.filter((component: update.VersionComponent) => { |
| 128 | return component.componentType == update.ComponentType.OTA; | 129 | return component.componentType == update.ComponentType.OTA; |
| 129 | })?.[0]; | 130 | })?.[0]; |
| 130 | return component?.effectiveMode === update.EffectiveMode.LIVE_AND_COLD; | 131 | return component?.effectiveMode === update.EffectiveMode.LIVE_AND_COLD; |
| @@ -136,13 +137,14 @@ export namespace VersionUtils { | |||
| 136 | * @return 是否是AB升级 | 137 | * @return 是否是AB升级 |
| 137 | */ | 138 | */ |
| 138 | export async function isABStreamInstall(): Promise<boolean> { | 139 | export async function isABStreamInstall(): Promise<boolean> { |
| 139 | - let newVersionInfo = globalThis.cachedNewVersionInfo || await OtaUpdateManager.getInstance().getNewVersion() | 140 | + let newVersionInfo: update.NewVersionInfo = globalThis.cachedNewVersionInfo || |
| 141 | + await OtaUpdateManager.getInstance().getNewVersion() | ||
| 140 | .then(upgradeData => { | 142 | .then(upgradeData => { |
| 141 | - this.log(`isABInstall upgradeData: ${upgradeData}`); | 143 | + LogUtils.info(TAG, `isABInstall upgradeData: ${upgradeData}`); |
| 142 | return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; | 144 | return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; |
| 143 | }); | 145 | }); |
| 144 | - let components: update.VersionComponent[] = VersionUtils.sortComponents(newVersionInfo?.versionComponents); | 146 | + let components: update.VersionComponent[] | null = VersionUtils.sortComponents(newVersionInfo?.versionComponents); |
| 145 | - let component: update.VersionComponent = components?.filter((component: update.VersionComponent) => { | 147 | + let component: update.VersionComponent | undefined = components?.filter((component: update.VersionComponent) => { |
| 146 | return component.componentType == update.ComponentType.OTA; | 148 | return component.componentType == update.ComponentType.OTA; |
| 147 | })?.[0]; | 149 | })?.[0]; |
| 148 | return component?.otaMode === update.OtaMode.AB_STREAM_OTA; | 150 | return component?.otaMode === update.OtaMode.AB_STREAM_OTA; |
| @@ -12,10 +12,6 @@ | |||
| 12 | "name":"btn_upgrade", | 12 | "name":"btn_upgrade", |
| 13 | "value":"Install" | 13 | "value":"Install" |
| 14 | }, | 14 | }, |
| 15 | - { | ||
| 16 | - "name": "btn_pause", | ||
| 17 | - "value": "pause" | ||
| 18 | - }, | ||
| 19 | { | 15 | { |
| 20 | "name":"title_new_version", | 16 | "name":"title_new_version", |
| 21 | "value":"New version" | 17 | "value":"New version" |
| @@ -144,14 +140,6 @@ | |||
| 144 | "name":"install_success_message", | 140 | "name":"install_success_message", |
| 145 | "value":"Update successfully installed" | 141 | "value":"Update successfully installed" |
| 146 | }, | 142 | }, |
| 147 | - { | ||
| 148 | - "name":"install_pause_message", | ||
| 149 | - "value":"Update pause. Please try again." | ||
| 150 | - }, | ||
| 151 | - { | ||
| 152 | - "name":"install_pause", | ||
| 153 | - "value":"Update pause" | ||
| 154 | - }, | ||
| 155 | { | 143 | { |
| 156 | "name":"install_fail_message", | 144 | "name":"install_fail_message", |
| 157 | "value":"Installation failed" | 145 | "value":"Installation failed" |
| @@ -12,10 +12,6 @@ | |||
| 12 | "name":"btn_upgrade", | 12 | "name":"btn_upgrade", |
| 13 | "value":"安装" | 13 | "value":"安装" |
| 14 | }, | 14 | }, |
| 15 | - { | ||
| 16 | - "name": "btn_pause", | ||
| 17 | - "value": "暂停" | ||
| 18 | - }, | ||
| 19 | { | 15 | { |
| 20 | "name":"title_new_version", | 16 | "name":"title_new_version", |
| 21 | "value":"新版本" | 17 | "value":"新版本" |
| @@ -144,14 +140,6 @@ | |||
| 144 | "name":"install_success_message", | 140 | "name":"install_success_message", |
| 145 | "value":"新版本安装成功" | 141 | "value":"新版本安装成功" |
| 146 | }, | 142 | }, |
| 147 | - { | ||
| 148 | - "name":"install_pause_message", | ||
| 149 | - "value":"安装暂停,请重试" | ||
| 150 | - }, | ||
| 151 | - { | ||
| 152 | - "name":"install_pause", | ||
| 153 | - "value":"安装暂停" | ||
| 154 | - }, | ||
| 155 | { | 143 | { |
| 156 | "name":"install_fail_message", | 144 | "name":"install_fail_message", |
| 157 | "value":"新版本安装失败" | 145 | "value":"新版本安装失败" |
| @@ -0,0 +1,20 @@ | |||
| 1 | +{ | ||
| 2 | + "modelVersion": "5.0.2", | ||
| 3 | + "dependencies": {}, | ||
| 4 | + "execution": { | ||
| 5 | + // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */ | ||
| 6 | + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ | ||
| 7 | + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ | ||
| 8 | + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ | ||
| 9 | + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ | ||
| 10 | + }, | ||
| 11 | + "logging": { | ||
| 12 | + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ | ||
| 13 | + }, | ||
| 14 | + "debugging": { | ||
| 15 | + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ | ||
| 16 | + }, | ||
| 17 | + "nodeOptions": { | ||
| 18 | + // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */ | ||
| 19 | + } | ||
| 20 | +} | ||
| @@ -1,2 +0,0 @@ | |||
| 1 | -// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. | ||
| 2 | -module.exports = require('@ohos/hvigor-ohos-plugin').appTasks; | ||
| @@ -0,0 +1,10 @@ | |||
| 1 | +{ | ||
| 2 | + "meta": { | ||
| 3 | + "stableOrder": true, | ||
| 4 | + "enableUnifiedLockfile": false | ||
| 5 | + }, | ||
| 6 | + "lockfileVersion": 3, | ||
| 7 | + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||
| 8 | + "specifiers": {}, | ||
| 9 | + "packages": {} | ||
| 10 | +} | ||
| @@ -1,4 +1,5 @@ | |||
| 1 | { | 1 | { |
| 2 | + "modelVersion": "5.0.2", | ||
| 2 | "license": "ISC", | 3 | "license": "ISC", |
| 3 | "devDependencies": {}, | 4 | "devDependencies": {}, |
| 4 | "author": "", | 5 | "author": "", |
| @@ -16,9 +17,7 @@ | |||
| 16 | }, | 17 | }, |
| 17 | "version": "1.0.0", | 18 | "version": "1.0.0", |
| 18 | "dependencies": { | 19 | "dependencies": { |
| 19 | - "@ohos/hvigor": "1.4.0", | 20 | + //"hypium": "^1.0.0", |
| 20 | - "@ohos/hvigor-ohos-plugin": "1.4.0", | 21 | + //"@ohos/hypium": "1.0.3" |
| 21 | - "hypium": "^1.0.0", | ||
| 22 | - "@ohos/hypium": "1.0.3" | ||
| 23 | } | 22 | } |
| 24 | } | 23 | } |
| @@ -1,1094 +0,0 @@ | |||
| 1 | -{ | ||
| 2 | - "name": "updateapp", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "lockfileVersion": 1, | ||
| 5 | - "requires": true, | ||
| 6 | - "dependencies": { | ||
| 7 | - "@ohos/hos-sdkmanager-common": { | ||
| 8 | - "version": "2.1.6", | ||
| 9 | - "resolved": "https://repo.harmonyos.com/npm/@ohos/hos-sdkmanager-common/-/@ohos/hos-sdkmanager-common-2.1.6.tgz", | ||
| 10 | - "integrity": "sha512-DAT3YbqBE5/6lEOPTQA4pyNt5Wv790AlXcE5iIAofb47uXKmXf3EYL7UBoBRI0U8gJ9qnD/wNuW0vwMrlK8rDw==", | ||
| 11 | - "requires": { | ||
| 12 | - "@ohos/sdkmanager-common": "2.3.4" | ||
| 13 | - } | ||
| 14 | - }, | ||
| 15 | - "@ohos/hvigor": { | ||
| 16 | - "version": "1.4.0", | ||
| 17 | - "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor/-/@ohos/hvigor-1.4.0.tgz", | ||
| 18 | - "integrity": "sha512-UNWl/KYWaRLmcyXN3tJh0XpmGswjVhSZ08BCukpTrjOSgU335L3PHI6yZJ6PuXxkAxMKgt46IOi4wVdFo8NAPA==", | ||
| 19 | - "requires": { | ||
| 20 | - "@ohos/hvigor-base": "1.4.0", | ||
| 21 | - "fs-extra": "10.0.1", | ||
| 22 | - "interpret": "1.4.0", | ||
| 23 | - "liftoff": "4.0.0", | ||
| 24 | - "mute-stdout": "1.0.0", | ||
| 25 | - "pretty-hrtime": "1.0.0", | ||
| 26 | - "typescript": "4.7.4", | ||
| 27 | - "v8flags": "3.2.0", | ||
| 28 | - "yargs": "17.5.1" | ||
| 29 | - } | ||
| 30 | - }, | ||
| 31 | - "@ohos/hvigor-base": { | ||
| 32 | - "version": "1.4.0", | ||
| 33 | - "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-base/-/@ohos/hvigor-base-1.4.0.tgz", | ||
| 34 | - "integrity": "sha512-67VK4Of6HgWMDdfa4eMb0MDcDAasctDpK6Akvttwe9U+aV5HSsRJuFS1f3cNGs5+shKyApvj8+AV7VqjzqHsVA==", | ||
| 35 | - "requires": { | ||
| 36 | - "fs-extra": "10.0.1", | ||
| 37 | - "iconv-lite": "0.6.3", | ||
| 38 | - "json5": "2.2.3", | ||
| 39 | - "lodash": "4.17.21", | ||
| 40 | - "log4js": "6.4.1", | ||
| 41 | - "once": "1.4.0", | ||
| 42 | - "pretty-hrtime": "1.0.0" | ||
| 43 | - } | ||
| 44 | - }, | ||
| 45 | - "@ohos/hvigor-ohos-plugin": { | ||
| 46 | - "version": "1.4.0", | ||
| 47 | - "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-ohos-plugin/-/@ohos/hvigor-ohos-plugin-1.4.0.tgz", | ||
| 48 | - "integrity": "sha512-fVGPFfjzLitY8d19kPSuMiGdw2KsZPTnaquTq910g8X0WCwYCR+N25m1LmS44H/48/mV1/ciiJusivPn3EvLJw==", | ||
| 49 | - "requires": { | ||
| 50 | - "@ohos/hos-sdkmanager-common": "2.1.6", | ||
| 51 | - "@ohos/sdkmanager-common": "2.3.4", | ||
| 52 | - "adm-zip": "0.5.9", | ||
| 53 | - "ajv": "8.10.0", | ||
| 54 | - "deasync": "0.1.28", | ||
| 55 | - "execa": "5.1.1", | ||
| 56 | - "fast-xml-parser": "4.0.3", | ||
| 57 | - "fs-extra": "10.0.1", | ||
| 58 | - "glob": "7.2.0", | ||
| 59 | - "iconv-lite": "0.6.3", | ||
| 60 | - "json5": "2.2.3", | ||
| 61 | - "lodash": "4.17.21", | ||
| 62 | - "pretty-hrtime": "1.0.3", | ||
| 63 | - "resolve-package-path": "4.0.3" | ||
| 64 | - }, | ||
| 65 | - "dependencies": { | ||
| 66 | - "pretty-hrtime": { | ||
| 67 | - "version": "1.0.3", | ||
| 68 | - "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", | ||
| 69 | - "integrity": "sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==" | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - }, | ||
| 73 | - "@ohos/hypium": { | ||
| 74 | - "version": "1.0.3", | ||
| 75 | - "resolved": "https://repo.harmonyos.com/npm/@ohos/hypium/-/@ohos/hypium-1.0.3.tgz", | ||
| 76 | - "integrity": "sha512-QKh8ngJk1ySbAiKpSTLP5EJIbT8Oja1zV3zwgLD7U9+KX7w2gjNIk3qoP+d13CwpEfaSR3Lxt3exlQLwWSFx3g==" | ||
| 77 | - }, | ||
| 78 | - "@ohos/sdkmanager-common": { | ||
| 79 | - "version": "2.3.4", | ||
| 80 | - "resolved": "https://repo.harmonyos.com/npm/@ohos/sdkmanager-common/-/@ohos/sdkmanager-common-2.3.4.tgz", | ||
| 81 | - "integrity": "sha512-3WATGJS2lO1EV7F7KzfHCdYwJzr5n+vdrRD65ahHHXptjko1UneBwvY1WEpxSJShQQc4lwKyBK7+6UOsc+NA/w==", | ||
| 82 | - "requires": { | ||
| 83 | - "axios": "0.24.0", | ||
| 84 | - "jszip": "^3.7.0" | ||
| 85 | - } | ||
| 86 | - }, | ||
| 87 | - "adm-zip": { | ||
| 88 | - "version": "0.5.9", | ||
| 89 | - "resolved": "https://repo.huaweicloud.com/repository/npm/adm-zip/-/adm-zip-0.5.9.tgz", | ||
| 90 | - "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==" | ||
| 91 | - }, | ||
| 92 | - "ajv": { | ||
| 93 | - "version": "8.10.0", | ||
| 94 | - "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-8.10.0.tgz", | ||
| 95 | - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", | ||
| 96 | - "requires": { | ||
| 97 | - "fast-deep-equal": "^3.1.1", | ||
| 98 | - "json-schema-traverse": "^1.0.0", | ||
| 99 | - "require-from-string": "^2.0.2", | ||
| 100 | - "uri-js": "^4.2.2" | ||
| 101 | - } | ||
| 102 | - }, | ||
| 103 | - "ansi-regex": { | ||
| 104 | - "version": "5.0.1", | ||
| 105 | - "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", | ||
| 106 | - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" | ||
| 107 | - }, | ||
| 108 | - "ansi-styles": { | ||
| 109 | - "version": "4.3.0", | ||
| 110 | - "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-4.3.0.tgz", | ||
| 111 | - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", | ||
| 112 | - "requires": { | ||
| 113 | - "color-convert": "^2.0.1" | ||
| 114 | - } | ||
| 115 | - }, | ||
| 116 | - "array-each": { | ||
| 117 | - "version": "1.0.1", | ||
| 118 | - "resolved": "https://repo.huaweicloud.com/repository/npm/array-each/-/array-each-1.0.1.tgz", | ||
| 119 | - "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==" | ||
| 120 | - }, | ||
| 121 | - "array-slice": { | ||
| 122 | - "version": "1.1.0", | ||
| 123 | - "resolved": "https://repo.huaweicloud.com/repository/npm/array-slice/-/array-slice-1.1.0.tgz", | ||
| 124 | - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==" | ||
| 125 | - }, | ||
| 126 | - "axios": { | ||
| 127 | - "version": "0.24.0", | ||
| 128 | - "resolved": "https://repo.huaweicloud.com/repository/npm/axios/-/axios-0.24.0.tgz", | ||
| 129 | - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", | ||
| 130 | - "requires": { | ||
| 131 | - "follow-redirects": "^1.14.4" | ||
| 132 | - } | ||
| 133 | - }, | ||
| 134 | - "balanced-match": { | ||
| 135 | - "version": "1.0.2", | ||
| 136 | - "resolved": "https://repo.huaweicloud.com/repository/npm/balanced-match/-/balanced-match-1.0.2.tgz", | ||
| 137 | - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" | ||
| 138 | - }, | ||
| 139 | - "bindings": { | ||
| 140 | - "version": "1.5.0", | ||
| 141 | - "resolved": "https://repo.huaweicloud.com/repository/npm/bindings/-/bindings-1.5.0.tgz", | ||
| 142 | - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", | ||
| 143 | - "requires": { | ||
| 144 | - "file-uri-to-path": "1.0.0" | ||
| 145 | - } | ||
| 146 | - }, | ||
| 147 | - "brace-expansion": { | ||
| 148 | - "version": "1.1.11", | ||
| 149 | - "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", | ||
| 150 | - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", | ||
| 151 | - "requires": { | ||
| 152 | - "balanced-match": "^1.0.0", | ||
| 153 | - "concat-map": "0.0.1" | ||
| 154 | - } | ||
| 155 | - }, | ||
| 156 | - "braces": { | ||
| 157 | - "version": "3.0.2", | ||
| 158 | - "resolved": "https://repo.huaweicloud.com/repository/npm/braces/-/braces-3.0.2.tgz", | ||
| 159 | - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", | ||
| 160 | - "requires": { | ||
| 161 | - "fill-range": "^7.0.1" | ||
| 162 | - } | ||
| 163 | - }, | ||
| 164 | - "cliui": { | ||
| 165 | - "version": "7.0.4", | ||
| 166 | - "resolved": "https://repo.huaweicloud.com/repository/npm/cliui/-/cliui-7.0.4.tgz", | ||
| 167 | - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", | ||
| 168 | - "requires": { | ||
| 169 | - "string-width": "^4.2.0", | ||
| 170 | - "strip-ansi": "^6.0.0", | ||
| 171 | - "wrap-ansi": "^7.0.0" | ||
| 172 | - } | ||
| 173 | - }, | ||
| 174 | - "color-convert": { | ||
| 175 | - "version": "2.0.1", | ||
| 176 | - "resolved": "https://repo.huaweicloud.com/repository/npm/color-convert/-/color-convert-2.0.1.tgz", | ||
| 177 | - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", | ||
| 178 | - "requires": { | ||
| 179 | - "color-name": "~1.1.4" | ||
| 180 | - } | ||
| 181 | - }, | ||
| 182 | - "color-name": { | ||
| 183 | - "version": "1.1.4", | ||
| 184 | - "resolved": "https://repo.huaweicloud.com/repository/npm/color-name/-/color-name-1.1.4.tgz", | ||
| 185 | - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" | ||
| 186 | - }, | ||
| 187 | - "concat-map": { | ||
| 188 | - "version": "0.0.1", | ||
| 189 | - "resolved": "https://repo.huaweicloud.com/repository/npm/concat-map/-/concat-map-0.0.1.tgz", | ||
| 190 | - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" | ||
| 191 | - }, | ||
| 192 | - "core-util-is": { | ||
| 193 | - "version": "1.0.3", | ||
| 194 | - "resolved": "https://repo.huaweicloud.com/repository/npm/core-util-is/-/core-util-is-1.0.3.tgz", | ||
| 195 | - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" | ||
| 196 | - }, | ||
| 197 | - "cross-spawn": { | ||
| 198 | - "version": "7.0.3", | ||
| 199 | - "resolved": "https://repo.huaweicloud.com/repository/npm/cross-spawn/-/cross-spawn-7.0.3.tgz", | ||
| 200 | - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", | ||
| 201 | - "requires": { | ||
| 202 | - "path-key": "^3.1.0", | ||
| 203 | - "shebang-command": "^2.0.0", | ||
| 204 | - "which": "^2.0.1" | ||
| 205 | - }, | ||
| 206 | - "dependencies": { | ||
| 207 | - "which": { | ||
| 208 | - "version": "2.0.2", | ||
| 209 | - "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-2.0.2.tgz", | ||
| 210 | - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", | ||
| 211 | - "requires": { | ||
| 212 | - "isexe": "^2.0.0" | ||
| 213 | - } | ||
| 214 | - } | ||
| 215 | - } | ||
| 216 | - }, | ||
| 217 | - "date-format": { | ||
| 218 | - "version": "4.0.14", | ||
| 219 | - "resolved": "https://repo.huaweicloud.com/repository/npm/date-format/-/date-format-4.0.14.tgz", | ||
| 220 | - "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==" | ||
| 221 | - }, | ||
| 222 | - "deasync": { | ||
| 223 | - "version": "0.1.28", | ||
| 224 | - "resolved": "https://repo.huaweicloud.com/repository/npm/deasync/-/deasync-0.1.28.tgz", | ||
| 225 | - "integrity": "sha512-QqLF6inIDwiATrfROIyQtwOQxjZuek13WRYZ7donU5wJPLoP67MnYxA6QtqdvdBy2mMqv5m3UefBVdJjvevOYg==", | ||
| 226 | - "requires": { | ||
| 227 | - "bindings": "^1.5.0", | ||
| 228 | - "node-addon-api": "^1.7.1" | ||
| 229 | - } | ||
| 230 | - }, | ||
| 231 | - "debug": { | ||
| 232 | - "version": "4.3.4", | ||
| 233 | - "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-4.3.4.tgz", | ||
| 234 | - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", | ||
| 235 | - "requires": { | ||
| 236 | - "ms": "2.1.2" | ||
| 237 | - } | ||
| 238 | - }, | ||
| 239 | - "detect-file": { | ||
| 240 | - "version": "1.0.0", | ||
| 241 | - "resolved": "https://repo.huaweicloud.com/repository/npm/detect-file/-/detect-file-1.0.0.tgz", | ||
| 242 | - "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==" | ||
| 243 | - }, | ||
| 244 | - "emoji-regex": { | ||
| 245 | - "version": "8.0.0", | ||
| 246 | - "resolved": "https://repo.huaweicloud.com/repository/npm/emoji-regex/-/emoji-regex-8.0.0.tgz", | ||
| 247 | - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" | ||
| 248 | - }, | ||
| 249 | - "escalade": { | ||
| 250 | - "version": "3.1.1", | ||
| 251 | - "resolved": "https://repo.huaweicloud.com/repository/npm/escalade/-/escalade-3.1.1.tgz", | ||
| 252 | - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" | ||
| 253 | - }, | ||
| 254 | - "execa": { | ||
| 255 | - "version": "5.1.1", | ||
| 256 | - "resolved": "https://repo.huaweicloud.com/repository/npm/execa/-/execa-5.1.1.tgz", | ||
| 257 | - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", | ||
| 258 | - "requires": { | ||
| 259 | - "cross-spawn": "^7.0.3", | ||
| 260 | - "get-stream": "^6.0.0", | ||
| 261 | - "human-signals": "^2.1.0", | ||
| 262 | - "is-stream": "^2.0.0", | ||
| 263 | - "merge-stream": "^2.0.0", | ||
| 264 | - "npm-run-path": "^4.0.1", | ||
| 265 | - "onetime": "^5.1.2", | ||
| 266 | - "signal-exit": "^3.0.3", | ||
| 267 | - "strip-final-newline": "^2.0.0" | ||
| 268 | - } | ||
| 269 | - }, | ||
| 270 | - "expand-tilde": { | ||
| 271 | - "version": "2.0.2", | ||
| 272 | - "resolved": "https://repo.huaweicloud.com/repository/npm/expand-tilde/-/expand-tilde-2.0.2.tgz", | ||
| 273 | - "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", | ||
| 274 | - "requires": { | ||
| 275 | - "homedir-polyfill": "^1.0.1" | ||
| 276 | - } | ||
| 277 | - }, | ||
| 278 | - "extend": { | ||
| 279 | - "version": "3.0.2", | ||
| 280 | - "resolved": "https://repo.huaweicloud.com/repository/npm/extend/-/extend-3.0.2.tgz", | ||
| 281 | - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" | ||
| 282 | - }, | ||
| 283 | - "fast-deep-equal": { | ||
| 284 | - "version": "3.1.3", | ||
| 285 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", | ||
| 286 | - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" | ||
| 287 | - }, | ||
| 288 | - "fast-xml-parser": { | ||
| 289 | - "version": "4.0.3", | ||
| 290 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fast-xml-parser/-/fast-xml-parser-4.0.3.tgz", | ||
| 291 | - "integrity": "sha512-xhQbg3a/EYNHwK0cxIG1nZmVkHX/0tWihamn5pU4Mhd9KEVE2ga8ZJiqEUgB2sApElvAATOdMTLjgqIpvYDUkQ==", | ||
| 292 | - "requires": { | ||
| 293 | - "strnum": "^1.0.5" | ||
| 294 | - } | ||
| 295 | - }, | ||
| 296 | - "file-uri-to-path": { | ||
| 297 | - "version": "1.0.0", | ||
| 298 | - "resolved": "https://repo.huaweicloud.com/repository/npm/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", | ||
| 299 | - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" | ||
| 300 | - }, | ||
| 301 | - "fill-range": { | ||
| 302 | - "version": "7.0.1", | ||
| 303 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fill-range/-/fill-range-7.0.1.tgz", | ||
| 304 | - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", | ||
| 305 | - "requires": { | ||
| 306 | - "to-regex-range": "^5.0.1" | ||
| 307 | - } | ||
| 308 | - }, | ||
| 309 | - "findup-sync": { | ||
| 310 | - "version": "5.0.0", | ||
| 311 | - "resolved": "https://repo.huaweicloud.com/repository/npm/findup-sync/-/findup-sync-5.0.0.tgz", | ||
| 312 | - "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", | ||
| 313 | - "requires": { | ||
| 314 | - "detect-file": "^1.0.0", | ||
| 315 | - "is-glob": "^4.0.3", | ||
| 316 | - "micromatch": "^4.0.4", | ||
| 317 | - "resolve-dir": "^1.0.1" | ||
| 318 | - } | ||
| 319 | - }, | ||
| 320 | - "fined": { | ||
| 321 | - "version": "2.0.0", | ||
| 322 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fined/-/fined-2.0.0.tgz", | ||
| 323 | - "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", | ||
| 324 | - "requires": { | ||
| 325 | - "expand-tilde": "^2.0.2", | ||
| 326 | - "is-plain-object": "^5.0.0", | ||
| 327 | - "object.defaults": "^1.1.0", | ||
| 328 | - "object.pick": "^1.3.0", | ||
| 329 | - "parse-filepath": "^1.0.2" | ||
| 330 | - } | ||
| 331 | - }, | ||
| 332 | - "flagged-respawn": { | ||
| 333 | - "version": "2.0.0", | ||
| 334 | - "resolved": "https://repo.huaweicloud.com/repository/npm/flagged-respawn/-/flagged-respawn-2.0.0.tgz", | ||
| 335 | - "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==" | ||
| 336 | - }, | ||
| 337 | - "flatted": { | ||
| 338 | - "version": "3.2.7", | ||
| 339 | - "resolved": "https://repo.huaweicloud.com/repository/npm/flatted/-/flatted-3.2.7.tgz", | ||
| 340 | - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" | ||
| 341 | - }, | ||
| 342 | - "follow-redirects": { | ||
| 343 | - "version": "1.15.2", | ||
| 344 | - "resolved": "https://repo.huaweicloud.com/repository/npm/follow-redirects/-/follow-redirects-1.15.2.tgz", | ||
| 345 | - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" | ||
| 346 | - }, | ||
| 347 | - "for-in": { | ||
| 348 | - "version": "1.0.2", | ||
| 349 | - "resolved": "https://repo.huaweicloud.com/repository/npm/for-in/-/for-in-1.0.2.tgz", | ||
| 350 | - "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==" | ||
| 351 | - }, | ||
| 352 | - "for-own": { | ||
| 353 | - "version": "1.0.0", | ||
| 354 | - "resolved": "https://repo.huaweicloud.com/repository/npm/for-own/-/for-own-1.0.0.tgz", | ||
| 355 | - "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", | ||
| 356 | - "requires": { | ||
| 357 | - "for-in": "^1.0.1" | ||
| 358 | - } | ||
| 359 | - }, | ||
| 360 | - "fs-extra": { | ||
| 361 | - "version": "10.0.1", | ||
| 362 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-10.0.1.tgz", | ||
| 363 | - "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==", | ||
| 364 | - "requires": { | ||
| 365 | - "graceful-fs": "^4.2.0", | ||
| 366 | - "jsonfile": "^6.0.1", | ||
| 367 | - "universalify": "^2.0.0" | ||
| 368 | - } | ||
| 369 | - }, | ||
| 370 | - "fs.realpath": { | ||
| 371 | - "version": "1.0.0", | ||
| 372 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fs.realpath/-/fs.realpath-1.0.0.tgz", | ||
| 373 | - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" | ||
| 374 | - }, | ||
| 375 | - "function-bind": { | ||
| 376 | - "version": "1.1.1", | ||
| 377 | - "resolved": "https://repo.huaweicloud.com/repository/npm/function-bind/-/function-bind-1.1.1.tgz", | ||
| 378 | - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" | ||
| 379 | - }, | ||
| 380 | - "get-caller-file": { | ||
| 381 | - "version": "2.0.5", | ||
| 382 | - "resolved": "https://repo.huaweicloud.com/repository/npm/get-caller-file/-/get-caller-file-2.0.5.tgz", | ||
| 383 | - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" | ||
| 384 | - }, | ||
| 385 | - "get-stream": { | ||
| 386 | - "version": "6.0.1", | ||
| 387 | - "resolved": "https://repo.huaweicloud.com/repository/npm/get-stream/-/get-stream-6.0.1.tgz", | ||
| 388 | - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" | ||
| 389 | - }, | ||
| 390 | - "glob": { | ||
| 391 | - "version": "7.2.0", | ||
| 392 | - "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-7.2.0.tgz", | ||
| 393 | - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", | ||
| 394 | - "requires": { | ||
| 395 | - "fs.realpath": "^1.0.0", | ||
| 396 | - "inflight": "^1.0.4", | ||
| 397 | - "inherits": "2", | ||
| 398 | - "minimatch": "^3.0.4", | ||
| 399 | - "once": "^1.3.0", | ||
| 400 | - "path-is-absolute": "^1.0.0" | ||
| 401 | - } | ||
| 402 | - }, | ||
| 403 | - "global-modules": { | ||
| 404 | - "version": "1.0.0", | ||
| 405 | - "resolved": "https://repo.huaweicloud.com/repository/npm/global-modules/-/global-modules-1.0.0.tgz", | ||
| 406 | - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", | ||
| 407 | - "requires": { | ||
| 408 | - "global-prefix": "^1.0.1", | ||
| 409 | - "is-windows": "^1.0.1", | ||
| 410 | - "resolve-dir": "^1.0.0" | ||
| 411 | - } | ||
| 412 | - }, | ||
| 413 | - "global-prefix": { | ||
| 414 | - "version": "1.0.2", | ||
| 415 | - "resolved": "https://repo.huaweicloud.com/repository/npm/global-prefix/-/global-prefix-1.0.2.tgz", | ||
| 416 | - "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", | ||
| 417 | - "requires": { | ||
| 418 | - "expand-tilde": "^2.0.2", | ||
| 419 | - "homedir-polyfill": "^1.0.1", | ||
| 420 | - "ini": "^1.3.4", | ||
| 421 | - "is-windows": "^1.0.1", | ||
| 422 | - "which": "^1.2.14" | ||
| 423 | - } | ||
| 424 | - }, | ||
| 425 | - "graceful-fs": { | ||
| 426 | - "version": "4.2.11", | ||
| 427 | - "resolved": "https://repo.huaweicloud.com/repository/npm/graceful-fs/-/graceful-fs-4.2.11.tgz", | ||
| 428 | - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" | ||
| 429 | - }, | ||
| 430 | - "has": { | ||
| 431 | - "version": "1.0.3", | ||
| 432 | - "resolved": "https://repo.huaweicloud.com/repository/npm/has/-/has-1.0.3.tgz", | ||
| 433 | - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", | ||
| 434 | - "requires": { | ||
| 435 | - "function-bind": "^1.1.1" | ||
| 436 | - } | ||
| 437 | - }, | ||
| 438 | - "homedir-polyfill": { | ||
| 439 | - "version": "1.0.3", | ||
| 440 | - "resolved": "https://repo.huaweicloud.com/repository/npm/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", | ||
| 441 | - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", | ||
| 442 | - "requires": { | ||
| 443 | - "parse-passwd": "^1.0.0" | ||
| 444 | - } | ||
| 445 | - }, | ||
| 446 | - "human-signals": { | ||
| 447 | - "version": "2.1.0", | ||
| 448 | - "resolved": "https://repo.huaweicloud.com/repository/npm/human-signals/-/human-signals-2.1.0.tgz", | ||
| 449 | - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" | ||
| 450 | - }, | ||
| 451 | - "hypium": { | ||
| 452 | - "version": "1.0.0", | ||
| 453 | - "resolved": "https://repo.huaweicloud.com/repository/npm/hypium/-/hypium-1.0.0.tgz", | ||
| 454 | - "integrity": "sha512-nl+RQVv2AU/5FvFRhsXyWO5wh+2huhdqRZ3bszBWZzW+kpNI3AT4ydvVRYIfaQbYwV4UlX/rSc7BtFjLAezhow==" | ||
| 455 | - }, | ||
| 456 | - "iconv-lite": { | ||
| 457 | - "version": "0.6.3", | ||
| 458 | - "resolved": "https://repo.huaweicloud.com/repository/npm/iconv-lite/-/iconv-lite-0.6.3.tgz", | ||
| 459 | - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", | ||
| 460 | - "requires": { | ||
| 461 | - "safer-buffer": ">= 2.1.2 < 3.0.0" | ||
| 462 | - } | ||
| 463 | - }, | ||
| 464 | - "immediate": { | ||
| 465 | - "version": "3.0.6", | ||
| 466 | - "resolved": "https://repo.huaweicloud.com/repository/npm/immediate/-/immediate-3.0.6.tgz", | ||
| 467 | - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" | ||
| 468 | - }, | ||
| 469 | - "inflight": { | ||
| 470 | - "version": "1.0.6", | ||
| 471 | - "resolved": "https://repo.huaweicloud.com/repository/npm/inflight/-/inflight-1.0.6.tgz", | ||
| 472 | - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", | ||
| 473 | - "requires": { | ||
| 474 | - "once": "^1.3.0", | ||
| 475 | - "wrappy": "1" | ||
| 476 | - } | ||
| 477 | - }, | ||
| 478 | - "inherits": { | ||
| 479 | - "version": "2.0.4", | ||
| 480 | - "resolved": "https://repo.huaweicloud.com/repository/npm/inherits/-/inherits-2.0.4.tgz", | ||
| 481 | - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" | ||
| 482 | - }, | ||
| 483 | - "ini": { | ||
| 484 | - "version": "1.3.8", | ||
| 485 | - "resolved": "https://repo.huaweicloud.com/repository/npm/ini/-/ini-1.3.8.tgz", | ||
| 486 | - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" | ||
| 487 | - }, | ||
| 488 | - "interpret": { | ||
| 489 | - "version": "1.4.0", | ||
| 490 | - "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-1.4.0.tgz", | ||
| 491 | - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" | ||
| 492 | - }, | ||
| 493 | - "is-absolute": { | ||
| 494 | - "version": "1.0.0", | ||
| 495 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-absolute/-/is-absolute-1.0.0.tgz", | ||
| 496 | - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", | ||
| 497 | - "requires": { | ||
| 498 | - "is-relative": "^1.0.0", | ||
| 499 | - "is-windows": "^1.0.1" | ||
| 500 | - } | ||
| 501 | - }, | ||
| 502 | - "is-core-module": { | ||
| 503 | - "version": "2.11.0", | ||
| 504 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.11.0.tgz", | ||
| 505 | - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", | ||
| 506 | - "requires": { | ||
| 507 | - "has": "^1.0.3" | ||
| 508 | - } | ||
| 509 | - }, | ||
| 510 | - "is-extglob": { | ||
| 511 | - "version": "2.1.1", | ||
| 512 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-extglob/-/is-extglob-2.1.1.tgz", | ||
| 513 | - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" | ||
| 514 | - }, | ||
| 515 | - "is-fullwidth-code-point": { | ||
| 516 | - "version": "3.0.0", | ||
| 517 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", | ||
| 518 | - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" | ||
| 519 | - }, | ||
| 520 | - "is-glob": { | ||
| 521 | - "version": "4.0.3", | ||
| 522 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-glob/-/is-glob-4.0.3.tgz", | ||
| 523 | - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", | ||
| 524 | - "requires": { | ||
| 525 | - "is-extglob": "^2.1.1" | ||
| 526 | - } | ||
| 527 | - }, | ||
| 528 | - "is-number": { | ||
| 529 | - "version": "7.0.0", | ||
| 530 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-7.0.0.tgz", | ||
| 531 | - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" | ||
| 532 | - }, | ||
| 533 | - "is-plain-object": { | ||
| 534 | - "version": "5.0.0", | ||
| 535 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-plain-object/-/is-plain-object-5.0.0.tgz", | ||
| 536 | - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" | ||
| 537 | - }, | ||
| 538 | - "is-relative": { | ||
| 539 | - "version": "1.0.0", | ||
| 540 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-relative/-/is-relative-1.0.0.tgz", | ||
| 541 | - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", | ||
| 542 | - "requires": { | ||
| 543 | - "is-unc-path": "^1.0.0" | ||
| 544 | - } | ||
| 545 | - }, | ||
| 546 | - "is-stream": { | ||
| 547 | - "version": "2.0.1", | ||
| 548 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-stream/-/is-stream-2.0.1.tgz", | ||
| 549 | - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" | ||
| 550 | - }, | ||
| 551 | - "is-unc-path": { | ||
| 552 | - "version": "1.0.0", | ||
| 553 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-unc-path/-/is-unc-path-1.0.0.tgz", | ||
| 554 | - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", | ||
| 555 | - "requires": { | ||
| 556 | - "unc-path-regex": "^0.1.2" | ||
| 557 | - } | ||
| 558 | - }, | ||
| 559 | - "is-windows": { | ||
| 560 | - "version": "1.0.2", | ||
| 561 | - "resolved": "https://repo.huaweicloud.com/repository/npm/is-windows/-/is-windows-1.0.2.tgz", | ||
| 562 | - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" | ||
| 563 | - }, | ||
| 564 | - "isarray": { | ||
| 565 | - "version": "1.0.0", | ||
| 566 | - "resolved": "https://repo.huaweicloud.com/repository/npm/isarray/-/isarray-1.0.0.tgz", | ||
| 567 | - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" | ||
| 568 | - }, | ||
| 569 | - "isexe": { | ||
| 570 | - "version": "2.0.0", | ||
| 571 | - "resolved": "https://repo.huaweicloud.com/repository/npm/isexe/-/isexe-2.0.0.tgz", | ||
| 572 | - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" | ||
| 573 | - }, | ||
| 574 | - "isobject": { | ||
| 575 | - "version": "3.0.1", | ||
| 576 | - "resolved": "https://repo.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz", | ||
| 577 | - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==" | ||
| 578 | - }, | ||
| 579 | - "json-schema-traverse": { | ||
| 580 | - "version": "1.0.0", | ||
| 581 | - "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", | ||
| 582 | - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" | ||
| 583 | - }, | ||
| 584 | - "json5": { | ||
| 585 | - "version": "2.2.3", | ||
| 586 | - "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-2.2.3.tgz", | ||
| 587 | - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" | ||
| 588 | - }, | ||
| 589 | - "jsonfile": { | ||
| 590 | - "version": "6.1.0", | ||
| 591 | - "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz", | ||
| 592 | - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", | ||
| 593 | - "requires": { | ||
| 594 | - "graceful-fs": "^4.1.6", | ||
| 595 | - "universalify": "^2.0.0" | ||
| 596 | - } | ||
| 597 | - }, | ||
| 598 | - "jszip": { | ||
| 599 | - "version": "3.10.1", | ||
| 600 | - "resolved": "https://repo.huaweicloud.com/repository/npm/jszip/-/jszip-3.10.1.tgz", | ||
| 601 | - "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", | ||
| 602 | - "requires": { | ||
| 603 | - "lie": "~3.3.0", | ||
| 604 | - "pako": "~1.0.2", | ||
| 605 | - "readable-stream": "~2.3.6", | ||
| 606 | - "setimmediate": "^1.0.5" | ||
| 607 | - } | ||
| 608 | - }, | ||
| 609 | - "kind-of": { | ||
| 610 | - "version": "6.0.3", | ||
| 611 | - "resolved": "https://repo.huaweicloud.com/repository/npm/kind-of/-/kind-of-6.0.3.tgz", | ||
| 612 | - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" | ||
| 613 | - }, | ||
| 614 | - "lie": { | ||
| 615 | - "version": "3.3.0", | ||
| 616 | - "resolved": "https://repo.huaweicloud.com/repository/npm/lie/-/lie-3.3.0.tgz", | ||
| 617 | - "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", | ||
| 618 | - "requires": { | ||
| 619 | - "immediate": "~3.0.5" | ||
| 620 | - } | ||
| 621 | - }, | ||
| 622 | - "liftoff": { | ||
| 623 | - "version": "4.0.0", | ||
| 624 | - "resolved": "https://repo.huaweicloud.com/repository/npm/liftoff/-/liftoff-4.0.0.tgz", | ||
| 625 | - "integrity": "sha512-rMGwYF8q7g2XhG2ulBmmJgWv25qBsqRbDn5gH0+wnuyeFt7QBJlHJmtg5qEdn4pN6WVAUMgXnIxytMFRX9c1aA==", | ||
| 626 | - "requires": { | ||
| 627 | - "extend": "^3.0.2", | ||
| 628 | - "findup-sync": "^5.0.0", | ||
| 629 | - "fined": "^2.0.0", | ||
| 630 | - "flagged-respawn": "^2.0.0", | ||
| 631 | - "is-plain-object": "^5.0.0", | ||
| 632 | - "object.map": "^1.0.1", | ||
| 633 | - "rechoir": "^0.8.0", | ||
| 634 | - "resolve": "^1.20.0" | ||
| 635 | - } | ||
| 636 | - }, | ||
| 637 | - "lodash": { | ||
| 638 | - "version": "4.17.21", | ||
| 639 | - "resolved": "https://repo.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz", | ||
| 640 | - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" | ||
| 641 | - }, | ||
| 642 | - "log4js": { | ||
| 643 | - "version": "6.4.1", | ||
| 644 | - "resolved": "https://repo.huaweicloud.com/repository/npm/log4js/-/log4js-6.4.1.tgz", | ||
| 645 | - "integrity": "sha512-iUiYnXqAmNKiIZ1XSAitQ4TmNs8CdZYTAWINARF3LjnsLN8tY5m0vRwd6uuWj/yNY0YHxeZodnbmxKFUOM2rMg==", | ||
| 646 | - "requires": { | ||
| 647 | - "date-format": "^4.0.3", | ||
| 648 | - "debug": "^4.3.3", | ||
| 649 | - "flatted": "^3.2.4", | ||
| 650 | - "rfdc": "^1.3.0", | ||
| 651 | - "streamroller": "^3.0.2" | ||
| 652 | - } | ||
| 653 | - }, | ||
| 654 | - "make-iterator": { | ||
| 655 | - "version": "1.0.1", | ||
| 656 | - "resolved": "https://repo.huaweicloud.com/repository/npm/make-iterator/-/make-iterator-1.0.1.tgz", | ||
| 657 | - "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", | ||
| 658 | - "requires": { | ||
| 659 | - "kind-of": "^6.0.2" | ||
| 660 | - } | ||
| 661 | - }, | ||
| 662 | - "map-cache": { | ||
| 663 | - "version": "0.2.2", | ||
| 664 | - "resolved": "https://repo.huaweicloud.com/repository/npm/map-cache/-/map-cache-0.2.2.tgz", | ||
| 665 | - "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==" | ||
| 666 | - }, | ||
| 667 | - "merge-stream": { | ||
| 668 | - "version": "2.0.0", | ||
| 669 | - "resolved": "https://repo.huaweicloud.com/repository/npm/merge-stream/-/merge-stream-2.0.0.tgz", | ||
| 670 | - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" | ||
| 671 | - }, | ||
| 672 | - "micromatch": { | ||
| 673 | - "version": "4.0.5", | ||
| 674 | - "resolved": "https://repo.huaweicloud.com/repository/npm/micromatch/-/micromatch-4.0.5.tgz", | ||
| 675 | - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", | ||
| 676 | - "requires": { | ||
| 677 | - "braces": "^3.0.2", | ||
| 678 | - "picomatch": "^2.3.1" | ||
| 679 | - } | ||
| 680 | - }, | ||
| 681 | - "mimic-fn": { | ||
| 682 | - "version": "2.1.0", | ||
| 683 | - "resolved": "https://repo.huaweicloud.com/repository/npm/mimic-fn/-/mimic-fn-2.1.0.tgz", | ||
| 684 | - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" | ||
| 685 | - }, | ||
| 686 | - "minimatch": { | ||
| 687 | - "version": "3.1.2", | ||
| 688 | - "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", | ||
| 689 | - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", | ||
| 690 | - "requires": { | ||
| 691 | - "brace-expansion": "^1.1.7" | ||
| 692 | - } | ||
| 693 | - }, | ||
| 694 | - "ms": { | ||
| 695 | - "version": "2.1.2", | ||
| 696 | - "resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.1.2.tgz", | ||
| 697 | - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | ||
| 698 | - }, | ||
| 699 | - "mute-stdout": { | ||
| 700 | - "version": "1.0.0", | ||
| 701 | - "resolved": "https://repo.huaweicloud.com/repository/npm/mute-stdout/-/mute-stdout-1.0.0.tgz", | ||
| 702 | - "integrity": "sha512-MaSQenn0f9oxIjtCufclpV00MuYTiHaXPbdcfPIM+quMqoa8cXywjHHx4LhhIAZlXqPWMdcUpYviajfmHtHRJw==" | ||
| 703 | - }, | ||
| 704 | - "node-addon-api": { | ||
| 705 | - "version": "1.7.2", | ||
| 706 | - "resolved": "https://repo.huaweicloud.com/repository/npm/node-addon-api/-/node-addon-api-1.7.2.tgz", | ||
| 707 | - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" | ||
| 708 | - }, | ||
| 709 | - "npm-run-path": { | ||
| 710 | - "version": "4.0.1", | ||
| 711 | - "resolved": "https://repo.huaweicloud.com/repository/npm/npm-run-path/-/npm-run-path-4.0.1.tgz", | ||
| 712 | - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", | ||
| 713 | - "requires": { | ||
| 714 | - "path-key": "^3.0.0" | ||
| 715 | - } | ||
| 716 | - }, | ||
| 717 | - "object.defaults": { | ||
| 718 | - "version": "1.1.0", | ||
| 719 | - "resolved": "https://repo.huaweicloud.com/repository/npm/object.defaults/-/object.defaults-1.1.0.tgz", | ||
| 720 | - "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", | ||
| 721 | - "requires": { | ||
| 722 | - "array-each": "^1.0.1", | ||
| 723 | - "array-slice": "^1.0.0", | ||
| 724 | - "for-own": "^1.0.0", | ||
| 725 | - "isobject": "^3.0.0" | ||
| 726 | - } | ||
| 727 | - }, | ||
| 728 | - "object.map": { | ||
| 729 | - "version": "1.0.1", | ||
| 730 | - "resolved": "https://repo.huaweicloud.com/repository/npm/object.map/-/object.map-1.0.1.tgz", | ||
| 731 | - "integrity": "sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==", | ||
| 732 | - "requires": { | ||
| 733 | - "for-own": "^1.0.0", | ||
| 734 | - "make-iterator": "^1.0.0" | ||
| 735 | - } | ||
| 736 | - }, | ||
| 737 | - "object.pick": { | ||
| 738 | - "version": "1.3.0", | ||
| 739 | - "resolved": "https://repo.huaweicloud.com/repository/npm/object.pick/-/object.pick-1.3.0.tgz", | ||
| 740 | - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", | ||
| 741 | - "requires": { | ||
| 742 | - "isobject": "^3.0.1" | ||
| 743 | - } | ||
| 744 | - }, | ||
| 745 | - "once": { | ||
| 746 | - "version": "1.4.0", | ||
| 747 | - "resolved": "https://repo.huaweicloud.com/repository/npm/once/-/once-1.4.0.tgz", | ||
| 748 | - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", | ||
| 749 | - "requires": { | ||
| 750 | - "wrappy": "1" | ||
| 751 | - } | ||
| 752 | - }, | ||
| 753 | - "onetime": { | ||
| 754 | - "version": "5.1.2", | ||
| 755 | - "resolved": "https://repo.huaweicloud.com/repository/npm/onetime/-/onetime-5.1.2.tgz", | ||
| 756 | - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", | ||
| 757 | - "requires": { | ||
| 758 | - "mimic-fn": "^2.1.0" | ||
| 759 | - } | ||
| 760 | - }, | ||
| 761 | - "pako": { | ||
| 762 | - "version": "1.0.11", | ||
| 763 | - "resolved": "https://repo.huaweicloud.com/repository/npm/pako/-/pako-1.0.11.tgz", | ||
| 764 | - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" | ||
| 765 | - }, | ||
| 766 | - "parse-filepath": { | ||
| 767 | - "version": "1.0.2", | ||
| 768 | - "resolved": "https://repo.huaweicloud.com/repository/npm/parse-filepath/-/parse-filepath-1.0.2.tgz", | ||
| 769 | - "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", | ||
| 770 | - "requires": { | ||
| 771 | - "is-absolute": "^1.0.0", | ||
| 772 | - "map-cache": "^0.2.0", | ||
| 773 | - "path-root": "^0.1.1" | ||
| 774 | - } | ||
| 775 | - }, | ||
| 776 | - "parse-passwd": { | ||
| 777 | - "version": "1.0.0", | ||
| 778 | - "resolved": "https://repo.huaweicloud.com/repository/npm/parse-passwd/-/parse-passwd-1.0.0.tgz", | ||
| 779 | - "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==" | ||
| 780 | - }, | ||
| 781 | - "path-is-absolute": { | ||
| 782 | - "version": "1.0.1", | ||
| 783 | - "resolved": "https://repo.huaweicloud.com/repository/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", | ||
| 784 | - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" | ||
| 785 | - }, | ||
| 786 | - "path-key": { | ||
| 787 | - "version": "3.1.1", | ||
| 788 | - "resolved": "https://repo.huaweicloud.com/repository/npm/path-key/-/path-key-3.1.1.tgz", | ||
| 789 | - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" | ||
| 790 | - }, | ||
| 791 | - "path-parse": { | ||
| 792 | - "version": "1.0.7", | ||
| 793 | - "resolved": "https://repo.huaweicloud.com/repository/npm/path-parse/-/path-parse-1.0.7.tgz", | ||
| 794 | - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" | ||
| 795 | - }, | ||
| 796 | - "path-root": { | ||
| 797 | - "version": "0.1.1", | ||
| 798 | - "resolved": "https://repo.huaweicloud.com/repository/npm/path-root/-/path-root-0.1.1.tgz", | ||
| 799 | - "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", | ||
| 800 | - "requires": { | ||
| 801 | - "path-root-regex": "^0.1.0" | ||
| 802 | - } | ||
| 803 | - }, | ||
| 804 | - "path-root-regex": { | ||
| 805 | - "version": "0.1.2", | ||
| 806 | - "resolved": "https://repo.huaweicloud.com/repository/npm/path-root-regex/-/path-root-regex-0.1.2.tgz", | ||
| 807 | - "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==" | ||
| 808 | - }, | ||
| 809 | - "picomatch": { | ||
| 810 | - "version": "2.3.1", | ||
| 811 | - "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-2.3.1.tgz", | ||
| 812 | - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" | ||
| 813 | - }, | ||
| 814 | - "pretty-hrtime": { | ||
| 815 | - "version": "1.0.0", | ||
| 816 | - "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.0.tgz", | ||
| 817 | - "integrity": "sha512-CU2l5CYUAptUYq/671ajexQfXuxJFwwg0n243Kdkx8bTjeenedsWgu8TGHPm03vLfNtk3aTXgySKPp3Usykudw==" | ||
| 818 | - }, | ||
| 819 | - "process-nextick-args": { | ||
| 820 | - "version": "2.0.1", | ||
| 821 | - "resolved": "https://repo.huaweicloud.com/repository/npm/process-nextick-args/-/process-nextick-args-2.0.1.tgz", | ||
| 822 | - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" | ||
| 823 | - }, | ||
| 824 | - "punycode": { | ||
| 825 | - "version": "2.3.0", | ||
| 826 | - "resolved": "https://repo.huaweicloud.com/repository/npm/punycode/-/punycode-2.3.0.tgz", | ||
| 827 | - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" | ||
| 828 | - }, | ||
| 829 | - "readable-stream": { | ||
| 830 | - "version": "2.3.8", | ||
| 831 | - "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-2.3.8.tgz", | ||
| 832 | - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", | ||
| 833 | - "requires": { | ||
| 834 | - "core-util-is": "~1.0.0", | ||
| 835 | - "inherits": "~2.0.3", | ||
| 836 | - "isarray": "~1.0.0", | ||
| 837 | - "process-nextick-args": "~2.0.0", | ||
| 838 | - "safe-buffer": "~5.1.1", | ||
| 839 | - "string_decoder": "~1.1.1", | ||
| 840 | - "util-deprecate": "~1.0.1" | ||
| 841 | - } | ||
| 842 | - }, | ||
| 843 | - "rechoir": { | ||
| 844 | - "version": "0.8.0", | ||
| 845 | - "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.8.0.tgz", | ||
| 846 | - "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", | ||
| 847 | - "requires": { | ||
| 848 | - "resolve": "^1.20.0" | ||
| 849 | - } | ||
| 850 | - }, | ||
| 851 | - "require-directory": { | ||
| 852 | - "version": "2.1.1", | ||
| 853 | - "resolved": "https://repo.huaweicloud.com/repository/npm/require-directory/-/require-directory-2.1.1.tgz", | ||
| 854 | - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" | ||
| 855 | - }, | ||
| 856 | - "require-from-string": { | ||
| 857 | - "version": "2.0.2", | ||
| 858 | - "resolved": "https://repo.huaweicloud.com/repository/npm/require-from-string/-/require-from-string-2.0.2.tgz", | ||
| 859 | - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" | ||
| 860 | - }, | ||
| 861 | - "resolve": { | ||
| 862 | - "version": "1.22.1", | ||
| 863 | - "resolved": "https://repo.huaweicloud.com/repository/npm/resolve/-/resolve-1.22.1.tgz", | ||
| 864 | - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", | ||
| 865 | - "requires": { | ||
| 866 | - "is-core-module": "^2.9.0", | ||
| 867 | - "path-parse": "^1.0.7", | ||
| 868 | - "supports-preserve-symlinks-flag": "^1.0.0" | ||
| 869 | - } | ||
| 870 | - }, | ||
| 871 | - "resolve-dir": { | ||
| 872 | - "version": "1.0.1", | ||
| 873 | - "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-dir/-/resolve-dir-1.0.1.tgz", | ||
| 874 | - "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", | ||
| 875 | - "requires": { | ||
| 876 | - "expand-tilde": "^2.0.0", | ||
| 877 | - "global-modules": "^1.0.0" | ||
| 878 | - } | ||
| 879 | - }, | ||
| 880 | - "resolve-package-path": { | ||
| 881 | - "version": "4.0.3", | ||
| 882 | - "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-package-path/-/resolve-package-path-4.0.3.tgz", | ||
| 883 | - "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==", | ||
| 884 | - "requires": { | ||
| 885 | - "path-root": "^0.1.1" | ||
| 886 | - } | ||
| 887 | - }, | ||
| 888 | - "rfdc": { | ||
| 889 | - "version": "1.3.0", | ||
| 890 | - "resolved": "https://repo.huaweicloud.com/repository/npm/rfdc/-/rfdc-1.3.0.tgz", | ||
| 891 | - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" | ||
| 892 | - }, | ||
| 893 | - "safe-buffer": { | ||
| 894 | - "version": "5.1.2", | ||
| 895 | - "resolved": "https://repo.huaweicloud.com/repository/npm/safe-buffer/-/safe-buffer-5.1.2.tgz", | ||
| 896 | - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" | ||
| 897 | - }, | ||
| 898 | - "safer-buffer": { | ||
| 899 | - "version": "2.1.2", | ||
| 900 | - "resolved": "https://repo.huaweicloud.com/repository/npm/safer-buffer/-/safer-buffer-2.1.2.tgz", | ||
| 901 | - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" | ||
| 902 | - }, | ||
| 903 | - "setimmediate": { | ||
| 904 | - "version": "1.0.5", | ||
| 905 | - "resolved": "https://repo.huaweicloud.com/repository/npm/setimmediate/-/setimmediate-1.0.5.tgz", | ||
| 906 | - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" | ||
| 907 | - }, | ||
| 908 | - "shebang-command": { | ||
| 909 | - "version": "2.0.0", | ||
| 910 | - "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-command/-/shebang-command-2.0.0.tgz", | ||
| 911 | - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", | ||
| 912 | - "requires": { | ||
| 913 | - "shebang-regex": "^3.0.0" | ||
| 914 | - } | ||
| 915 | - }, | ||
| 916 | - "shebang-regex": { | ||
| 917 | - "version": "3.0.0", | ||
| 918 | - "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", | ||
| 919 | - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" | ||
| 920 | - }, | ||
| 921 | - "signal-exit": { | ||
| 922 | - "version": "3.0.7", | ||
| 923 | - "resolved": "https://repo.huaweicloud.com/repository/npm/signal-exit/-/signal-exit-3.0.7.tgz", | ||
| 924 | - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" | ||
| 925 | - }, | ||
| 926 | - "streamroller": { | ||
| 927 | - "version": "3.1.5", | ||
| 928 | - "resolved": "https://repo.huaweicloud.com/repository/npm/streamroller/-/streamroller-3.1.5.tgz", | ||
| 929 | - "integrity": "sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==", | ||
| 930 | - "requires": { | ||
| 931 | - "date-format": "^4.0.14", | ||
| 932 | - "debug": "^4.3.4", | ||
| 933 | - "fs-extra": "^8.1.0" | ||
| 934 | - }, | ||
| 935 | - "dependencies": { | ||
| 936 | - "fs-extra": { | ||
| 937 | - "version": "8.1.0", | ||
| 938 | - "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-8.1.0.tgz", | ||
| 939 | - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", | ||
| 940 | - "requires": { | ||
| 941 | - "graceful-fs": "^4.2.0", | ||
| 942 | - "jsonfile": "^4.0.0", | ||
| 943 | - "universalify": "^0.1.0" | ||
| 944 | - } | ||
| 945 | - }, | ||
| 946 | - "jsonfile": { | ||
| 947 | - "version": "4.0.0", | ||
| 948 | - "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-4.0.0.tgz", | ||
| 949 | - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", | ||
| 950 | - "requires": { | ||
| 951 | - "graceful-fs": "^4.1.6" | ||
| 952 | - } | ||
| 953 | - }, | ||
| 954 | - "universalify": { | ||
| 955 | - "version": "0.1.2", | ||
| 956 | - "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-0.1.2.tgz", | ||
| 957 | - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" | ||
| 958 | - } | ||
| 959 | - } | ||
| 960 | - }, | ||
| 961 | - "string-width": { | ||
| 962 | - "version": "4.2.3", | ||
| 963 | - "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-4.2.3.tgz", | ||
| 964 | - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", | ||
| 965 | - "requires": { | ||
| 966 | - "emoji-regex": "^8.0.0", | ||
| 967 | - "is-fullwidth-code-point": "^3.0.0", | ||
| 968 | - "strip-ansi": "^6.0.1" | ||
| 969 | - } | ||
| 970 | - }, | ||
| 971 | - "string_decoder": { | ||
| 972 | - "version": "1.1.1", | ||
| 973 | - "resolved": "https://repo.huaweicloud.com/repository/npm/string_decoder/-/string_decoder-1.1.1.tgz", | ||
| 974 | - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", | ||
| 975 | - "requires": { | ||
| 976 | - "safe-buffer": "~5.1.0" | ||
| 977 | - } | ||
| 978 | - }, | ||
| 979 | - "strip-ansi": { | ||
| 980 | - "version": "6.0.1", | ||
| 981 | - "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", | ||
| 982 | - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", | ||
| 983 | - "requires": { | ||
| 984 | - "ansi-regex": "^5.0.1" | ||
| 985 | - } | ||
| 986 | - }, | ||
| 987 | - "strip-final-newline": { | ||
| 988 | - "version": "2.0.0", | ||
| 989 | - "resolved": "https://repo.huaweicloud.com/repository/npm/strip-final-newline/-/strip-final-newline-2.0.0.tgz", | ||
| 990 | - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" | ||
| 991 | - }, | ||
| 992 | - "strnum": { | ||
| 993 | - "version": "1.0.5", | ||
| 994 | - "resolved": "https://repo.huaweicloud.com/repository/npm/strnum/-/strnum-1.0.5.tgz", | ||
| 995 | - "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" | ||
| 996 | - }, | ||
| 997 | - "supports-preserve-symlinks-flag": { | ||
| 998 | - "version": "1.0.0", | ||
| 999 | - "resolved": "https://repo.huaweicloud.com/repository/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", | ||
| 1000 | - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" | ||
| 1001 | - }, | ||
| 1002 | - "to-regex-range": { | ||
| 1003 | - "version": "5.0.1", | ||
| 1004 | - "resolved": "https://repo.huaweicloud.com/repository/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", | ||
| 1005 | - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", | ||
| 1006 | - "requires": { | ||
| 1007 | - "is-number": "^7.0.0" | ||
| 1008 | - } | ||
| 1009 | - }, | ||
| 1010 | - "typescript": { | ||
| 1011 | - "version": "4.7.4", | ||
| 1012 | - "resolved": "https://repo.huaweicloud.com/repository/npm/typescript/-/typescript-4.7.4.tgz", | ||
| 1013 | - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==" | ||
| 1014 | - }, | ||
| 1015 | - "unc-path-regex": { | ||
| 1016 | - "version": "0.1.2", | ||
| 1017 | - "resolved": "https://repo.huaweicloud.com/repository/npm/unc-path-regex/-/unc-path-regex-0.1.2.tgz", | ||
| 1018 | - "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==" | ||
| 1019 | - }, | ||
| 1020 | - "universalify": { | ||
| 1021 | - "version": "2.0.0", | ||
| 1022 | - "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.0.tgz", | ||
| 1023 | - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" | ||
| 1024 | - }, | ||
| 1025 | - "uri-js": { | ||
| 1026 | - "version": "4.4.1", | ||
| 1027 | - "resolved": "https://repo.huaweicloud.com/repository/npm/uri-js/-/uri-js-4.4.1.tgz", | ||
| 1028 | - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", | ||
| 1029 | - "requires": { | ||
| 1030 | - "punycode": "^2.1.0" | ||
| 1031 | - } | ||
| 1032 | - }, | ||
| 1033 | - "util-deprecate": { | ||
| 1034 | - "version": "1.0.2", | ||
| 1035 | - "resolved": "https://repo.huaweicloud.com/repository/npm/util-deprecate/-/util-deprecate-1.0.2.tgz", | ||
| 1036 | - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" | ||
| 1037 | - }, | ||
| 1038 | - "v8flags": { | ||
| 1039 | - "version": "3.2.0", | ||
| 1040 | - "resolved": "https://repo.huaweicloud.com/repository/npm/v8flags/-/v8flags-3.2.0.tgz", | ||
| 1041 | - "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", | ||
| 1042 | - "requires": { | ||
| 1043 | - "homedir-polyfill": "^1.0.1" | ||
| 1044 | - } | ||
| 1045 | - }, | ||
| 1046 | - "which": { | ||
| 1047 | - "version": "1.3.1", | ||
| 1048 | - "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-1.3.1.tgz", | ||
| 1049 | - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", | ||
| 1050 | - "requires": { | ||
| 1051 | - "isexe": "^2.0.0" | ||
| 1052 | - } | ||
| 1053 | - }, | ||
| 1054 | - "wrap-ansi": { | ||
| 1055 | - "version": "7.0.0", | ||
| 1056 | - "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-7.0.0.tgz", | ||
| 1057 | - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", | ||
| 1058 | - "requires": { | ||
| 1059 | - "ansi-styles": "^4.0.0", | ||
| 1060 | - "string-width": "^4.1.0", | ||
| 1061 | - "strip-ansi": "^6.0.0" | ||
| 1062 | - } | ||
| 1063 | - }, | ||
| 1064 | - "wrappy": { | ||
| 1065 | - "version": "1.0.2", | ||
| 1066 | - "resolved": "https://repo.huaweicloud.com/repository/npm/wrappy/-/wrappy-1.0.2.tgz", | ||
| 1067 | - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" | ||
| 1068 | - }, | ||
| 1069 | - "y18n": { | ||
| 1070 | - "version": "5.0.8", | ||
| 1071 | - "resolved": "https://repo.huaweicloud.com/repository/npm/y18n/-/y18n-5.0.8.tgz", | ||
| 1072 | - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" | ||
| 1073 | - }, | ||
| 1074 | - "yargs": { | ||
| 1075 | - "version": "17.5.1", | ||
| 1076 | - "resolved": "https://repo.huaweicloud.com/repository/npm/yargs/-/yargs-17.5.1.tgz", | ||
| 1077 | - "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", | ||
| 1078 | - "requires": { | ||
| 1079 | - "cliui": "^7.0.2", | ||
| 1080 | - "escalade": "^3.1.1", | ||
| 1081 | - "get-caller-file": "^2.0.5", | ||
| 1082 | - "require-directory": "^2.1.1", | ||
| 1083 | - "string-width": "^4.2.3", | ||
| 1084 | - "y18n": "^5.0.5", | ||
| 1085 | - "yargs-parser": "^21.0.0" | ||
| 1086 | - } | ||
| 1087 | - }, | ||
| 1088 | - "yargs-parser": { | ||
| 1089 | - "version": "21.1.1", | ||
| 1090 | - "resolved": "https://repo.huaweicloud.com/repository/npm/yargs-parser/-/yargs-parser-21.1.1.tgz", | ||
| 1091 | - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" | ||
| 1092 | - } | ||
| 1093 | - } | ||
| 1094 | -} | ||
| @@ -0,0 +1,29 @@ | |||
| 1 | +{ | ||
| 2 | + "meta": { | ||
| 3 | + "stableOrder": true, | ||
| 4 | + "enableUnifiedLockfile": false | ||
| 5 | + }, | ||
| 6 | + "lockfileVersion": 3, | ||
| 7 | + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. Do NOT EDIT THIS FILE DIRECTLY.", | ||
| 8 | + "specifiers": { | ||
| 9 | + "@ohos/common@../../../common": "@ohos/common@../../../common", | ||
| 10 | + "ota@../../../feature/ota": "ota@../../../feature/ota" | ||
| 11 | + }, | ||
| 12 | + "packages": { | ||
| 13 | + "@ohos/common@../../../common": { | ||
| 14 | + "name": "@ohos/common", | ||
| 15 | + "version": "1.0.0", | ||
| 16 | + "resolved": "../../../common", | ||
| 17 | + "registryType": "local" | ||
| 18 | + }, | ||
| 19 | + "ota@../../../feature/ota": { | ||
| 20 | + "name": "ota", | ||
| 21 | + "version": "1.0.0", | ||
| 22 | + "resolved": "../../../feature/ota", | ||
| 23 | + "registryType": "local", | ||
| 24 | + "dependencies": { | ||
| 25 | + "@ohos/common": "file:../../common" | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | +} | ||
| @@ -7,10 +7,10 @@ | |||
| 7 | "directoryLevel": "module" | 7 | "directoryLevel": "module" |
| 8 | }, | 8 | }, |
| 9 | "description": "updateapp description", | 9 | "description": "updateapp description", |
| 10 | - "repository": {}, | 10 | + "repository": "", |
| 11 | "license": "ISC", | 11 | "license": "ISC", |
| 12 | "dependencies": { | 12 | "dependencies": { |
| 13 | "@ohos/common": "file:../../../common", | 13 | "@ohos/common": "file:../../../common", |
| 14 | - "@ohos/ota": "file:../../../feature/ota" | 14 | + "ota": "file:../../../feature/ota" |
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| @@ -1,22 +0,0 @@ | |||
| 1 | -{ | ||
| 2 | - "name": "updateapp", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "lockfileVersion": 1, | ||
| 5 | - "requires": true, | ||
| 6 | - "dependencies": { | ||
| 7 | - "@ohos/common": { | ||
| 8 | - "version": "file:../../../common" | ||
| 9 | - }, | ||
| 10 | - "@ohos/ota": { | ||
| 11 | - "version": "file:../../../feature/ota", | ||
| 12 | - "requires": { | ||
| 13 | - "@ohos/common": "file:../../../common" | ||
| 14 | - }, | ||
| 15 | - "dependencies": { | ||
| 16 | - "@ohos/common": { | ||
| 17 | - "version": "file:../../../common" | ||
| 18 | - } | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - } | ||
| 22 | -} | ||
Rproduct/oh/base/src/main/ets/MainAbility/MainAbility.ts→product/oh/base/src/main/ets/MainAbility/MainAbility.ets+3-3
| @@ -22,8 +22,8 @@ import type window from '@ohos.window'; | |||
| 22 | import type { Configuration } from '@ohos.app.ability.Configuration'; | 22 | import type { Configuration } from '@ohos.app.ability.Configuration'; |
| 23 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 23 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 24 | import type { OtaStatus } from '@ohos/common/src/main/ets/const/update_const'; | 24 | import type { OtaStatus } from '@ohos/common/src/main/ets/const/update_const'; |
| 25 | -import { StateManager } from '@ohos/ota/src/main/ets/manager/StateManager'; | 25 | +import { StateManager } from 'ota/src/main/ets/manager/StateManager'; |
| 26 | -import { NotificationHelper } from '@ohos/ota/src/main/ets/notify/NotificationHelper'; | 26 | +import { NotificationHelper } from 'ota/src/main/ets/notify/NotificationHelper'; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * 主Ability | 29 | * 主Ability |
| @@ -32,7 +32,7 @@ import { NotificationHelper } from '@ohos/ota/src/main/ets/notify/NotificationHe | |||
| 32 | */ | 32 | */ |
| 33 | export default class MainAbility extends Ability { | 33 | export default class MainAbility extends Ability { |
| 34 | private static readonly WAITING_PREPARE_TIME = 1500; | 34 | private static readonly WAITING_PREPARE_TIME = 1500; |
| 35 | - private language: string = ''; | 35 | + private language: string | undefined = ''; |
| 36 | 36 | ||
| 37 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 37 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| 38 | this.log('BaseAbility onCreate:' + this.context.config.screenDensity); | 38 | this.log('BaseAbility onCreate:' + this.context.config.screenDensity); |
Rproduct/oh/base/src/main/ets/ServiceExtAbility/service.ts→product/oh/base/src/main/ets/ServiceExtAbility/service.ets+7-6
| @@ -16,9 +16,10 @@ | |||
| 16 | import Extension from '@ohos.app.ability.ServiceExtensionAbility'; | 16 | import Extension from '@ohos.app.ability.ServiceExtensionAbility'; |
| 17 | import type Want from '@ohos.app.ability.Want'; | 17 | import type Want from '@ohos.app.ability.Want'; |
| 18 | import type rpc from '@ohos.rpc'; | 18 | import type rpc from '@ohos.rpc'; |
| 19 | -import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; | 19 | +import { CommonUtils } from '@ohos/common/src/main/ets/util/CommonUtils'; |
| 20 | -import { OtaUpdateManager } from '@ohos/ota/src/main/ets/manager/OtaUpdateManager'; | 20 | +import { OtaUpdateManager } from 'ota/src/main/ets/manager/OtaUpdateManager'; |
| 21 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 21 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 22 | +import type { BusinessError } from '@ohos/common/src/main/ets/const/update_const'; | ||
| 22 | import { ServiceExtStub } from './serviceStub'; | 23 | import { ServiceExtStub } from './serviceStub'; |
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| @@ -36,7 +37,7 @@ export default class ServiceExtAbility extends Extension { | |||
| 36 | private connectTimeoutId: number | null = null; | 37 | private connectTimeoutId: number | null = null; |
| 37 | 38 | ||
| 38 | onCreate(want: Want): void { | 39 | onCreate(want: Want): void { |
| 39 | - LogUtils.log(ServiceExtAbility.TAG, 'onCreate:' + FormatUtils.stringify(want)); | 40 | + LogUtils.log(ServiceExtAbility.TAG, 'onCreate:' + CommonUtils.stringify(want)); |
| 40 | globalThis.extensionContext = this.context; // when start ServiceExtAbility ,set context | 41 | globalThis.extensionContext = this.context; // when start ServiceExtAbility ,set context |
| 41 | } | 42 | } |
| 42 | 43 | ||
| @@ -70,9 +71,9 @@ export default class ServiceExtAbility extends Extension { | |||
| 70 | }, this.connectTimeout * 1000); | 71 | }, this.connectTimeout * 1000); |
| 71 | 72 | ||
| 72 | let want: Want = { | 73 | let want: Want = { |
| 73 | - parameters: FormatUtils.parseJson(message) | 74 | + parameters: CommonUtils.parseJson(message) |
| 74 | }; | 75 | }; |
| 75 | - LogUtils.log(ServiceExtAbility.TAG, 'onConnect:' + FormatUtils.stringify(want)); | 76 | + LogUtils.log(ServiceExtAbility.TAG, 'onConnect:' + CommonUtils.stringify(want)); |
| 76 | OtaUpdateManager.getInstance().handleWant(want, globalThis.extensionContext); | 77 | OtaUpdateManager.getInstance().handleWant(want, globalThis.extensionContext); |
| 77 | } | 78 | } |
| 78 | 79 | ||
| @@ -93,7 +94,7 @@ export default class ServiceExtAbility extends Extension { | |||
| 93 | const terminateDelayTime = 2000; | 94 | const terminateDelayTime = 2000; |
| 94 | setTimeout(()=> { | 95 | setTimeout(()=> { |
| 95 | LogUtils.info(ServiceExtAbility.TAG, 'stopSelf'); | 96 | LogUtils.info(ServiceExtAbility.TAG, 'stopSelf'); |
| 96 | - this.context?.terminateSelf().catch((err) => { | 97 | + this.context?.terminateSelf().catch((err: BusinessError) => { |
| 97 | LogUtils.error(ServiceExtAbility.TAG, 'stopSelf err is ' + JSON.stringify(err)); | 98 | LogUtils.error(ServiceExtAbility.TAG, 'stopSelf err is ' + JSON.stringify(err)); |
| 98 | }); | 99 | }); |
| 99 | }, terminateDelayTime); | 100 | }, terminateDelayTime); |
Rproduct/oh/base/src/main/ets/ServiceExtAbility/serviceStub.ts→product/oh/base/src/main/ets/ServiceExtAbility/serviceStub.ets+1-1
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | import rpc from '@ohos.rpc'; | 16 | import rpc from '@ohos.rpc'; |
| 17 | import update from '@ohos.update'; | 17 | import update from '@ohos.update'; |
| 18 | -import { LogUtils } from '@ohos/common'; | 18 | +import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * ServiceExtAbility 远端代理存根 | 21 | * ServiceExtAbility 远端代理存根 |
| @@ -18,10 +18,10 @@ import { UpgradeCallResult } from '@ohos/common/src/main/ets/const/update_const' | |||
| 18 | import { TitleBar } from '@ohos/common/src/main/ets/component/TitleBar'; | 18 | import { TitleBar } from '@ohos/common/src/main/ets/component/TitleBar'; |
| 19 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 19 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 20 | import { VersionPageInfo } from '@ohos/common/src/main/ets/manager/UpgradeInterface'; | 20 | import { VersionPageInfo } from '@ohos/common/src/main/ets/manager/UpgradeInterface'; |
| 21 | -import { UpgradeAdapter } from '@ohos/ota/src/main/ets/UpgradeAdapter'; | 21 | +import { UpgradeAdapter } from 'ota/src/main/ets/UpgradeAdapter'; |
| 22 | -import { ChangelogContent } from '@ohos/ota/src/main/ets/components/ChangelogContent'; | 22 | +import { ChangelogContent } from 'ota/src/main/ets/components/ChangelogContent'; |
| 23 | -import { OtaUpdateManager } from '@ohos/ota/src/main/ets/manager/OtaUpdateManager'; | 23 | +import { OtaUpdateManager } from 'ota/src/main/ets/manager/OtaUpdateManager'; |
| 24 | -import { VersionUtils } from '@ohos/ota/src/main/ets/util/VersionUtils'; | 24 | +import { VersionUtils } from 'ota/src/main/ets/util/VersionUtils'; |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 当前版本页面 | 27 | * 当前版本页面 |
| @@ -32,7 +32,7 @@ import { VersionUtils } from '@ohos/ota/src/main/ets/util/VersionUtils'; | |||
| 32 | @Component | 32 | @Component |
| 33 | struct CurrentVersion { | 33 | struct CurrentVersion { |
| 34 | 34 | ||
| 35 | - @State private versionArray: Array<VersionPageInfo> = null; | 35 | + @State private versionArray: Array<VersionPageInfo> | null = null; |
| 36 | 36 | ||
| 37 | aboutToAppear() { | 37 | aboutToAppear() { |
| 38 | globalThis.currentVersionThis = this; | 38 | globalThis.currentVersionThis = this; |
| @@ -50,10 +50,11 @@ struct CurrentVersion { | |||
| 50 | return; | 50 | return; |
| 51 | } | 51 | } |
| 52 | let components: update.VersionComponent[] = VersionUtils.sortComponents( | 52 | let components: update.VersionComponent[] = VersionUtils.sortComponents( |
| 53 | - upgradeData.data?.versionComponents); | 53 | + upgradeData.data?.versionComponents) ?? []; |
| 54 | this.versionArray = components.map((component: update.VersionComponent) => { | 54 | this.versionArray = components.map((component: update.VersionComponent) => { |
| 55 | return UpgradeAdapter.getInstance() | 55 | return UpgradeAdapter.getInstance() |
| 56 | - .getPageInstance()?.getCurrentVersionPageInfo(components, componentDescription?.data); | 56 | + .getPageInstance()?.getCurrentVersionPageInfo(components, componentDescription?.data as |
| 57 | + update.ComponentDescription[]); | ||
| 57 | }).filter((versionPageInfo: VersionPageInfo) => { | 58 | }).filter((versionPageInfo: VersionPageInfo) => { |
| 58 | return versionPageInfo != null; | 59 | return versionPageInfo != null; |
| 59 | }); | 60 | }); |
| @@ -104,16 +105,16 @@ struct CurrentVersion { | |||
| 104 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 105 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 105 | .fontWeight(FontWeight.Medium) | 106 | .fontWeight(FontWeight.Medium) |
| 106 | .width('100%') | 107 | .width('100%') |
| 107 | - .textAlign(this.versionArray.length > 1 ? TextAlign.Start : TextAlign.Center) | 108 | + .textAlign((this.versionArray && (this.versionArray.length > 1)) ? TextAlign.Start : TextAlign.Center) |
| 108 | .padding({ | 109 | .padding({ |
| 109 | right: $r('app.float.version_padding'), | 110 | right: $r('app.float.version_padding'), |
| 110 | left: $r('app.float.version_padding'), | 111 | left: $r('app.float.version_padding'), |
| 111 | - bottom: this.versionArray.length > 1 ? $r('app.float.current_version_name_margin_bottom') : | 112 | + bottom: (this.versionArray && (this.versionArray.length > 1)) ? $r('app.float.current_version_name_margin_bottom') : |
| 112 | $r('app.float.current_version_name_margin_bottom_single') | 113 | $r('app.float.current_version_name_margin_bottom_single') |
| 113 | }) | 114 | }) |
| 114 | ChangelogContent({ | 115 | ChangelogContent({ |
| 115 | isCurrentPage: true, | 116 | isCurrentPage: true, |
| 116 | - isNeedFold: this.versionArray?.length > 1, | 117 | + isNeedFold: (this.versionArray && (this.versionArray.length > 1)) ?? false, |
| 117 | description: JSON.stringify([pageInfo.changelog]) | 118 | description: JSON.stringify([pageInfo.changelog]) |
| 118 | }) | 119 | }) |
| 119 | }) | 120 | }) |
| @@ -27,11 +27,11 @@ import { HomeCardView } from '@ohos/common/src/main/ets/component/HomeCardView'; | |||
| 27 | import { CheckingDots } from '@ohos/common/src/main/ets/component/CheckingDots'; | 27 | import { CheckingDots } from '@ohos/common/src/main/ets/component/CheckingDots'; |
| 28 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | 28 | import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; |
| 29 | import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; | 29 | import { FormatUtils } from '@ohos/common/src/main/ets/util/FormatUtils'; |
| 30 | -import RouterUtils from '@ohos/ota/src/main/ets/util/RouterUtils'; | 30 | +import RouterUtils from 'ota/src/main/ets/util/RouterUtils'; |
| 31 | -import { VersionUtils } from '@ohos/ota/src/main/ets/util/VersionUtils'; | 31 | +import { VersionUtils } from 'ota/src/main/ets/util/VersionUtils'; |
| 32 | -import { OtaUpdateManager } from '@ohos/ota/src/main/ets/manager/OtaUpdateManager'; | 32 | +import { OtaUpdateManager } from 'ota/src/main/ets/manager/OtaUpdateManager'; |
| 33 | -import { StateManager, UpdateAction } from '@ohos/ota/src/main/ets/manager/StateManager'; | 33 | +import { StateManager, UpdateAction } from 'ota/src/main/ets/manager/StateManager'; |
| 34 | -import ToastUtils from '@ohos/ota/src/main/ets/util/ToastUtils'; | 34 | +import ToastUtils from 'ota/src/main/ets/util/ToastUtils'; |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | * 搜包的状态 | 37 | * 搜包的状态 |
| @@ -56,20 +56,20 @@ struct Index { | |||
| 56 | @State dotTextPlay: boolean = false; | 56 | @State dotTextPlay: boolean = false; |
| 57 | @State newVersionStatus: string = NewVersionStatus.NO_NEW_VERSION; | 57 | @State newVersionStatus: string = NewVersionStatus.NO_NEW_VERSION; |
| 58 | @StorageProp('updateStatus') | 58 | @StorageProp('updateStatus') |
| 59 | - private updateStatus: number = AppStorage.Get('updateStatus'); | 59 | + private updateStatus: number = AppStorage.Get('updateStatus') as number; |
| 60 | private displayVersion: string = VersionUtils.getDisplayVersionForIndex(); | 60 | private displayVersion: string = VersionUtils.getDisplayVersionForIndex(); |
| 61 | private videoController: VideoController = new VideoController(); | 61 | private videoController: VideoController = new VideoController(); |
| 62 | - private initUpdateStatus: number = OtaUpdateManager.getInstance().getUpdateState(); | 62 | + private initUpdateStatus: number | null | undefined = OtaUpdateManager.getInstance().getUpdateState(); |
| 63 | private actionCallBack: Array<() => void> = []; | 63 | private actionCallBack: Array<() => void> = []; |
| 64 | private checkTimes: number= 0; | 64 | private checkTimes: number= 0; |
| 65 | - private checkIntervalId: number; | 65 | + private checkIntervalId: number | null = null; |
| 66 | private checkLoopTimes: number = 0; | 66 | private checkLoopTimes: number = 0; |
| 67 | @State private buttonText: string = ''; | 67 | @State private buttonText: string = ''; |
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| 70 | * 是否已经有搜包结果 | 70 | * 是否已经有搜包结果 |
| 71 | */ | 71 | */ |
| 72 | - private checkEndStatus: NewVersionStatus = null; | 72 | + private checkEndStatus: NewVersionStatus | null = null; |
| 73 | 73 | ||
| 74 | /** | 74 | /** |
| 75 | * 用来控制视频显示或者隐藏,解决卡顿 | 75 | * 用来控制视频显示或者隐藏,解决卡顿 |
| @@ -94,6 +94,7 @@ struct Index { | |||
| 94 | RouterUtils.openNewVersionPage(); | 94 | RouterUtils.openNewVersionPage(); |
| 95 | }, 50); | 95 | }, 50); |
| 96 | } else if (this.checkEndStatus == NewVersionStatus.NO_NEW_VERSION) { | 96 | } else if (this.checkEndStatus == NewVersionStatus.NO_NEW_VERSION) { |
| 97 | + this.log('afterNewVersionFound no new version'); | ||
| 97 | this.newVersionStatus = NewVersionStatus.NO_NEW_VERSION; | 98 | this.newVersionStatus = NewVersionStatus.NO_NEW_VERSION; |
| 98 | this.newVersionActionText = $r('app.string.check_version_status_no_new'); | 99 | this.newVersionActionText = $r('app.string.check_version_status_no_new'); |
| 99 | } | 100 | } |
| @@ -101,7 +102,7 @@ struct Index { | |||
| 101 | return true; | 102 | return true; |
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | - private notifyNewVersionStatus(newVersionStatus): void { | 105 | + private notifyNewVersionStatus(newVersionStatus: NewVersionStatus): void { |
| 105 | this.log('perform updateNewVersionStatus:' + newVersionStatus); | 106 | this.log('perform updateNewVersionStatus:' + newVersionStatus); |
| 106 | this.checkEndStatus = newVersionStatus; // 延时更新 | 107 | this.checkEndStatus = newVersionStatus; // 延时更新 |
| 107 | if (newVersionStatus == NewVersionStatus.CHECKING) { | 108 | if (newVersionStatus == NewVersionStatus.CHECKING) { |
| @@ -119,7 +120,8 @@ struct Index { | |||
| 119 | this.checkLoopTimes = 0; | 120 | this.checkLoopTimes = 0; |
| 120 | this.notifyNewVersionStatus(NewVersionStatus.CHECKING); | 121 | this.notifyNewVersionStatus(NewVersionStatus.CHECKING); |
| 121 | let upgradeData: UpgradeData<OtaStatus> = await OtaUpdateManager.getInstance().getOtaStatus(); | 122 | let upgradeData: UpgradeData<OtaStatus> = await OtaUpdateManager.getInstance().getOtaStatus(); |
| 122 | - let otaStatus: OtaStatus = upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; | 123 | + let otaStatus: OtaStatus | undefined | null = upgradeData.callResult == |
| 124 | + UpgradeCallResult.OK ? upgradeData.data : null; | ||
| 123 | this.initUpdateStatus = otaStatus?.status; | 125 | this.initUpdateStatus = otaStatus?.status; |
| 124 | if (StateManager.isAllowExecute(this.updateStatus, UpdateAction.CHECK_NEW_VERSION)) { | 126 | if (StateManager.isAllowExecute(this.updateStatus, UpdateAction.CHECK_NEW_VERSION)) { |
| 125 | this.performCheckNewVersion(); | 127 | this.performCheckNewVersion(); |
| @@ -152,7 +154,7 @@ struct Index { | |||
| 152 | return; | 154 | return; |
| 153 | } | 155 | } |
| 154 | } | 156 | } |
| 155 | - let errorCode: ErrorCode = upgradeData.error?.data?.[0]?.errorCode; | 157 | + let errorCode: ErrorCode | undefined = upgradeData.error?.data?.[0]?.errorCode; |
| 156 | if (errorCode == ErrorCode.CHECK_SYSTEM_BUSY) { | 158 | if (errorCode == ErrorCode.CHECK_SYSTEM_BUSY) { |
| 157 | setTimeout(() => { | 159 | setTimeout(() => { |
| 158 | if (this.checkLoopTimes >= UpdateConstant.CHECKING_RETRY_TIME) { | 160 | if (this.checkLoopTimes >= UpdateConstant.CHECKING_RETRY_TIME) { |
| @@ -167,7 +169,7 @@ struct Index { | |||
| 167 | 169 | ||
| 168 | if (errorCode == ErrorCode.CHECK_NETWORK_ERR) { | 170 | if (errorCode == ErrorCode.CHECK_NETWORK_ERR) { |
| 169 | this.actionCallBack.push(async () => { | 171 | this.actionCallBack.push(async () => { |
| 170 | - let message = await globalThis.abilityContext.resourceManager.getString($r('app.string.network_err_toast').id); | 172 | + let message: string = await globalThis.abilityContext.resourceManager.getString($r('app.string.network_err_toast').id); |
| 171 | ToastUtils.showToast(message); | 173 | ToastUtils.showToast(message); |
| 172 | }) | 174 | }) |
| 173 | } | 175 | } |
| @@ -247,9 +249,9 @@ struct Index { | |||
| 247 | } | 249 | } |
| 248 | let currentStatus = OtaUpdateManager.getInstance().getUpdateState(); | 250 | let currentStatus = OtaUpdateManager.getInstance().getUpdateState(); |
| 249 | this.log(`checkNewVersion, currentStatus = ${currentStatus} `); | 251 | this.log(`checkNewVersion, currentStatus = ${currentStatus} `); |
| 250 | - if (this.initUpdateStatus != currentStatus) { | 252 | + if (this.initUpdateStatus != currentStatus && currentStatus !== null) { |
| 251 | const checkedStatus = [UpdateState.INIT, UpdateState.UPGRADE_FAILED, UpdateState.UPGRADE_SUCCESS]; | 253 | const checkedStatus = [UpdateState.INIT, UpdateState.UPGRADE_FAILED, UpdateState.UPGRADE_SUCCESS]; |
| 252 | - return currentStatus in checkedStatus; | 254 | + return checkedStatus.includes(currentStatus); |
| 253 | } | 255 | } |
| 254 | return false; | 256 | return false; |
| 255 | } | 257 | } |
| @@ -263,9 +265,10 @@ struct Index { | |||
| 263 | Column() { | 265 | Column() { |
| 264 | Scroll() { | 266 | Scroll() { |
| 265 | Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { | 267 | Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { |
| 266 | - HomeCardView({ playVideo: this.displayVideo, videoController: this.videoController, onVideoFinished: () => { | 268 | + HomeCardView({ playVideo: this.displayVideo, videoController: this.videoController, onVideoFinished: |
| 269 | + (): boolean => { | ||
| 267 | this.checkTimes++; | 270 | this.checkTimes++; |
| 268 | - return this.onCheckAction.call(this); | 271 | + return this.onCheckAction.bind(this)(); |
| 269 | } }) | 272 | } }) |
| 270 | Text(this.displayVersion) | 273 | Text(this.displayVersion) |
| 271 | .fontSize($r('app.float.home_text_size_version_name')) | 274 | .fontSize($r('app.float.home_text_size_version_name')) |
| @@ -1,4 +1,3 @@ | |||
| 1 | -import { DialogUtils } from '../../../../../../../feature/ota/src/main/ets/dialog/DialogUtils'; | ||
| 2 | /* | 1 | /* |
| 3 | * Copyright (c) 2023 Huawei Device Co., Ltd. | 2 | * Copyright (c) 2023 Huawei Device Co., Ltd. |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| @@ -19,7 +18,8 @@ import { | |||
| 19 | OtaStatus, | 18 | OtaStatus, |
| 20 | UpdateState, | 19 | UpdateState, |
| 21 | UpgradeCallResult, | 20 | UpgradeCallResult, |
| 22 | - UpgradeData | 21 | + UpgradeData, |
| 22 | + BusinessError | ||
| 23 | } from '@ohos/common/src/main/ets/const/update_const'; | 23 | } from '@ohos/common/src/main/ets/const/update_const'; |
| 24 | import update from '@ohos.update'; | 24 | import update from '@ohos.update'; |
| 25 | import { TitleBar } from '@ohos/common/src/main/ets/component/TitleBar'; | 25 | import { TitleBar } from '@ohos/common/src/main/ets/component/TitleBar'; |
| @@ -28,18 +28,17 @@ import { LogUtils } from '@ohos/common/src/main/ets/util/LogUtils'; | |||
| 28 | import { DeviceUtils } from '@ohos/common/src/main/ets/util/DeviceUtils'; | 28 | import { DeviceUtils } from '@ohos/common/src/main/ets/util/DeviceUtils'; |
| 29 | import { ChangelogInfo, IPage, VersionPageInfo } from '@ohos/common/src/main/ets/manager/UpgradeInterface'; | 29 | import { ChangelogInfo, IPage, VersionPageInfo } from '@ohos/common/src/main/ets/manager/UpgradeInterface'; |
| 30 | import { NetUtils } from '@ohos/common/src/main/ets/util/NetUtils'; | 30 | import { NetUtils } from '@ohos/common/src/main/ets/util/NetUtils'; |
| 31 | -import { DialogHelper } from '@ohos/ota/src/main/ets/dialog/DialogHelper'; | 31 | +import { DialogUtils } from 'ota/src/main/ets/dialog/DialogUtils'; |
| 32 | -import { ChangelogContent } from '@ohos/ota/src/main/ets/components/ChangelogContent'; | 32 | +import { DialogHelper } from 'ota/src/main/ets/dialog/DialogHelper'; |
| 33 | -import { ProgressContent } from '@ohos/ota/src/main/ets/components/ProgressContent'; | 33 | +import { ChangelogContent } from 'ota/src/main/ets/components/ChangelogContent'; |
| 34 | -import { OtaUpdateManager } from '@ohos/ota/src/main/ets/manager/OtaUpdateManager'; | 34 | +import { ProgressContent } from 'ota/src/main/ets/components/ProgressContent'; |
| 35 | -import { CountDownInstallDialogBuilder } from '@ohos/ota/src/main/ets/dialog/CountDownInstallDialogBuilder'; | 35 | +import { OtaUpdateManager } from 'ota/src/main/ets/manager/OtaUpdateManager'; |
| 36 | -import { MessageDialogBuilder, } from '@ohos/ota/src/main/ets/dialog/MessageDialogBuilder'; | 36 | +import { CountDownInstallDialogBuilder } from 'ota/src/main/ets/dialog/CountDownInstallDialogBuilder'; |
| 37 | -import { StateManager, UpdateAction } from '@ohos/ota/src/main/ets/manager/StateManager'; | 37 | +import { MessageDialogBuilder, } from 'ota/src/main/ets/dialog/MessageDialogBuilder'; |
| 38 | -import { UpgradeAdapter } from '@ohos/ota/src/main/ets/UpgradeAdapter'; | 38 | +import { StateManager, UpdateAction } from 'ota/src/main/ets/manager/StateManager'; |
| 39 | -import { VersionUtils } from '@ohos/ota/src/main/ets/util/VersionUtils'; | 39 | +import { UpgradeAdapter } from 'ota/src/main/ets/UpgradeAdapter'; |
| 40 | -import { NotificationHelper } from '@ohos/ota/src/main/ets/notify/NotificationHelper'; | 40 | +import { VersionUtils } from 'ota/src/main/ets/util/VersionUtils'; |
| 41 | -import prompt from '@ohos.prompt'; | 41 | +import { NotificationHelper } from 'ota/src/main/ets/notify/NotificationHelper'; |
| 42 | -import RouterUtils from '@ohos/ota/src/main/ets/util/RouterUtils'; | ||
| 43 | 42 | ||
| 44 | /** | 43 | /** |
| 45 | * 新版本页面 | 44 | * 新版本页面 |
| @@ -56,17 +55,17 @@ struct NewVersion { | |||
| 56 | @State private isButtonEnable: boolean = true; | 55 | @State private isButtonEnable: boolean = true; |
| 57 | @State private isButtonVisible: boolean = true; | 56 | @State private isButtonVisible: boolean = true; |
| 58 | @StorageProp('updateStatus') | 57 | @StorageProp('updateStatus') |
| 59 | - @Watch('initDataByStatus') private updateStatus: number = AppStorage.Get('updateStatus'); | 58 | + @Watch('initDataByStatus') private updateStatus: number = AppStorage.Get('updateStatus') as number; |
| 60 | @StorageProp('isClickInstall') @Watch('onInstallClick') | 59 | @StorageProp('isClickInstall') @Watch('onInstallClick') |
| 61 | - private isClickInstall: number = AppStorage.Get('isClickInstall'); | 60 | + private isClickInstall: number = AppStorage.Get('isClickInstall') as number; |
| 62 | - private dialogText: string | Resource = ''; | 61 | + private dialogText: string | Resource | undefined = ''; |
| 63 | @State private isInitComplete: boolean = false; | 62 | @State private isInitComplete: boolean = false; |
| 64 | - private effectiveMode: update.EffectiveMode = update.EffectiveMode.COLD; | 63 | + private effectiveMode: update.EffectiveMode | undefined = update.EffectiveMode.COLD; |
| 65 | - @State otaMode: update.OtaMode = update.OtaMode.AB_STREAM_OTA; | 64 | + @State otaMode: update.OtaMode | undefined = update.OtaMode.AB_STREAM_OTA; |
| 66 | - private dialogType: CountDownDialogType = CountDownDialogType.OTA; | 65 | + private dialogType: CountDownDialogType | undefined = CountDownDialogType.OTA; |
| 67 | @State private buttonText: string = ''; | 66 | @State private buttonText: string = ''; |
| 68 | @StorageProp('installStatusRefresh') @Watch('refresh') | 67 | @StorageProp('installStatusRefresh') @Watch('refresh') |
| 69 | - private installStatusRefresh: string = AppStorage.Get('installStatusRefresh'); | 68 | + private installStatusRefresh: string = AppStorage.Get('installStatusRefresh') as string; |
| 70 | 69 | ||
| 71 | private countdownDialogController = new CustomDialogController({ | 70 | private countdownDialogController = new CustomDialogController({ |
| 72 | builder: CountDownInstallDialogBuilder({ | 71 | builder: CountDownInstallDialogBuilder({ |
| @@ -122,7 +121,8 @@ struct NewVersion { | |||
| 122 | 121 | ||
| 123 | private async handleAbnormalState(): Promise<void> { | 122 | private async handleAbnormalState(): Promise<void> { |
| 124 | let upgradeData: UpgradeData<OtaStatus> = await OtaUpdateManager.getInstance().getOtaStatus(); | 123 | let upgradeData: UpgradeData<OtaStatus> = await OtaUpdateManager.getInstance().getOtaStatus(); |
| 125 | - let otaStatus: OtaStatus = upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; | 124 | + let otaStatus: OtaStatus | null | undefined = upgradeData.callResult == |
| 125 | + UpgradeCallResult.OK ? upgradeData.data : null; | ||
| 126 | let state = otaStatus?.status; | 126 | let state = otaStatus?.status; |
| 127 | if (!state || state === UpdateState.INIT || state === UpdateState.UPGRADE_SUCCESS || | 127 | if (!state || state === UpdateState.INIT || state === UpdateState.UPGRADE_SUCCESS || |
| 128 | state === UpdateState.UPGRADE_FAILED || state === UpdateState.INSTALL_FAILED) { | 128 | state === UpdateState.UPGRADE_FAILED || state === UpdateState.INSTALL_FAILED) { |
| @@ -135,7 +135,7 @@ struct NewVersion { | |||
| 135 | this.log('onPageHide NewVersionPage'); | 135 | this.log('onPageHide NewVersionPage'); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | - onBackPress() { | 138 | + onBackPress(): boolean { |
| 139 | return globalThis.displayCountdownDialog; | 139 | return globalThis.displayCountdownDialog; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| @@ -187,7 +187,8 @@ struct NewVersion { | |||
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | public async initNewVersionPageInfo(): Promise<void> { | 189 | public async initNewVersionPageInfo(): Promise<void> { |
| 190 | - let newVersionInfo = globalThis.cachedNewVersionInfo || await OtaUpdateManager.getInstance().getNewVersion() | 190 | + let newVersionInfo: update.NewVersionInfo = globalThis.cachedNewVersionInfo || |
| 191 | + await OtaUpdateManager.getInstance().getNewVersion() | ||
| 191 | .then(upgradeData => { | 192 | .then(upgradeData => { |
| 192 | this.log(`initDataByStatus upgradeData: ${upgradeData}`); | 193 | this.log(`initDataByStatus upgradeData: ${upgradeData}`); |
| 193 | return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; | 194 | return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; |
| @@ -196,7 +197,8 @@ struct NewVersion { | |||
| 196 | if (!newVersionInfo) { | 197 | if (!newVersionInfo) { |
| 197 | return; | 198 | return; |
| 198 | } | 199 | } |
| 199 | - let components: update.VersionComponent[] = VersionUtils.sortComponents(newVersionInfo?.versionComponents); | 200 | + let components: update.VersionComponent[] = VersionUtils.sortComponents(newVersionInfo?.versionComponents) ?? [] as |
| 201 | + update.VersionComponent[]; | ||
| 200 | let pageInfo: VersionPageInfo = await UpgradeAdapter.getInstance() | 202 | let pageInfo: VersionPageInfo = await UpgradeAdapter.getInstance() |
| 201 | .getPageInstance()?.getNewVersionPageInfo(components); | 203 | .getPageInstance()?.getNewVersionPageInfo(components); |
| 202 | this.displayNewVersionName = pageInfo?.version; | 204 | this.displayNewVersionName = pageInfo?.version; |
| @@ -213,7 +215,7 @@ struct NewVersion { | |||
| 213 | continue; | 215 | continue; |
| 214 | } | 216 | } |
| 215 | let versionPageInfo: VersionPageInfo = await page.getNewVersionPageInfo(components, componentDescription.data); | 217 | let versionPageInfo: VersionPageInfo = await page.getNewVersionPageInfo(components, componentDescription.data); |
| 216 | - size += versionPageInfo.size; | 218 | + size += versionPageInfo.size ?? 0; |
| 217 | array.push(versionPageInfo.changelog); | 219 | array.push(versionPageInfo.changelog); |
| 218 | } | 220 | } |
| 219 | this.changelogArray = array; | 221 | this.changelogArray = array; |
| @@ -225,7 +227,7 @@ struct NewVersion { | |||
| 225 | this.log('upgrade effectiveMode ' + this.effectiveMode); | 227 | this.log('upgrade effectiveMode ' + this.effectiveMode); |
| 226 | this.isButtonEnable = false; | 228 | this.isButtonEnable = false; |
| 227 | let order = this.isABInstall() ? update.Order.INSTALL: update.Order.INSTALL_AND_APPLY | 229 | let order = this.isABInstall() ? update.Order.INSTALL: update.Order.INSTALL_AND_APPLY |
| 228 | - OtaUpdateManager.getInstance().upgrade(order).catch(err => { | 230 | + OtaUpdateManager.getInstance().upgrade(order).catch((err: BusinessError) => { |
| 229 | this.isButtonEnable = true; | 231 | this.isButtonEnable = true; |
| 230 | }); | 232 | }); |
| 231 | } | 233 | } |
| @@ -242,14 +244,7 @@ struct NewVersion { | |||
| 242 | switch (StateManager.getButtonClickAction(this.updateStatus)) { | 244 | switch (StateManager.getButtonClickAction(this.updateStatus)) { |
| 243 | case UpdateAction.DOWNLOAD: | 245 | case UpdateAction.DOWNLOAD: |
| 244 | if (await NetUtils.isCellularNetwork()) { | 246 | if (await NetUtils.isCellularNetwork()) { |
| 245 | - DialogHelper.displayNetworkDialog({ | 247 | + DialogHelper.displayNetworkDialog(); |
| 246 | - onConfirm: () => { | ||
| 247 | - if (this.isABStreamInstall()) { | ||
| 248 | - this.upgrade(); | ||
| 249 | - } else { | ||
| 250 | - OtaUpdateManager.getInstance().download(update.NetType.CELLULAR); | ||
| 251 | - } | ||
| 252 | - } }); | ||
| 253 | } else { | 248 | } else { |
| 254 | if (this.isABStreamInstall()) { | 249 | if (this.isABStreamInstall()) { |
| 255 | this.upgrade(); | 250 | this.upgrade(); |
| @@ -268,11 +263,11 @@ struct NewVersion { | |||
| 268 | OtaUpdateManager.getInstance().cancel(); | 263 | OtaUpdateManager.getInstance().cancel(); |
| 269 | break; | 264 | break; |
| 270 | case UpdateAction.RESUME: | 265 | case UpdateAction.RESUME: |
| 271 | - if (this.isABStreamInstall()) { | 266 | + if (this.isABStreamInstall()) { |
| 272 | - this.upgrade(); | 267 | + this.upgrade(); |
| 273 | - } else { | 268 | + } else { |
| 274 | - OtaUpdateManager.getInstance().resumeDownload(); | 269 | + OtaUpdateManager.getInstance().resumeDownload(); |
| 275 | - } | 270 | + } |
| 276 | break; | 271 | break; |
| 277 | default: | 272 | default: |
| 278 | break; | 273 | break; |
| @@ -368,7 +363,7 @@ struct NewVersion { | |||
| 368 | return; | 363 | return; |
| 369 | } | 364 | } |
| 370 | let otaStatus: OtaStatus = JSON.parse(this.installStatusRefresh); | 365 | let otaStatus: OtaStatus = JSON.parse(this.installStatusRefresh); |
| 371 | - let status: UpdateState = otaStatus?.status; | 366 | + let status: UpdateState | undefined = otaStatus?.status; |
| 372 | if (status === UpdateState.INSTALL_FAILED || status === UpdateState.UPGRADE_FAILED || | 367 | if (status === UpdateState.INSTALL_FAILED || status === UpdateState.UPGRADE_FAILED || |
| 373 | status === UpdateState.UPGRADE_SUCCESS) { | 368 | status === UpdateState.UPGRADE_SUCCESS) { |
| 374 | this.closeUpgradeDialog(); | 369 | this.closeUpgradeDialog(); |
| @@ -25,7 +25,7 @@ | |||
| 25 | "abilities": [ | 25 | "abilities": [ |
| 26 | { | 26 | { |
| 27 | "name": "com.ohos.updateapp.MainAbility", | 27 | "name": "com.ohos.updateapp.MainAbility", |
| 28 | - "srcEntrance": "./ets/MainAbility/MainAbility.ts", | 28 | + "srcEntry": "./ets/MainAbility/MainAbility.ets", |
| 29 | "description": "$string:description_mainability", | 29 | "description": "$string:description_mainability", |
| 30 | "icon": "$media:icon", | 30 | "icon": "$media:icon", |
| 31 | "label": "$string:entry_MainAbility", | 31 | "label": "$string:entry_MainAbility", |
| @@ -67,7 +67,7 @@ | |||
| 67 | "description": "service", | 67 | "description": "service", |
| 68 | "type": "service", | 68 | "type": "service", |
| 69 | "visible": true, | 69 | "visible": true, |
| 70 | - "srcEntrance": "./ets/ServiceExtAbility/service.ts" | 70 | + "srcEntrance": "./ets/ServiceExtAbility/service.ets" |
| 71 | } | 71 | } |
| 72 | ], | 72 | ], |
| 73 | "requestPermissions": [ | 73 | "requestPermissions": [ |
Binary files do not support preview
| @@ -0,0 +1,30 @@ | |||
| 1 | +-----BEGIN CERTIFICATE----- | ||
| 2 | +MIICTzCCAdSgAwIBAgIEYwNXYjAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO | ||
| 3 | +MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh | ||
| 4 | +bTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjIwODE2 | ||
| 5 | +MDc0MzA3WhcNMzIwODEzMDc0MzA3WjCBhDEUMBIGA1UEBhMLT3Blbkhhcm1vbnkx | ||
| 6 | +FDASBgNVBAgTC09wZW5IYXJtb255MRQwEgYDVQQHEwtPcGVuSGFybW9ueTEUMBIG | ||
| 7 | +A1UEChMLT3Blbkhhcm1vbnkxFDASBgNVBAsTC09wZW5IYXJtb255MRQwEgYDVQQD | ||
| 8 | +EwtPcGVuSGFybW9ueTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABBzAs/t08V25 | ||
| 9 | +R++hNASUYt6d+L4BFvUgwr5Vlgx8/6aEcn+2bIOPDELxZCrSEqbLmgQnnVbyfWyM | ||
| 10 | +EqzthZ171DGjUjBQMB8GA1UdIwQYMBaAFNuGtyIW1QuhS7fdJXu58QV9oi1HMA4G | ||
| 11 | +A1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUmjVkBLztXMS+PNot0eTSvBmUOUMwDAYI | ||
| 12 | +KoZIzj0EAwMFAANnADBkAjApyYyfJ+ePG6W531/T28NchhiPgPcAsvJny25qVZr6 | ||
| 13 | +ttyXib+adUdhax3Y1QPzkncCMEdDXrtFM7Nal4jrH36keUCaXNSvD4n674QN6baz | ||
| 14 | +7gdUkhXSRPPZk++r6XXiXlyTGg== | ||
| 15 | +-----END CERTIFICATE----- | ||
| 16 | +-----BEGIN CERTIFICATE----- | ||
| 17 | +MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO | ||
| 18 | +MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh | ||
| 19 | +bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y | ||
| 20 | +MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD | ||
| 21 | +VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG | ||
| 22 | +A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr | ||
| 23 | +gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26 | ||
| 24 | +uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf | ||
| 25 | ++OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G | ||
| 26 | +A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL | ||
| 27 | +oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf | ||
| 28 | +qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm | ||
| 29 | +Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg== | ||
| 30 | +-----END CERTIFICATE----- | ||
| @@ -0,0 +1 @@ | |||
| 1 | +àè38�cÞ | ||
Binary files do not support preview
| @@ -0,0 +1 @@ | |||
| 1 | +1?ÜÚŽs¼E펢»g | ||
| @@ -0,0 +1 @@ | |||
| 1 | +¨ox¤�'L—ôòMÉ7U‰á | ||
| @@ -0,0 +1 @@ | |||
| 1 | +vËM¿·Pgh¨€ �ÔS | ||