diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 8d3ccc29596d2c7688ef64458a14df92cfbd48bc..a5d13295f577d489e7a778a6337ec202bb8dafb9 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 2567c0e839cae4c94aac06b3eeefc8eaa911c940..689ea9655a500d5117c681d2279b130437c7168f 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 4b7e9a1edde3d90e63fdb5220d2d6320cbbeb82c..aaa132319261dba656888e2b56db6f48f4bb7a98 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/components/TitleBar.ets b/entry/src/main/ets/components/TitleBar.ets index 2c96ddf757f0f461c971855c21a56c0a4677d102..f1d01759e3f68201f6b8d1d6b2858b4cec03ebee 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/entry/src/main/ets/feature/NotificationOperations.ets b/entry/src/main/ets/feature/NotificationOperations.ets index 86aa9f55f94e8264e8f66d137da0ca6c79a3fc83..51ea9bdb63113c20a1d347ae6bedf21397a783c7 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'; diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index f70ecd4112d94f9aa555adf898d53f18bf58f3e9..a2a2e3781820ac1b548a01481b50e88b0f2e5cfa 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 4ad6f1532423cf1c436af8715bcb596421c6b747..a0547f2e99854f1bc25afd9e394624414f50622b 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 58c39287718b80bc001d691fe1181cd89ffe8393..74a6afb323466c67da6ae70bd6966c66599076a5 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "license": "", "devDependencies": { },