From 400652cebe9fc545addf127484e171ed54138dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 4 Jun 2024 03:44:46 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9codex--beta1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../src/main/ets/component/HomeCardView.ets | 6 ++--- common/src/main/ets/component/TitleBar.ets | 2 +- common/src/main/ets/util/DeviceUtils.ets | 6 ++--- common/src/main/ets/util/UpdateUtils.ets | 5 ++-- .../main/ets/components/ChangelogContent.ets | 4 ++-- .../dialog/CountDownInstallDialogBuilder.ets | 5 ++-- .../ota/src/main/ets/dialog/DialogHelper.ets | 2 +- .../ota/src/main/ets/manager/StateManager.ets | 24 +++++++++---------- .../src/main/ets/util/ChangelogParseUtils.ets | 4 ++-- .../ota/src/main/ets/util/VersionUtils.ets | 2 +- .../src/main/ets/pages/currentVersion.ets | 2 +- .../oh/base/src/main/ets/pages/newVersion.ets | 20 ++++++++-------- 12 files changed, 42 insertions(+), 40 deletions(-) diff --git a/common/src/main/ets/component/HomeCardView.ets b/common/src/main/ets/component/HomeCardView.ets index bdede9b..647d9ab 100644 --- a/common/src/main/ets/component/HomeCardView.ets +++ b/common/src/main/ets/component/HomeCardView.ets @@ -22,7 +22,7 @@ import {DeviceUtils} from '../util/DeviceUtils' */ @Component export struct HomeCardView { - @Prop @Watch("onChange") + @Prop @Watch('onChange') private playVideo: boolean; private indexImage: number = 1; private indexVideo: number = 99; @@ -48,7 +48,7 @@ export struct HomeCardView { @Builder showLogoMedia(constraintSize) { Stack({ alignContent: Alignment.Center }) { Video({ - src: $r("app.media.video"), + src: $r('app.media.video'), previewUri: $r('app.media.video_bg'), controller: this.videoController }) @@ -75,7 +75,7 @@ export struct HomeCardView { .constraintSize(constraintSize) .clip(true) .borderRadius($r('app.float.card_border_radius')) - .width(constraintSize?.maxWidth ? "100%" : "67%") + .width(constraintSize?.maxWidth ? '100%' : '67%') } build() { diff --git a/common/src/main/ets/component/TitleBar.ets b/common/src/main/ets/component/TitleBar.ets index fa33395..059cf97 100644 --- a/common/src/main/ets/component/TitleBar.ets +++ b/common/src/main/ets/component/TitleBar.ets @@ -23,7 +23,7 @@ import { LogUtils } from '../util/LogUtils'; */ @Component export struct TitleBar { - private static readonly TAG = "TitleBar"; + private static readonly TAG = 'TitleBar'; private title: string | Resource; private onBack?: () => boolean; diff --git a/common/src/main/ets/util/DeviceUtils.ets b/common/src/main/ets/util/DeviceUtils.ets index 7be8713..78fb925 100644 --- a/common/src/main/ets/util/DeviceUtils.ets +++ b/common/src/main/ets/util/DeviceUtils.ets @@ -47,10 +47,10 @@ export namespace DeviceUtils { */ export function getSystemLanguage(): string { let language = i18n.getSystemLanguage(); - if (language == "zh-Hans") { - language = "zh-cn"; + if (language == 'zh-Hans') { + language = 'zh-cn'; } else { - language = "en-us"; + language = 'en-us'; } return language; } diff --git a/common/src/main/ets/util/UpdateUtils.ets b/common/src/main/ets/util/UpdateUtils.ets index afde367..77c958b 100644 --- a/common/src/main/ets/util/UpdateUtils.ets +++ b/common/src/main/ets/util/UpdateUtils.ets @@ -34,11 +34,12 @@ export namespace UpdateUtils { * @param componentId 组件id * @return changelog */ - export function obtainDescription(componentDescriptions: Array, componentId: string): string { + export function obtainDescription(componentDescriptions: Array, + componentId: string): string { if (!componentDescriptions || componentId == null) { return ''; } - let descArray: Array = >componentDescriptions; + let descArray: update.ComponentDescription[] = componentDescriptions; for (let index = 0; index < descArray.length; index++) { if (componentId === descArray[index]?.componentId) { let description = descArray[index]?.descriptionInfo?.content; diff --git a/feature/ota/src/main/ets/components/ChangelogContent.ets b/feature/ota/src/main/ets/components/ChangelogContent.ets index 9e17edb..ef71e11 100644 --- a/feature/ota/src/main/ets/components/ChangelogContent.ets +++ b/feature/ota/src/main/ets/components/ChangelogContent.ets @@ -95,7 +95,7 @@ export struct ChangelogContent { private parseChangelog(): void { this.logInfo('parseChangelog'); - let list: Array = null; + let list: ChangelogInfo[] = null; if (this.description) { list = JSON.parse(this.description); } @@ -134,7 +134,7 @@ export struct ChangelogContent { } private getContentFeatures(changelog: Changelog, language: string): Array { - let featuresList: Array = []; + let featuresList: Features[] = []; if (changelog == null || language == null) { return featuresList; } diff --git a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets index e3c0b99..8d025dd 100644 --- a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets +++ b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets @@ -94,7 +94,7 @@ export struct CountDownInstallDialogBuilder { } private initButtonText(): void { - this.cancelBtnText = FormatUtils.toUpperCase(globalThis.abilityContext, $r("app.string.later")); + this.cancelBtnText = FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.later')); let confirmBtnRes = null; if (this.dialogType == CountDownDialogType.OTA) { confirmBtnRes = $r('app.string.install_now'); @@ -104,7 +104,8 @@ export struct CountDownInstallDialogBuilder { this.confirmBtnText = FormatUtils.toUpperCase(globalThis.abilityContext, confirmBtnRes, this.count); } - @Styles buttonStyles() { + @Styles + buttonStyles() { .onClick(() => { this.controller.close(); if (this.intervalID != null) { diff --git a/feature/ota/src/main/ets/dialog/DialogHelper.ets b/feature/ota/src/main/ets/dialog/DialogHelper.ets index 0043ebc..c67e0bd 100644 --- a/feature/ota/src/main/ets/dialog/DialogHelper.ets +++ b/feature/ota/src/main/ets/dialog/DialogHelper.ets @@ -71,7 +71,7 @@ export namespace DialogHelper { }, alignment: DeviceUtils.getDialogLocation(), offset: ({ - dx: "0vp", + dx: '0vp', dy: DeviceUtils.getDialogOffsetY() }), autoCancel: false diff --git a/feature/ota/src/main/ets/manager/StateManager.ets b/feature/ota/src/main/ets/manager/StateManager.ets index a98abf0..0697c26 100644 --- a/feature/ota/src/main/ets/manager/StateManager.ets +++ b/feature/ota/src/main/ets/manager/StateManager.ets @@ -193,42 +193,42 @@ export class BaseState { /** * 状态对象 */ - otaStatus: OtaStatus; + public otaStatus: OtaStatus; /** * 进度 */ - percent: number = 0; + public percent: number = 0; /** * 状态 */ - state: number = UpdateState.INIT; + public state: number = UpdateState.INIT; /** * 升级行为 */ - actionSet: Array = []; + public actionSet: Array = []; /** * 下载状态描述 */ - downloadStateText: string | Resource = ""; + public downloadStateText: string | Resource = ''; /** * 下载安装文字描述 */ - buttonText: string | Resource = $r('app.string.btn_download'); + public buttonText: string | Resource = $r('app.string.btn_download'); /** * 按钮是否可点击 */ - isButtonClickable: boolean = true; + public isButtonClickable: boolean = true; /** * 按钮对应的升级行为 */ - buttonClickAction: UpdateAction; + public buttonClickAction: UpdateAction; /** * 数据刷新 @@ -285,7 +285,7 @@ export class CheckSuccess extends BaseState { await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); switch (this.otaStatus.endReason) { case ErrorCode.NETWORK_ERROR: - let message = await context.resourceManager.getString($r("app.string.network_err_toast").id); + let message = await context.resourceManager.getString($r('app.string.network_err_toast').id); ToastUtils.showToast(message); break; case ErrorCode.NO_ENOUGH_MEMORY: @@ -355,7 +355,7 @@ export class DownloadPause extends BaseState { if (eventId == update.EventId.EVENT_DOWNLOAD_PAUSE) { DialogUtils.showDownloadNoNetworkDialog(context, this.otaStatus, eventId); } else { - let message = await context.resourceManager.getString($r("app.string.network_err_toast").id); + let message = await context.resourceManager.getString($r('app.string.network_err_toast').id); ToastUtils.showToast(message); } break; @@ -532,7 +532,7 @@ export class InstallFailed extends BaseState { DialogUtils.showUpgradeFailDialog(context, this.otaStatus); } else { let versionName = globalThis.lastVersionName; - LogUtils.log('StateManager', "InstallFailed versionName is " + versionName); + LogUtils.log('StateManager', 'InstallFailed versionName is ' + versionName); await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeFailed(versionName, context); } @@ -580,7 +580,7 @@ export class UpgradeSuccess extends BaseState { AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); let versionName = globalThis.lastVersionName; - LogUtils.log('StateManager', "UpgradeSuccess versionName is " + versionName); + LogUtils.log('StateManager', 'UpgradeSuccess versionName is ' + versionName); await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeSuccess(versionName, context); } } diff --git a/feature/ota/src/main/ets/util/ChangelogParseUtils.ets b/feature/ota/src/main/ets/util/ChangelogParseUtils.ets index 0f232f1..81e2320 100644 --- a/feature/ota/src/main/ets/util/ChangelogParseUtils.ets +++ b/feature/ota/src/main/ets/util/ChangelogParseUtils.ets @@ -75,7 +75,7 @@ namespace ChangelogParseUtils { function parseRoot(root: any): void { // 倒序解析,先解析Icon - let icons = new Object(); + let icons = {}; logInfo('root length ' + root['_elements'].length); for (let index = root['_elements'].length; index > 0; index--) { let element = root['_elements'][index - 1]; @@ -155,7 +155,7 @@ namespace ChangelogParseUtils { let typeString = featuresElement['_attributes']['type']; let id = featuresElement['_attributes']['id']; let featureElement = featuresElement['_elements']; - let featureList = new Array(); + let featureList[] = new Array(); features = { title: moduleString, id: id, diff --git a/feature/ota/src/main/ets/util/VersionUtils.ets b/feature/ota/src/main/ets/util/VersionUtils.ets index 9352341..b9cb303 100644 --- a/feature/ota/src/main/ets/util/VersionUtils.ets +++ b/feature/ota/src/main/ets/util/VersionUtils.ets @@ -123,7 +123,7 @@ export namespace VersionUtils { this.log(`isABInstall upgradeData: ${upgradeData}`); return upgradeData.callResult == UpgradeCallResult.OK ? upgradeData.data : null; }); - let components: Array = VersionUtils.sortComponents(newVersionInfo?.versionComponents); + let components: update.VersionComponent[] = VersionUtils.sortComponents(newVersionInfo?.versionComponents); let component: update.VersionComponent = components?.filter((component: update.VersionComponent) => { return component.componentType == update.ComponentType.OTA; })?.[0]; diff --git a/product/oh/base/src/main/ets/pages/currentVersion.ets b/product/oh/base/src/main/ets/pages/currentVersion.ets index 9118765..789461d 100644 --- a/product/oh/base/src/main/ets/pages/currentVersion.ets +++ b/product/oh/base/src/main/ets/pages/currentVersion.ets @@ -49,7 +49,7 @@ struct CurrentVersion { if (!upgradeData.data) { return; } - let components: Array = VersionUtils.sortComponents( + let components: update.VersionComponent[] = VersionUtils.sortComponents( upgradeData.data?.versionComponents); this.versionArray = components.map((component: update.VersionComponent) => { return UpgradeAdapter.getInstance() diff --git a/product/oh/base/src/main/ets/pages/newVersion.ets b/product/oh/base/src/main/ets/pages/newVersion.ets index 777b702..e14fff3 100644 --- a/product/oh/base/src/main/ets/pages/newVersion.ets +++ b/product/oh/base/src/main/ets/pages/newVersion.ets @@ -172,12 +172,12 @@ struct NewVersion { } let stateButtonText = StateManager.getButtonText(this.updateStatus); this.buttonText = FormatUtils.toUpperCase(globalThis.abilityContext, stateButtonText); - this.isButtonVisible = this.updateStatus !== UpdateState.INSTALLING - && this.updateStatus !== UpdateState.INSTALL_FAILED - && (this.isABInstall() || this.updateStatus !== UpdateState.INSTALL_SUCCESS) - && this.updateStatus !== UpdateState.UPGRADING - && this.updateStatus !== UpdateState.UPGRADE_FAILED - && this.updateStatus !== UpdateState.UPGRADE_SUCCESS; + this.isButtonVisible = this.updateStatus !== UpdateState.INSTALLING && + this.updateStatus !== UpdateState.INSTALL_FAILED && + (this.isABInstall() || this.updateStatus !== UpdateState.INSTALL_SUCCESS) && + this.updateStatus !== UpdateState.UPGRADING && + this.updateStatus !== UpdateState.UPGRADE_FAILED && + this.updateStatus !== UpdateState.UPGRADE_SUCCESS; } public async initNewVersionPageInfo(): Promise { @@ -190,7 +190,7 @@ struct NewVersion { if (!newVersionInfo) { return; } - let components: Array = VersionUtils.sortComponents(newVersionInfo?.versionComponents); + let components: update.VersionComponent[] = VersionUtils.sortComponents(newVersionInfo?.versionComponents); let pageInfo: VersionPageInfo = await UpgradeAdapter.getInstance() .getPageInstance()?.getNewVersionPageInfo(components); this.displayNewVersionName = pageInfo?.version; @@ -198,7 +198,7 @@ struct NewVersion { this.dialogType = pageInfo?.countDownDialogInfo?.dialogType; this.effectiveMode = pageInfo?.effectiveMode; let size: number = 0; - let array :Array = []; + let array :ChangelogInfo[] = []; for (let index = 0; index < components?.length; index ++) { let page: IPage = UpgradeAdapter.getInstance().getPageInstance(); @@ -346,8 +346,8 @@ struct NewVersion { } let otaStatus: OtaStatus = JSON.parse(this.installStatusRefresh); let status: UpdateState = otaStatus?.status; - if (status === UpdateState.INSTALL_FAILED || status === UpdateState.UPGRADE_FAILED - || status === UpdateState.UPGRADE_SUCCESS) { + if (status === UpdateState.INSTALL_FAILED || status === UpdateState.UPGRADE_FAILED || + status === UpdateState.UPGRADE_SUCCESS) { this.closeUpgradeDialog(); } else if (status === UpdateState.UPGRADING) { this.restartDialogController.open(); -- Gitee From 52f4a34a1c3b87d5d9ded40dda5bbb2f23e642e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 4 Jun 2024 03:58:19 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9codex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets index 8d025dd..3690201 100644 --- a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets +++ b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets @@ -105,7 +105,8 @@ export struct CountDownInstallDialogBuilder { } @Styles - buttonStyles() { + buttonStyles() + { .onClick(() => { this.controller.close(); if (this.intervalID != null) { -- Gitee From 6300912762f625002afe7cb4e0600ce71be47713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 4 Jun 2024 06:39:15 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9codex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets index 3690201..2de03d1 100644 --- a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets +++ b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets @@ -105,8 +105,7 @@ export struct CountDownInstallDialogBuilder { } @Styles - buttonStyles() - { + buttonStyles(){ .onClick(() => { this.controller.close(); if (this.intervalID != null) { -- Gitee From e3c029feed7670c01713730e6c8c1f2a589875f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 4 Jun 2024 06:53:03 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9codex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets index 2de03d1..8d025dd 100644 --- a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets +++ b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets @@ -105,7 +105,7 @@ export struct CountDownInstallDialogBuilder { } @Styles - buttonStyles(){ + buttonStyles() { .onClick(() => { this.controller.close(); if (this.intervalID != null) { -- Gitee From 5216aa165b0aa83bf665efee8863393dfd2a9b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 4 Jun 2024 08:18:29 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9codex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- feature/ota/src/main/ets/util/ChangelogParseUtils.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/ota/src/main/ets/util/ChangelogParseUtils.ets b/feature/ota/src/main/ets/util/ChangelogParseUtils.ets index 81e2320..d63d552 100644 --- a/feature/ota/src/main/ets/util/ChangelogParseUtils.ets +++ b/feature/ota/src/main/ets/util/ChangelogParseUtils.ets @@ -155,7 +155,7 @@ namespace ChangelogParseUtils { let typeString = featuresElement['_attributes']['type']; let id = featuresElement['_attributes']['id']; let featureElement = featuresElement['_elements']; - let featureList[] = new Array(); + let featureList: Feature[] = []; features = { title: moduleString, id: id, -- Gitee From 651bc815636fb1c07aa19658425431d7e8d01882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 5 Jun 2024 02:42:50 +0000 Subject: [PATCH 6/6] codex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets index 8d025dd..ca465fc 100644 --- a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets +++ b/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets @@ -104,8 +104,7 @@ export struct CountDownInstallDialogBuilder { this.confirmBtnText = FormatUtils.toUpperCase(globalThis.abilityContext, confirmBtnRes, this.count); } - @Styles - buttonStyles() { + @Styles buttonStyles() { .onClick(() => { this.controller.close(); if (this.intervalID != null) { -- Gitee