From c45acd45f20cf5606a1d51716f85e4e24aa6918b 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 01:02:27 +0000 Subject: [PATCH 1/3] =?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: 邹友松 --- .../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 | 2 +- .../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, 40 insertions(+), 39 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..f03a21d 100644 --- a/common/src/main/ets/util/UpdateUtils.ets +++ b/common/src/main/ets/util/UpdateUtils.ets @@ -38,7 +38,7 @@ export namespace UpdateUtils { 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..bbfd830 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..d63d552 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: Feature[] = []; 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..950d053 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 a72ba493dde7b13d33e851c3071aabe7eb2faf29 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 01:06:30 +0000 Subject: [PATCH 2/3] codex2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- feature/ota/src/main/ets/manager/StateManager.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/ota/src/main/ets/manager/StateManager.ets b/feature/ota/src/main/ets/manager/StateManager.ets index bbfd830..0697c26 100644 --- a/feature/ota/src/main/ets/manager/StateManager.ets +++ b/feature/ota/src/main/ets/manager/StateManager.ets @@ -213,7 +213,7 @@ export class BaseState { /** * 下载状态描述 */ - public downloadStateText: string | Resource = ""; + public downloadStateText: string | Resource = ''; /** * 下载安装文字描述 -- Gitee From 64e8e528694285e87add3410db753fa5b6d40c63 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:47:09 +0000 Subject: [PATCH 3/3] =?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 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