diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index b1eb7f274a8d21dba6fa73a769434051c9060be2..661c8d46d9a95475ac3f01406491a2b1443e8522 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -495,6 +495,54 @@ declare namespace notification { function getActiveNotifications(callback: AsyncCallback>): void; function getActiveNotifications(): Promise>; + /** + * Cancel the notification of a specified group for this application. + * + * @since 8 + */ + function cancelGroup(groupName: string, callback: AsyncCallback): void; + function cancelGroup(groupName: string): Promise; + + /** + * Delete the notification of a specified group for this application. + * + * @since 8 + * @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; + + /** + * Set the Do Not Disturb date. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback): void; + function setDoNotDisturbDate(date: DoNotDisturbDate): Promise; + + /** + * Obtains the Do Not Disturb date. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function getDoNotDisturbDate(callback: AsyncCallback): void; + function getDoNotDisturbDate(): Promise; + + /** + * Obtains whether to support the Do Not Disturb mode. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function supportDoNotDisturbMode(callback: AsyncCallback): void; + function supportDoNotDisturbMode(): Promise; + /** * Describes a BundleOption. */ @@ -541,6 +589,85 @@ declare namespace notification { */ ALLOW_ALARMS } + + /** + * The type of the Do Not Disturb. + * + * @since 8 + * @systemapi Hide this for inner system use. + */ + export enum DoNotDisturbType { + /** + * 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, + } + + /** + * Describes a DoNotDisturbDate instance. + * + * @systemapi Hide this for inner system use. + */ + 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; + } + + /** + * Notification source type + * + * @since 8 + * @systemapi Hide this for inner system use. + */ + export enum SourceType { + /** + * General notification + */ + TYPE_NORMAL = 0x00000000, + + /** + * Continuous notification + */ + TYPE_CONTINUOUS = 0x00000001, + + /** + * Scheduled notification + */ + TYPE_TIMER = 0x00000002, + } } export default notification; diff --git a/api/notification/notificationActionButton.d.ts b/api/notification/notificationActionButton.d.ts index 39cc3db49ea37fe7a708c51f36b0854e14ce90a9..d67934492a3091a57fbe745664cf5797e37a138d 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,11 @@ export interface NotificationActionButton { * Extra information of the button. */ extras?: {[key: string]: any}; + + /** + * User input + * + * @since 8 + */ + userInput?: NotificationUserInput; } diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index b7e6575057d9b8eaf3e11c0bf7ab21d13628bf5f..f5a27477ee4b150d43024ec84e52db48d06559ea 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -139,6 +139,13 @@ export interface NotificationRequest { */ largeIcon?: image.PixelMap; + /** + * The group information for this notification. + * + * @since 8 + */ + groupName?: string; + /** * Read-only name of the package for which a notification is created. */ @@ -165,4 +172,21 @@ export interface NotificationRequest { * Obtains the unique hash code of a notification in the current application. */ readonly hashCode?: string; + + /** + * Whether the notification can be remove. + * + * @default true + * @since 8 + * @systemapi Hide this for inner system use. + */ + readonly isRemoveAllowed?: boolean; + + /** + * 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 a659a9d0f17b31028603b3228d257116df9a78ba..d8e2277bc72c82461cf7efc540cdf00be1cf9e19 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -36,6 +36,13 @@ 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 new file mode 100644 index 0000000000000000000000000000000000000000..63f0229887675cb5071c4a9e686bdf8e0714cf55 --- /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 8 + * @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; +}