diff --git a/entry/oh-package-lock.json5 b/entry/oh-package-lock.json5 deleted file mode 100644 index 22f9d347866ad25369f3795f6e63fffe832878b5..0000000000000000000000000000000000000000 --- a/entry/oh-package-lock.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - "meta": { - "stableOrder": true - }, - "lockfileVersion": 3, - "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", - "specifiers": {}, - "packages": {} -} \ No newline at end of file diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 49b5887f6ce411f0683fe644076f672ffe65c642..fd09daa17b3c7ab80610d8a3ff8eb06b34fe7a8f 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -35,7 +35,11 @@ export default class EntryAbility extends UIAbility { GlobalContext.getContext().setObject('currentTime', want.parameters.currentTime); } } - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (e) { + hilog.error(0x000, 'progress', `setColorMode error ${JSON.stringify(e)}`); + } if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { if (want.parameters) { this.continueRestore(want); @@ -54,7 +58,11 @@ export default class EntryAbility extends UIAbility { GlobalContext.getContext().setObject('currentTime', want.parameters.currentTime); } } - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (e) { + hilog.error(0x000, 'progress', `setColorMode error ${JSON.stringify(e)}`); + } if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { if (want.parameters) { this.continueRestore(want); @@ -86,7 +94,11 @@ export default class EntryAbility extends UIAbility { want.parameters.scrollDistance && AppStorage.setOrCreate('scrollDistance', want.parameters.scrollDistance); want.parameters.breakpoint && AppStorage.setOrCreate('continueBreakpoint', want.parameters.breakpoint); - this.context.restoreWindowStage(new LocalStorage()); + try { + this.context.restoreWindowStage(new LocalStorage()); + } catch (e) { + hilog.error(0x000, 'progress', `restoreWindowStage error ${JSON.stringify(e)}`); + } } // [End continue_restore] @@ -182,25 +194,29 @@ export default class EntryAbility extends UIAbility { if (!this.uiContext) { return } - let mainWindow: window.WindowProperties = this.mainWindowClass!.getWindowProperties(); - let windowWidth: number = mainWindow.windowRect.width; - let windowWidthVp = this.uiContext.px2vp(windowWidth); - let widthBp: string = ''; - if (windowWidthVp < 320) { - widthBp = 'xs'; - } else if (windowWidthVp >= 320 && windowWidthVp < 600) { - widthBp = 'sm'; - } else if (windowWidthVp >= 600 && windowWidthVp < 840) { - widthBp = 'md'; - } else if (windowWidthVp >= 840 && windowWidthVp < 1440) { - widthBp = 'lg'; - } else { - widthBp = 'xl'; + try { + let mainWindow: window.WindowProperties = this.mainWindowClass!.getWindowProperties(); + let windowWidth: number = mainWindow.windowRect.width; + let windowWidthVp = this.uiContext.px2vp(windowWidth); + let widthBp: string = ''; + if (windowWidthVp < 320) { + widthBp = 'xs'; + } else if (windowWidthVp >= 320 && windowWidthVp < 600) { + widthBp = 'sm'; + } else if (windowWidthVp >= 600 && windowWidthVp < 840) { + widthBp = 'md'; + } else if (windowWidthVp >= 840 && windowWidthVp < 1440) { + widthBp = 'lg'; + } else { + widthBp = 'xl'; + } + AppStorage.setOrCreate(BreakpointConstants.BREAKPOINT_NAME, widthBp); + AppStorage.setOrCreate('windowWidth', windowWidth); + let windowHeight: number = mainWindow.windowRect.height; + AppStorage.setOrCreate('windowHeight', windowHeight); + } catch (e) { + hilog.error(0x000, 'progress', `getWindowProperties error ${JSON.stringify(e)}`); } - AppStorage.setOrCreate(BreakpointConstants.BREAKPOINT_NAME, widthBp); - AppStorage.setOrCreate('windowWidth', windowWidth); - let windowHeight: number = mainWindow.windowRect.height; - AppStorage.setOrCreate('windowHeight', windowHeight); } onWindowStageDestroy(): void { diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 188969829fa4f25e429b88bfd7df1a99d03db6a2..63189dadd0457968adade9e6bc51e1eb81cdabf8 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -14,6 +14,7 @@ */ import { window } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; import { EnvironmentCallback } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { i18n } from '@kit.LocalizationKit'; @@ -42,6 +43,8 @@ struct Index { let bottomHeight = bottomArea.bottomRect.height; let vpBottomHeight = this.getUIContext().px2vp(bottomHeight); AppStorage.setOrCreate('bottomHeight', vpBottomHeight); + }).catch((error: BusinessError) => { + hilog.error(0x000, 'progress', `getLastWindow error ${JSON.stringify(error)}`); }); let envCallback: EnvironmentCallback = { onConfigurationUpdated(config) { diff --git a/entry/src/main/ets/view/longlist/WaterFlowView.ets b/entry/src/main/ets/view/longlist/WaterFlowView.ets index de3fe6ccf2f22133317296b2250b5f18464490a9..ef9b605ecfff8b9dcd325cc7a969e1cc4474fb0a 100644 --- a/entry/src/main/ets/view/longlist/WaterFlowView.ets +++ b/entry/src/main/ets/view/longlist/WaterFlowView.ets @@ -84,15 +84,19 @@ export struct WaterFlowView { } updateWaterFlowItemWidth() { - let windowWidth: number = this.getUIContext().px2vp(display.getDefaultDisplaySync().width); - let columns = windowWidth > CommonConstants.CRITICAL_VALUE ? CommonConstants.WATER_FLOW_THREE_COLUMNS : - CommonConstants.WATER_FLOW_TWO_COLUMNS; - let marginLeft = windowWidth > CommonConstants.CRITICAL_VALUE ? - BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_MD : - BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_SM; - this.waterFlowItemWidth = - (this.getUIContext().px2vp(display.getDefaultDisplaySync().width) - marginLeft * 2 - - (columns - 1) * CommonConstants.WATER_FLOW_COLUMN_GAP) / columns; + try { + let windowWidth: number = this.getUIContext().px2vp(display.getDefaultDisplaySync().width); + let columns = windowWidth > CommonConstants.CRITICAL_VALUE ? CommonConstants.WATER_FLOW_THREE_COLUMNS : + CommonConstants.WATER_FLOW_TWO_COLUMNS; + let marginLeft = windowWidth > CommonConstants.CRITICAL_VALUE ? + BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_MD : + BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_SM; + this.waterFlowItemWidth = + (this.getUIContext().px2vp(display.getDefaultDisplaySync().width) - marginLeft * 2 - + (columns - 1) * CommonConstants.WATER_FLOW_COLUMN_GAP) / columns; + } catch (e) { + hilog.error(0x000, 'progress', `updateWaterFlowItemWidth error ${JSON.stringify(e)}`); + } } getTitleHeight(title: string) { @@ -113,7 +117,11 @@ export struct WaterFlowView { this.scroller.scrollTo({ xOffset: 0, yOffset: 0 }); this.waterFlowScroller.scrollToIndex(0); }; - display.on('foldDisplayModeChange', callback); + try { + display.on('foldDisplayModeChange', callback); + } catch (e) { + hilog.error(0x000, 'progress', `display.on error ${JSON.stringify(e)}`); + } } build() { diff --git a/entry/src/main/ets/view/video/ExitVideo.ets b/entry/src/main/ets/view/video/ExitVideo.ets index d8cc6681ae0beec93ba68c1343a4c8ca524400d1..3bcb19ad44c2a38d0b20ed3fd1a9ee514938b15e 100644 --- a/entry/src/main/ets/view/video/ExitVideo.ets +++ b/entry/src/main/ets/view/video/ExitVideo.ets @@ -16,6 +16,7 @@ import { common, Want } from '@kit.AbilityKit'; import { connection } from '@kit.NetworkKit'; import { promptAction } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; import avPlayManage from '../../viewmodel/video/AvPlayManager'; import { GlobalContext } from '../../utils/GlobalContext'; @@ -29,18 +30,27 @@ export struct ExitVideo { private videoList: Resource[] = [$r('app.string.video_res_1'), $r('app.string.video_res_2')]; async isInternet(): Promise { - if (connection.getAllNetsSync().length <= 0) { - this.toast(); + try { + if (connection.getAllNetsSync().length <= 0) { + this.toast(); + return false; + } + } catch (e) { + hilog.error(0x000, 'progress', `getAllNetsSync error ${JSON.stringify(e)}`); return false; } return true; } async toast() { - this.getUIContext().getPromptAction().showToast({ - message: $r('app.string.video_warn'), - duration: 2000, - }); + try { + this.getUIContext().getPromptAction().showToast({ + message: $r('app.string.video_warn'), + duration: 2000, + }); + } catch (e) { + hilog.error(0x000, 'progress', `showToast error ${JSON.stringify(e)}`); + } } @Builder @@ -103,9 +113,13 @@ export struct ExitVideo { AppStorage.setOrCreate('speedIndex', 0); AppStorage.setOrCreate('currentTime', 0); this.show = false; - let str: string = await (GlobalContext.getContext().getObject('context') as (common.UIAbilityContext)) - .resourceManager.getStringValue(this.videoList[this.videoSelect]); - this.avPlayManage.videoChoose(str); + try { + let str: string = await (GlobalContext.getContext().getObject('context') as (common.UIAbilityContext)) + .resourceManager.getStringValue(this.videoList[this.videoSelect].id); + this.avPlayManage.videoChoose(str); + } catch (e) { + hilog.error(0x000, 'progress', `getStringValue error ${JSON.stringify(e)}`); + } }) }, (index: number) => JSON.stringify(index)) } diff --git a/entry/src/main/ets/view/video/VideoPageComponent.ets b/entry/src/main/ets/view/video/VideoPageComponent.ets index af7d40e7539dd4ec24e2ae4ca03de0e410f1c68e..3c978695288fa144d61c83180501b61abc188394 100644 --- a/entry/src/main/ets/view/video/VideoPageComponent.ets +++ b/entry/src/main/ets/view/video/VideoPageComponent.ets @@ -107,12 +107,16 @@ struct VideoPageComponent { } aboutToAppear() { - this.windowWidth = display.getDefaultDisplaySync().width; - this.windowHeight = display.getDefaultDisplaySync().height; - this.surfaceW = (GlobalContext.getContext().getObject('windowWidth') as number) * SURFACEW; - this.surfaceH = this.surfaceW / SURFACEH; - this.flag = true; - AppStorage.setOrCreate('avPlayManage', this.avPlayManage); + try { + this.windowWidth = display.getDefaultDisplaySync().width; + this.windowHeight = display.getDefaultDisplaySync().height; + this.surfaceW = (GlobalContext.getContext().getObject('windowWidth') as number) * SURFACEW; + this.surfaceH = this.surfaceW / SURFACEH; + this.flag = true; + AppStorage.setOrCreate('avPlayManage', this.avPlayManage); + } catch (e) { + hilog.error(0x000, 'progress', `getDefaultDisplaySync error ${JSON.stringify(e)}`); + } } aboutToDisappear() { @@ -131,18 +135,27 @@ struct VideoPageComponent { } async isInternet(): Promise { - if (connection.getAllNetsSync().length <= 0) { - this.toast(); - return false + try { + if (connection.getAllNetsSync().length <= 0) { + this.toast(); + return false; + } + } catch (e) { + hilog.error(0x000, 'progress', `getAllNetsSync error ${JSON.stringify(e)}`); + return false; } return true; } async toast() { - this.getUIContext().getPromptAction().showToast({ - message: $r('app.string.video_warn'), - duration: 2000, - }); + try { + this.getUIContext().getPromptAction().showToast({ + message: $r('app.string.video_warn'), + duration: 2000, + }); + } catch (e) { + hilog.error(0x000, 'progress', `showToast error ${JSON.stringify(e)}`); + } } @Builder diff --git a/entry/src/main/ets/view/web/WebPageComponent.ets b/entry/src/main/ets/view/web/WebPageComponent.ets index 4a9df56d81f342f21091951d5b5a7246df259d66..619235538531ca9c340847b05708818d843e3c9c 100644 --- a/entry/src/main/ets/view/web/WebPageComponent.ets +++ b/entry/src/main/ets/view/web/WebPageComponent.ets @@ -51,9 +51,13 @@ struct WebPageComponent { }; watchPageUrl() { - if (this.continueRestore) { - this.controller.loadUrl(this.pageUrl); - this.continueRestore = false; + try { + if (this.continueRestore) { + this.controller.loadUrl(this.pageUrl); + this.continueRestore = false; + } + } catch (e) { + hilog.error(0x000, 'progress', `loadUrl error ${JSON.stringify(e)}`); } } @@ -61,6 +65,8 @@ struct WebPageComponent { this.getUIContext().getRouter().pushUrl({ url: 'pages/OrderConfirmPage', params: { statusBarHeight: this.statusBarHeight, sliderBarHeight: this.sliderBarHeight, detailStr } + }).catch((error: BusinessError) => { + hilog.error(0x000, 'progress', `pushUrl error ${JSON.stringify(error)}`); }); } @@ -70,13 +76,17 @@ struct WebPageComponent { md: 'javascript:document.getElementById("productList").style["column-count"] = 2', lg: 'javascript:document.getElementById("productList").style["column-count"] = 3' }).getValue(this.currentBreakpoint); - this.controller.runJavaScript(column); + this.controller.runJavaScript(column).catch((error: BusinessError) => { + hilog.error(0x000, 'progress', `runJavaScript error ${JSON.stringify(error)}`); + }); let columnGap = new BreakpointType({ sm: 'javascript:document.getElementById("productList").style["column-gap"] = 0px', md: 'javascript:document.getElementById("productList").style["column-gap"] = 20px', lg: 'javascript:document.getElementById("productList").style["column-gap"] = 40px' }).getValue(this.currentBreakpoint); - this.controller.runJavaScript(columnGap); + this.controller.runJavaScript(columnGap).catch((error: BusinessError) => { + hilog.error(0x000, 'progress', `runJavaScript error ${JSON.stringify(error)}`); + }); } build() { diff --git a/entry/src/main/ets/viewmodel/video/AvPlayManager.ets b/entry/src/main/ets/viewmodel/video/AvPlayManager.ets index ba8b74a49e2222fca8815a4db5552e9ea8dd5e79..ef4b54c9ef8eb0080f8ceada5e6613a449255dea 100644 --- a/entry/src/main/ets/viewmodel/video/AvPlayManager.ets +++ b/entry/src/main/ets/viewmodel/video/AvPlayManager.ets @@ -277,7 +277,11 @@ export default class AvPlayManage { if (this.avPlayer === null) { return; } - this.avPlayer.reset(); + try { + this.avPlayer.reset(); + } catch (e) { + hilog.error(0x000, 'progress', `reset error ${JSON.stringify(e)}`); + } } async videoRelease(): Promise {