From 4dcb1ba91fd7b6f12b8868820f0731f757c6d3df Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Mon, 6 Dec 2021 19:50:21 +0000 Subject: [PATCH 1/2] Update d.ts Signed-off-by: zhaoyuan17 --- interfaces/kits/js/@ohos.notification.d.ts | 83 +++++++++++++++++++ .../notificationActionButton.d.ts | 6 ++ .../js/notification/notificationRequest.d.ts | 14 ++++ .../notification/notificationSubscriber.d.ts | 1 + .../notification/notificationUserInput.d.ts | 30 +++++++ 5 files changed, 134 insertions(+) create mode 100644 interfaces/kits/js/notification/notificationUserInput.d.ts diff --git a/interfaces/kits/js/@ohos.notification.d.ts b/interfaces/kits/js/@ohos.notification.d.ts index b1eb7f274..eb44ec9b7 100644 --- a/interfaces/kits/js/@ohos.notification.d.ts +++ b/interfaces/kits/js/@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/interfaces/kits/js/notification/notificationActionButton.d.ts b/interfaces/kits/js/notification/notificationActionButton.d.ts index 39cc3db49..bf2549c69 100644 --- a/interfaces/kits/js/notification/notificationActionButton.d.ts +++ b/interfaces/kits/js/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/interfaces/kits/js/notification/notificationRequest.d.ts b/interfaces/kits/js/notification/notificationRequest.d.ts index b7e657505..1afddfb29 100644 --- a/interfaces/kits/js/notification/notificationRequest.d.ts +++ b/interfaces/kits/js/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/interfaces/kits/js/notification/notificationSubscriber.d.ts b/interfaces/kits/js/notification/notificationSubscriber.d.ts index a659a9d0f..2b3f57ee9 100644 --- a/interfaces/kits/js/notification/notificationSubscriber.d.ts +++ b/interfaces/kits/js/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/interfaces/kits/js/notification/notificationUserInput.d.ts b/interfaces/kits/js/notification/notificationUserInput.d.ts new file mode 100644 index 000000000..1b44e878e --- /dev/null +++ b/interfaces/kits/js/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 9403c24f8f320b9ad2547cbe3e864435bf985f70 Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Mon, 6 Dec 2021 20:11:57 +0000 Subject: [PATCH 2/2] Update d.ts Signed-off-by: zhaoyuan17 --- interfaces/kits/js/notification/notificationRequest.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interfaces/kits/js/notification/notificationRequest.d.ts b/interfaces/kits/js/notification/notificationRequest.d.ts index 1afddfb29..ce183326f 100644 --- a/interfaces/kits/js/notification/notificationRequest.d.ts +++ b/interfaces/kits/js/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