From a375fcea1c454814ef288bd878f53d7e93871431 Mon Sep 17 00:00:00 2001 From: lloyd <353627866@qq.com> Date: Thu, 11 Sep 2025 19:49:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E5=AE=9E=E7=8E=B0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=80=9A=E7=9F=A5=E8=A7=92=E6=A0=87=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=91=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 --- entry/src/main/ets/components/TitleBar.ets | 4 ++-- hvigor/hvigor-config.json5 | 2 +- .../main/ets/notification/WantAgentUtil.ets | 21 +++++++++++++++++-- oh-package.json5 | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/entry/src/main/ets/components/TitleBar.ets b/entry/src/main/ets/components/TitleBar.ets index 2c96ddf..f1d0175 100644 --- a/entry/src/main/ets/components/TitleBar.ets +++ b/entry/src/main/ets/components/TitleBar.ets @@ -16,7 +16,7 @@ // Page title bar @Component export struct TitleBar { - private title: string | Resource | undefined = undefined; + title: string | Resource | undefined = undefined; build() { Row() { @@ -25,7 +25,7 @@ export struct TitleBar { .fontWeight(700) .lineHeight(32) .margin({ left: 24 }) - .fontColor('#182431') + .fontColor($r('sys.color.font_primary')) } .width('100%') .height(70) diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index f70ecd4..a2a2e37 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { } } \ No newline at end of file diff --git a/notification/src/main/ets/notification/WantAgentUtil.ets b/notification/src/main/ets/notification/WantAgentUtil.ets index 4ad6f15..a0547f2 100644 --- a/notification/src/main/ets/notification/WantAgentUtil.ets +++ b/notification/src/main/ets/notification/WantAgentUtil.ets @@ -14,8 +14,11 @@ */ import { wantAgent } from '@kit.AbilityKit' +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; const REQUEST_CODE: number = 0 + class WantAgentUtil { /** * create wantAgent for start ability @@ -35,7 +38,14 @@ class WantAgentUtil { actionType: wantAgent.OperationType.START_ABILITY, requestCode: REQUEST_CODE } - return await wantAgent.getWantAgent(wantAgentInfo); + try { + let tmpWantAgent = await wantAgent.getWantAgent(wantAgentInfo); + return tmpWantAgent; + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'WantAgentUtil', `Failed to get wantAgent: code=${err.code}, message=${err.message}`); + throw error as Error; + } } /** @@ -50,7 +60,14 @@ class WantAgentUtil { actionType: wantAgent.OperationType.SEND_COMMON_EVENT, requestCode: REQUEST_CODE } - return await wantAgent.getWantAgent(wantAgentInfo); + try { + let tmpWantAgent = await wantAgent.getWantAgent(wantAgentInfo); + return tmpWantAgent; + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'WantAgentUtil', `Failed to get wantAgent: %{public}s`, err.message); + throw error as Error; + } } } diff --git a/oh-package.json5 b/oh-package.json5 index 58c3928..74a6afb 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "license": "", "devDependencies": { }, -- Gitee From 1266bcf5213cec1f9249460c14d043214e7f9f4d Mon Sep 17 00:00:00 2001 From: lloyd <353627866@qq.com> Date: Thu, 11 Sep 2025 19:53:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E5=AE=9E=E7=8E=B0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=80=9A=E7=9F=A5=E8=A7=92=E6=A0=87=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=91=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 --- entry/oh-package.json5 | 2 +- entry/src/main/ets/components/NotificationList.ets | 3 ++- entry/src/main/ets/components/NotificationPublish.ets | 4 ++-- entry/src/main/ets/feature/NotificationOperations.ets | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 8d3ccc2..a5d1329 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -7,6 +7,6 @@ "main": "", "version": "1.0.0", "dependencies": { - "@ohos/notification": "file:../notification" + "notification": "file:../notification" } } diff --git a/entry/src/main/ets/components/NotificationList.ets b/entry/src/main/ets/components/NotificationList.ets index 2567c0e..689ea96 100644 --- a/entry/src/main/ets/components/NotificationList.ets +++ b/entry/src/main/ets/components/NotificationList.ets @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { notificationManager } from '@kit.NotificationKit'; -import { notificationManagement, logger, getAllNotificationsResultType } from '@ohos/notification'; +import { notificationManagement, logger, getAllNotificationsResultType } from 'notification'; import { TitleBar } from './TitleBar'; @Component diff --git a/entry/src/main/ets/components/NotificationPublish.ets b/entry/src/main/ets/components/NotificationPublish.ets index 4b7e9a1..aaa1323 100644 --- a/entry/src/main/ets/components/NotificationPublish.ets +++ b/entry/src/main/ets/components/NotificationPublish.ets @@ -13,10 +13,10 @@ * limitations under the License. */ +import { common } from '@kit.AbilityKit'; import NotificationOperations from '../feature/NotificationOperations'; -import { notificationUtil } from '@ohos/notification'; +import { notificationUtil } from 'notification'; import { TitleBar } from './TitleBar'; -import { common } from '@kit.AbilityKit'; @Component export struct NoticePublish { diff --git a/entry/src/main/ets/feature/NotificationOperations.ets b/entry/src/main/ets/feature/NotificationOperations.ets index 86aa9f5..51ea9bd 100644 --- a/entry/src/main/ets/feature/NotificationOperations.ets +++ b/entry/src/main/ets/feature/NotificationOperations.ets @@ -21,7 +21,7 @@ import { notificationContentUtil, notificationRequestUtil, wantAgentUtil -} from '@ohos/notification'; +} from 'notification'; const TAG: string = 'Sample_Notification'; const BUNDLE_NAME: string = 'com.samples.customnotificationbadge'; -- Gitee