diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index c24a7a258edb2b7d88ac7454abbe095270b6d098..25ef9b8158937e29560df841b78c4d25a7624457 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -49,6 +49,17 @@ declare namespace notification { function publish(request: NotificationRequest, callback: AsyncCallback): void; function publish(request: NotificationRequest): Promise; + /** + * Publishes a notification to the specified user. + * + * @since 8 + * @param Publishes a notification. + * @param userId of subscriber receiving the notification + * + */ + function publish(request: NotificationRequest, userId: number, callback: AsyncCallback): void; + function publish(request: NotificationRequest, userId: number): Promise; + /** * Cancels a notification with the specified ID. * @@ -328,6 +339,15 @@ declare namespace notification { */ function isNotificationEnabled(callback: AsyncCallback): void; + /** + * Checks whether this application has permission to publish notifications under the user. + * + * since 8 + * @systemapi Hide this for inner system use. + */ + function isNotificationEnabled(userId: number, callback: AsyncCallback): void; + function isNotificationEnabled(userId: number): Promise; + /** * isNotificationEnabled * @@ -457,6 +477,16 @@ declare namespace notification { */ function removeAll(callback: AsyncCallback): void; + /** + * Remove all notifications under the specified user. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function removeAll(userId: number, callback: AsyncCallback): void; + function removeAll(userId: number): Promise; + /** * removeAll * @@ -523,6 +553,16 @@ declare namespace notification { function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback): void; function setDoNotDisturbDate(date: DoNotDisturbDate): Promise; + /** + * Set the Do Not Disturb date under the specified user. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback): void; + function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise; + /** * Obtains the Do Not Disturb date. * @@ -533,6 +573,16 @@ declare namespace notification { function getDoNotDisturbDate(callback: AsyncCallback): void; function getDoNotDisturbDate(): Promise; + /** + * Obtains the Do Not Disturb date. + * + * @since 8 + * @systemapi Hide this for inner system use under the specified user. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function getDoNotDisturbDate(userId: number, callback: AsyncCallback): void; + function getDoNotDisturbDate(userId: number): Promise; + /** * Obtains whether to support the Do Not Disturb mode. * diff --git a/api/notification/notificationFlags.ts b/api/notification/notificationFlags.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e554d9bef41c6da81b44abee095c871c2d1d0c3 --- /dev/null +++ b/api/notification/notificationFlags.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +/** + * The status of the notification flag. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @sysCap SystemCapability.Notification.Notification + */ + export enum NotificationFlagStatus { + /** + * notification flag default value + */ + TYPE_NONE = 0, + + /** + * notification flag open + */ + TYPE_OPEN = 1, + + /** + * notification flag close + */ + TYPE_CLOSE = 2, +} + +/** + * Describes a NotificationFlags instance. + * + * @name NotificationFlags + * @since 8 + * @permission N/A + * @syscap SystemCapability.Notification.Notification + */ + export interface NotificationFlags { + /** + * Whether to enable sound reminder. + */ + readonly soundEnabled?: NotificationFlagStatus; + + /** + * Whether to enable vibration reminder. + */ + readonly vibrationEnabled?: NotificationFlagStatus; +} diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index 669a492e34c68711c4299849667f51a044b3c8ae..f707426293975c6295fcb68b6d15d0d2960d3713 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -19,14 +19,14 @@ import { WantAgent } from '../@ohos.wantAgent'; import { NotificationContent } from './notificationContent'; import { NotificationActionButton } from './notificationActionButton'; import { NotificationTemplate } from './notificationTemplate'; +import { NotificationFlags } from './notificationFlags'; /** * Defines a NotificationRequest instance. * * @name NotificationRequest * @since 7 - * @sysCap SystemCapability.Notification.ANS - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.Notification.Notification * @permission N/A */ export interface NotificationRequest { @@ -162,6 +162,11 @@ export interface NotificationRequest { */ readonly creatorPid?: number; + /** + * Read-only UserId of the notification creator. + */ + readonly creatorUserId?: number; + /** * Obtains the classification of this notification. * @@ -197,4 +202,11 @@ export interface NotificationRequest { * @since 8 */ template?: NotificationTemplate; + + /** + * Obtains the set of identifiers for the notification. + * + * @since 8 + */ + readonly notificationFlags?: NotificationFlags; }