From cc7771166edec71e0427c6e0399785f7c242516b Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Mon, 6 Dec 2021 19:56:40 +0000 Subject: [PATCH 1/4] Update d.ts Signed-off-by: zhaoyuan17 --- api/@ohos.notification.d.ts | 83 +++++++++++++++++++ .../notificationActionButton.d.ts | 6 ++ api/notification/notificationRequest.d.ts | 14 ++++ api/notification/notificationSubscriber.d.ts | 1 + api/notification/notificationUserInput.d.ts | 30 +++++++ 5 files changed, 134 insertions(+) create mode 100644 api/notification/notificationUserInput.d.ts diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index b1eb7f274a..eb44ec9b7e 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -495,6 +495,44 @@ declare namespace notification { function getActiveNotifications(callback: AsyncCallback>): void; function getActiveNotifications(): Promise>; + /** + * Cancel the notification of a specified group for this application. + */ + function cancelGroup(groupName: string, callback: AsyncCallback): void; + function cancelGroup(groupName: string): Promise; + + /** + * Delete the notification of a specified group for this application. + * + * @systemapi Hide this for inner system use. + */ + function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; + function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise; + + /** + * Set the Do Not Disturb date. + * + * @systemapi Hide this for inner system use. + */ + function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback): void; + function setDoNotDisturbDate(date: DoNotDisturbDate): Promise; + + /** + * Obtains the Do Not Disturb date. + * + * @systemapi Hide this for inner system use. + */ + function getDoNotDisturbDate(callback: AsyncCallback): void; + function getDoNotDisturbDate(): Promise; + + /** + * Obtains whether to support the Do Not Disturb mode. + * + * @systemapi Hide this for inner system use. + */ + function supportDoNotDisturbMode(callback: AsyncCallback): void; + function supportDoNotDisturbMode(): Promise; + /** * Describes a BundleOption. */ @@ -541,6 +579,51 @@ declare namespace notification { */ ALLOW_ALARMS } + + /** + * The type of the Do Not Disturb. + * + * @systemapi Hide this for inner system use. + */ + export enum DoNotDisturbType { + TYPE_NONE = 0, // 非通知勿扰类型 + TYPE_ONCE = 1, // 以设置时间段(只看小时和分钟)一次执行勿扰 + TYPE_DAILY = 2, // 以设置时间段(只看小时和分钟)每天执行勿扰 + TYPE_CLEARLY = 3, // 以设置时间段(明确年月日时分)执行勿扰 + } + + /** + * Describes a DoNotDisturbDate instance. + * + * @systemapi Hide this for inner system use. + */ + export interface DoNotDisturbDate { + /** + * the type of the Do Not Disturb. + */ + type: DoNotDisturbType; + + /** + * the start time of the Do Not Disturb. + */ + begin: Date; + + /** + * the end time of the Do Not Disturb. + */ + end: Date; + } + + /** + * Notification source type + * + * @systemapi Hide this for inner system use. + */ + export enum SourceType { + TYPE_NORMAL = 0x00000000, // 普通通知 + TYPE_CONTINUOUS = 0x00000001, // 长时任务通知 + TYPE_TIMER = 0x00000002, // 定时通知 + } } export default notification; diff --git a/api/notification/notificationActionButton.d.ts b/api/notification/notificationActionButton.d.ts index 39cc3db49e..bf2549c696 100644 --- a/api/notification/notificationActionButton.d.ts +++ b/api/notification/notificationActionButton.d.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +import { NotificationUserInput } from './notificationUserInput'; import { WantAgent } from '../@ohos.wantAgent'; /** @@ -38,4 +39,9 @@ export interface NotificationActionButton { * Extra information of the button. */ extras?: {[key: string]: any}; + + /** + * User input + */ + userInput?: NotificationUserInput; } diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index b7e6575057..1afddfb292 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -165,4 +165,18 @@ export interface NotificationRequest { * Obtains the unique hash code of a notification in the current application. */ readonly hashCode?: string; + + /** + * Whether the notification can be remove. + * + * @systemapi Hide this for inner system use. + */ + readonly isRemoveAllowed?: boolean; + + /** + * Notification source. enum SourceType + * + * @systemapi Hide this for inner system use. + */ + readonly source?: number; } diff --git a/api/notification/notificationSubscriber.d.ts b/api/notification/notificationSubscriber.d.ts index a659a9d0f1..2b3f57ee9e 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -36,6 +36,7 @@ export interface NotificationSubscriber { onDisconnect?:() => void; onDestroy?:() => void; onDisturbModeChange?:(mode: notification.DoNotDisturbMode) => void; + onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; } /** diff --git a/api/notification/notificationUserInput.d.ts b/api/notification/notificationUserInput.d.ts new file mode 100644 index 0000000000..1b44e878ef --- /dev/null +++ b/api/notification/notificationUserInput.d.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http?://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Describes a NotificationUserInput instance. + * + * @name NotificationUserInput + * @since 7 + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @sysCap SystemCapability.Notification.ANS + */ +export interface NotificationUserInput { + /** + * Obtains the key used to identify this input when the input is collected from the user. + */ + inputKey: string; +} -- Gitee From 23f6a0538c141cf527be606667a3cccbb9852f6c Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Mon, 6 Dec 2021 20:09:01 +0000 Subject: [PATCH 2/4] Update d.ts Signed-off-by: zhaoyuan17 --- api/notification/notificationRequest.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index 1afddfb292..ce183326fe 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -139,6 +139,11 @@ export interface NotificationRequest { */ largeIcon?: image.PixelMap; + /** + * The group information for this notification. + */ + groupName?: string; + /** * Read-only name of the package for which a notification is created. */ -- Gitee From 014b42d2c996247f76eaa51db0c8715d76c14ef8 Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Tue, 7 Dec 2021 10:54:26 +0000 Subject: [PATCH 3/4] Update d.ts Signed-off-by: zhaoyuan17 --- api/@ohos.notification.d.ts | 44 +++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index eb44ec9b7e..aed59524ff 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -505,6 +505,7 @@ declare namespace notification { * Delete the notification of a specified group for this application. * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise; @@ -513,6 +514,7 @@ declare namespace notification { * Set the Do Not Disturb date. * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback): void; function setDoNotDisturbDate(date: DoNotDisturbDate): Promise; @@ -521,6 +523,7 @@ declare namespace notification { * Obtains the Do Not Disturb date. * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function getDoNotDisturbDate(callback: AsyncCallback): void; function getDoNotDisturbDate(): Promise; @@ -529,6 +532,7 @@ declare namespace notification { * Obtains whether to support the Do Not Disturb mode. * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function supportDoNotDisturbMode(callback: AsyncCallback): void; function supportDoNotDisturbMode(): Promise; @@ -586,10 +590,25 @@ declare namespace notification { * @systemapi Hide this for inner system use. */ export enum DoNotDisturbType { - TYPE_NONE = 0, // 非通知勿扰类型 - TYPE_ONCE = 1, // 以设置时间段(只看小时和分钟)一次执行勿扰 - TYPE_DAILY = 2, // 以设置时间段(只看小时和分钟)每天执行勿扰 - TYPE_CLEARLY = 3, // 以设置时间段(明确年月日时分)执行勿扰 + /** + * Non do not disturb type notification + */ + TYPE_NONE = 0, + + /** + * Execute do not disturb once in the set time period (only watch hours and minutes) + */ + TYPE_ONCE = 1, + + /** + * Execute do not disturb every day with a set time period (only watch hours and minutes) + */ + TYPE_DAILY = 2, + + /** + * Execute in the set time period (specify the time, month, day and hour) + */ + TYPE_CLEARLY = 3, } /** @@ -620,9 +639,20 @@ declare namespace notification { * @systemapi Hide this for inner system use. */ export enum SourceType { - TYPE_NORMAL = 0x00000000, // 普通通知 - TYPE_CONTINUOUS = 0x00000001, // 长时任务通知 - TYPE_TIMER = 0x00000002, // 定时通知 + /** + * General notification + */ + TYPE_NORMAL = 0x00000000, + + /** + * Continuous notification + */ + TYPE_CONTINUOUS = 0x00000001, + + /** + * Scheduled notification + */ + TYPE_TIMER = 0x00000002, } } -- Gitee From 31446d4bb89871595f86005b5e1f72d0188ecdcd Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Wed, 8 Dec 2021 10:09:15 +0000 Subject: [PATCH 4/4] Update d.ts version Signed-off-by: zhaoyuan17 --- api/@ohos.notification.d.ts | 14 ++++++++++++++ api/notification/notificationActionButton.d.ts | 2 ++ api/notification/notificationRequest.d.ts | 5 +++++ api/notification/notificationSubscriber.d.ts | 6 ++++++ api/notification/notificationUserInput.d.ts | 2 +- 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index aed59524ff..661c8d46d9 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -497,6 +497,8 @@ declare namespace notification { /** * Cancel the notification of a specified group for this application. + * + * @since 8 */ function cancelGroup(groupName: string, callback: AsyncCallback): void; function cancelGroup(groupName: string): Promise; @@ -504,6 +506,7 @@ declare namespace notification { /** * Delete the notification of a specified group for this application. * + * @since 8 * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ @@ -513,6 +516,7 @@ declare namespace notification { /** * Set the Do Not Disturb date. * + * @since 8 * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ @@ -522,6 +526,7 @@ declare namespace notification { /** * Obtains the Do Not Disturb date. * + * @since 8 * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ @@ -531,6 +536,7 @@ declare namespace notification { /** * Obtains whether to support the Do Not Disturb mode. * + * @since 8 * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ @@ -587,6 +593,7 @@ declare namespace notification { /** * The type of the Do Not Disturb. * + * @since 8 * @systemapi Hide this for inner system use. */ export enum DoNotDisturbType { @@ -619,16 +626,22 @@ declare namespace notification { export interface DoNotDisturbDate { /** * the type of the Do Not Disturb. + * + * @since 8 */ type: DoNotDisturbType; /** * the start time of the Do Not Disturb. + * + * @since 8 */ begin: Date; /** * the end time of the Do Not Disturb. + * + * @since 8 */ end: Date; } @@ -636,6 +649,7 @@ declare namespace notification { /** * Notification source type * + * @since 8 * @systemapi Hide this for inner system use. */ export enum SourceType { diff --git a/api/notification/notificationActionButton.d.ts b/api/notification/notificationActionButton.d.ts index bf2549c696..d67934492a 100644 --- a/api/notification/notificationActionButton.d.ts +++ b/api/notification/notificationActionButton.d.ts @@ -42,6 +42,8 @@ export interface NotificationActionButton { /** * User input + * + * @since 8 */ userInput?: NotificationUserInput; } diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index ce183326fe..f5a27477ee 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -141,6 +141,8 @@ export interface NotificationRequest { /** * The group information for this notification. + * + * @since 8 */ groupName?: string; @@ -174,6 +176,8 @@ export interface NotificationRequest { /** * Whether the notification can be remove. * + * @default true + * @since 8 * @systemapi Hide this for inner system use. */ readonly isRemoveAllowed?: boolean; @@ -181,6 +185,7 @@ export interface NotificationRequest { /** * Notification source. enum SourceType * + * @since 8 * @systemapi Hide this for inner system use. */ readonly source?: number; diff --git a/api/notification/notificationSubscriber.d.ts b/api/notification/notificationSubscriber.d.ts index 2b3f57ee9e..d8e2277bc7 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -36,6 +36,12 @@ export interface NotificationSubscriber { onDisconnect?:() => void; onDestroy?:() => void; onDisturbModeChange?:(mode: notification.DoNotDisturbMode) => void; + + /** + * Callback when the Do Not Disturb setting changed. + * + * @since 8 + */ onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; } diff --git a/api/notification/notificationUserInput.d.ts b/api/notification/notificationUserInput.d.ts index 1b44e878ef..63f0229887 100644 --- a/api/notification/notificationUserInput.d.ts +++ b/api/notification/notificationUserInput.d.ts @@ -17,7 +17,7 @@ * Describes a NotificationUserInput instance. * * @name NotificationUserInput - * @since 7 + * @since 8 * @devices phone, tablet, tv, wearable, car * @permission N/A * @sysCap SystemCapability.Notification.ANS -- Gitee