diff --git a/common/src/main/ets/component/HomeCardView.ets b/common/src/main/ets/component/HomeCardView.ets index bdede9bbac6b6b102bad7761c176b2c495ccbb24..647d9ab77497dcc38f5bbc4f14c6c33d184e7dcc 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 fa333955c13b336b1441115205cad92c6872e313..059cf97f7dc7ead3b43f6b3cf386b04e41a25701 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 7be871381e2daeaf7032984f325c69b4590ffa72..78fb92573bd53bf52aca645f3a9271c5a09132eb 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 afde3675e392339f07e49d8a4eacaff684053d38..f03a21d3715c6bb435e7113b5d769d4740ca89d6 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 9e17edb70746d4c8d067e46c8167dd4534745371..ef71e1176aca20608677305b0cd151a8126f0f57 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 e3c0b99c8ba78fd115861e319556b5385279c8e0..ca465fcf09988af9e13b15ffa8a0b4c8a2ff84e1 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'); diff --git a/feature/ota/src/main/ets/dialog/DialogHelper.ets b/feature/ota/src/main/ets/dialog/DialogHelper.ets index 0043ebc6c582d5e9f930bb13d0f5ed5e50271a89..c67e0bd0a090af0ff616b628c763e2727607f769 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 a98abf07f8e54c76fe54687c52e0602ce6573dbe..0697c260fbfd32066021f580e6d642e7501036e4 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 0f232f1f742e7090051d4fddc8deb8ea921a70bf..d63d552a5f4a13a946c595d0f3b2f7eaef591190 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 93523412c83f35d1a04867291854c1e6b95191c3..b9cb303c54860a31ad7b3bb0e91520e5230fddbf 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 911876552e8416e8c7fe0caa85317bfde2f81683..789461d955c903c8123477a235972d11099e79ed 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 777b70245a8eb096112d54607f06d346a9475557..950d0539ccb08c8dce8708a33ce6f9b1d917343d 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();