From e743aa3860536a06fb6442ff14ed1e48c7e87012 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Wed, 7 Jun 2023 12:30:30 +0800 Subject: [PATCH] fixed 454babd from https://gitee.com/esterzhou/docs/pulls/19304 Update docs (18434) Signed-off-by: ester.zhou --- .../inputmethodextentionability.md | 2 +- en/application-dev/notification/Readme-EN.md | 4 +-- .../notification/notification-badge.md | 36 +++++++++---------- .../notification/notification-subscription.md | 6 ++-- .../notification-with-wantagent.md | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/en/application-dev/application-models/inputmethodextentionability.md b/en/application-dev/application-models/inputmethodextentionability.md index b36cf2a050..49686c5d5c 100644 --- a/en/application-dev/application-models/inputmethodextentionability.md +++ b/en/application-dev/application-models/inputmethodextentionability.md @@ -1,4 +1,4 @@ -# InputMethodExtensionAbility Development +# InputMethodExtensionAbility ## When to Use [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md), inherited from [ExtensionAbility](extensionability-overview.md), is used for developing input method applications. diff --git a/en/application-dev/notification/Readme-EN.md b/en/application-dev/notification/Readme-EN.md index f7b76df0e9..47c6303ebe 100644 --- a/en/application-dev/notification/Readme-EN.md +++ b/en/application-dev/notification/Readme-EN.md @@ -1,9 +1,9 @@ # Notification - [Notification Overview](notification-overview.md) -- [Notification Subscription (for System Applications Only)](notification-subscription.md) +- [Subscribing to Notifications (for System Applications Only)](notification-subscription.md) - [Enabling Notification](notification-enable.md) -- [Notification Badge](notification-badge.md) +- [Managing the Notification Badge](notification-badge.md) - Publishing a Notification - [Publishing a Basic Notification](text-notification.md) - [Publishing a Progress Notification](progress-bar-notification.md) diff --git a/en/application-dev/notification/notification-badge.md b/en/application-dev/notification/notification-badge.md index 66d29e659d..5cf38e460c 100644 --- a/en/application-dev/notification/notification-badge.md +++ b/en/application-dev/notification/notification-badge.md @@ -1,4 +1,4 @@ -# Notification Badge +# Managing the Notification Badge OpenHarmony provides APIs for setting the notification badge, which is displayed in the upper right corner of the application icon on the home screen to notify the user of the count of unread notifications. @@ -11,11 +11,11 @@ After a notification is read, the count on the badge is decremented by 1. If the 1. The notification service provides two methods to increase the count on the notification badge: - - When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest). After the notification is received, the count on the badge is incremented. + - When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest). After the notification is received, the count on the badge is incremented. - - Call the [setBadgeNumber](../reference/apis/js-apis-notificationManager.md#setbadgenumber) API to set the count on the badge. + - Call the [setBadgeNumber()](../reference/apis/js-apis-notificationManager.md#notificationmanagersetbadgenumber10) API to set the count on the badge. -2. To decrease the count on the badge, call the **setBadgeNumber** API. +2. To decrease the count on the badge, call the [setBadgeNumber()](../reference/apis/js-apis-notificationManager.md#notificationmanagersetbadgenumber10) API. | API| Description| | -------- | -------- | @@ -32,37 +32,37 @@ After a notification is read, the count on the badge is decremented by 1. If the 2. Increase the count on the badge. - When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest). For details, see [Publishing a Basic Notification](text-notification.md). + When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest). For details, see [Publishing a Basic Notification](text-notification.md). In this example, the **setBadgeNumber** API is called to add a badge. This API is called after a new notification is published. ```ts function setBadgeNumberCallback(err) { - if (err) { - console.info(`Set badge failed code is ${err.code}, message is ${err.message}`); - } else { - console.info(`Set badge success`); - } + if (err) { + console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`); + return; + } + console.info(`Succeeded in seting badge number.`); } - let badgeNumber = 10 + let badgeNumber = 10; notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); ``` -3. Reduce the count on the badge. +3. Decrease the count on the badge. After a notification is read, the application needs to call the API to set the number of remaining unread notifications. The badge is then updated. ```ts function setBadgeNumberCallback(err) { - if (err) { - console.info(`Set badge failed code is ${err.code}, message is ${err.message}`); - } else { - console.info(`Set badge success`); - } + if (err) { + console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`); + return; + } + console.info(`Succeeded in seting badge number.`); } - let badgeNumber = 9 + let badgeNumber = 9; notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); ``` diff --git a/en/application-dev/notification/notification-subscription.md b/en/application-dev/notification/notification-subscription.md index 45e75f1f64..68bc11450b 100644 --- a/en/application-dev/notification/notification-subscription.md +++ b/en/application-dev/notification/notification-subscription.md @@ -1,4 +1,4 @@ -# Notification Subscription (for System Applications Only) +# Subscribing to Notifications (for System Applications Only) To receive notifications, an application must subscribe to notifications first. The notification subsystem provides two types of subscription APIs, allowing applications to subscribe to notifications from all applications or notifications from a specific application. @@ -13,14 +13,14 @@ The major APIs for notification subscription are described as follows. For detai **Table 1** Major APIs for notification subscription -| Name | Description| +| API| Description| | -------- | -------- | | subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback<void>): void | Subscribes to notifications from a specific application.| | subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | Subscribes to notifications from all applications. | **Table 2** Callbacks for notification subscription -| Name | Description| +| API| Description| | -------- | -------- | | onConsume?:(data: SubscribeCallbackData) => void | Callback for receiving notifications. | | onCancel?:(data: SubscribeCallbackData) => void | Callback for canceling notifications. | diff --git a/en/application-dev/notification/notification-with-wantagent.md b/en/application-dev/notification/notification-with-wantagent.md index 638f53ef2f..3864db71c9 100644 --- a/en/application-dev/notification/notification-with-wantagent.md +++ b/en/application-dev/notification/notification-with-wantagent.md @@ -13,7 +13,7 @@ Below you can see the process of adding a **WantAgent** object to a notification For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/js-apis-app-ability-wantAgent.md). -| Name| Description| +| API | Description| | -------- | -------- | | getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void | Creates a **WantAgent** object.| | trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void | Triggers a **WantAgent** object.| -- GitLab