From ea12a4957694e54ec30fce4e642ac1857b24aa6d Mon Sep 17 00:00:00 2001 From: 26thE <962961353@qq.com> Date: Thu, 24 Jul 2025 12:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/component/LockScreenComponent.ets | 4 ++-- .../src/main/ets/model/RouteDataModel.ets | 2 +- liveviewlockscreenlibrary/src/main/ets/utils/LiveView.ets | 6 +++--- .../src/main/ets/utils/LiveViewExtAbilityUtil.ets | 2 +- .../src/main/ets/utils/LiveViewUtil.ets | 2 +- .../src/main/ets/viewmodel/RouteDataViewModel.ets | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/liveviewlockscreenlibrary/src/main/ets/component/LockScreenComponent.ets b/liveviewlockscreenlibrary/src/main/ets/component/LockScreenComponent.ets index 2655cbc..04e2eca 100644 --- a/liveviewlockscreenlibrary/src/main/ets/component/LockScreenComponent.ets +++ b/liveviewlockscreenlibrary/src/main/ets/component/LockScreenComponent.ets @@ -22,11 +22,11 @@ import { RoadView } from '../view/RoadView'; export struct LockScreenComponent { @StorageLink(Constants.KEY_PREFIX + 'CurrentHeightBreakpoint') currentHeightBreakpoint: string = BreakpointTypeEnum.SM; - @StorageLink(Constants.KEY_PREFIX + 'LaneData') roadInfo: LaneData | undefined = undefined; + @StorageLink(Constants.KEY_PREFIX + 'LaneData') laneData: LaneData | undefined = undefined; build() { Stack({ alignContent: Alignment.Top }) { - RoadView({ laneNum: this.roadInfo?.laneNum }) + RoadView({ laneNum: this.laneData?.laneNum }) Image($rawfile('traffic_light.svg')) .objectFit(ImageFit.Contain) diff --git a/liveviewlockscreenlibrary/src/main/ets/model/RouteDataModel.ets b/liveviewlockscreenlibrary/src/main/ets/model/RouteDataModel.ets index 2f54168..cb4de32 100644 --- a/liveviewlockscreenlibrary/src/main/ets/model/RouteDataModel.ets +++ b/liveviewlockscreenlibrary/src/main/ets/model/RouteDataModel.ets @@ -19,7 +19,7 @@ export interface LaneData { export interface RouteData { // route information - roadInfo: LaneData, + laneData: LaneData, distance: number, roadName: Resource, } \ No newline at end of file diff --git a/liveviewlockscreenlibrary/src/main/ets/utils/LiveView.ets b/liveviewlockscreenlibrary/src/main/ets/utils/LiveView.ets index 488d507..30eb2ce 100644 --- a/liveviewlockscreenlibrary/src/main/ets/utils/LiveView.ets +++ b/liveviewlockscreenlibrary/src/main/ets/utils/LiveView.ets @@ -58,14 +58,14 @@ export class LiveView { hilog.info(0x0000, TAG, '%{public}s', 'Success to getRunningProcessInformation'); // Handle background state if (data[0].state === appManager.ProcessState.STATE_BACKGROUND) { - let routeInfo: RouteData = getRouteData(); - this.liveViewController.updateLiveView(routeInfo); + let routeData: RouteData = getRouteData(); + this.liveViewController.updateLiveView(routeData); // Prepare common event data let options: commonEventManager.CommonEventPublishData = { data: 'data', bundleName: AppStorage.get(Constants.KEY_PREFIX + 'BundleName'), parameters: { - 'roadData': routeInfo.roadInfo + 'laneData': routeData.laneData } }; // Publish system event for lock screen updates diff --git a/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewExtAbilityUtil.ets b/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewExtAbilityUtil.ets index 487fd04..d505105 100644 --- a/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewExtAbilityUtil.ets +++ b/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewExtAbilityUtil.ets @@ -89,7 +89,7 @@ export class LiveViewExtAbilityUtil { } hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in subscribe commonEvent success.'); if (data.parameters) { - let laneData = data.parameters['roadData'] as LaneData; + let laneData = data.parameters['laneData'] as LaneData; AppStorage.setOrCreate(Constants.KEY_PREFIX + 'LaneData', laneData); hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in receive commonEvent.'); } diff --git a/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewUtil.ets b/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewUtil.ets index d359743..20e7b98 100644 --- a/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewUtil.ets +++ b/liveviewlockscreenlibrary/src/main/ets/utils/LiveViewUtil.ets @@ -118,7 +118,7 @@ export class LiveViewUtil { liveView.liveViewData.primary.content = [{ text: this.getResourceStringSync(params.roadName) }]; liveView.liveViewData.primary.liveViewLockScreenAbilityName = 'LiveViewExtAbility'; liveView.liveViewData.primary.liveViewLockScreenAbilityParameters = { '': '' }; - if (params.roadInfo.laneNum === 1) { + if (params.laneData.laneNum === 1) { liveView.liveViewData.primary.layoutData = { layoutType: liveViewManager.LayoutType.LAYOUT_TYPE_NAVIGATION, currentNavigationIcon: 'turn_straight_light_rectangle.png', diff --git a/liveviewlockscreenlibrary/src/main/ets/viewmodel/RouteDataViewModel.ets b/liveviewlockscreenlibrary/src/main/ets/viewmodel/RouteDataViewModel.ets index 920ea8d..0233db1 100644 --- a/liveviewlockscreenlibrary/src/main/ets/viewmodel/RouteDataViewModel.ets +++ b/liveviewlockscreenlibrary/src/main/ets/viewmodel/RouteDataViewModel.ets @@ -16,7 +16,7 @@ import { RouteData } from '../model/RouteDataModel'; const LEFT_STATE: RouteData = { - roadInfo: { + laneData: { laneNum: 1 }, distance: 800, @@ -24,7 +24,7 @@ const LEFT_STATE: RouteData = { }; const RIGHT_STATE: RouteData = { - roadInfo: { + laneData: { laneNum: 2 }, distance: 800, -- Gitee