From caf0bbc8ced3ae80319e093829cb4356d2221b4a Mon Sep 17 00:00:00 2001 From: zengsiyu Date: Thu, 20 Jan 2022 16:09:56 +0800 Subject: [PATCH] add interface for commonevent multi-user and notification permission Signed-off-by: zengsiyu Change-Id: Idcef6143a6646d3e73fd7714a31a8b8a876fa6fb Signed-off-by: zengsiyu --- api/@ohos.commonEvent.d.ts | 32 ++++++++++++++++++-- api/@ohos.notification.d.ts | 16 ++++++++++ api/notification/notificationSubscriber.d.ts | 20 ++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/api/@ohos.commonEvent.d.ts b/api/@ohos.commonEvent.d.ts index c3dc0d5b8f..94dd7864e0 100644 --- a/api/@ohos.commonEvent.d.ts +++ b/api/@ohos.commonEvent.d.ts @@ -29,7 +29,7 @@ declare namespace commonEvent { * Publishes an ordered, sticky, or standard common event. * * @since 7 - * @param data Indicate the CommonEventPublishData containing the common event content and attributes. + * @param event Specified the names of the common events. * @param callback Specified callback method. * @return - */ @@ -39,12 +39,40 @@ declare namespace commonEvent { * Publishes an ordered, sticky, or standard common event. * * @since 7 - * @param data Indicate the CommonEventPublishData containing the common event content and attributes. + * @param event Specified the names of the common events. + * @param options Indicate the CommonEventPublishData containing the common event content and attributes. * @param callback Specified callback method. * @return - */ function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void; + /** + * Publishes an ordered, sticky, or standard common event to a specified user. + * + * @since 8 + * @param event Specified the names of the common events. + * @param userId Specified the user to receive the common events. + * @param callback Specified callback method. + * @return - + * + * @systemapi Hide this for inner system use. + */ + function publishAsUser(event: string, userId: number, callback: AsyncCallback): void; + + /** + * Publishes an ordered, sticky, or standard common event to a specified user. + * + * @since 8 + * @param event Specified the names of the common events. + * @param userId Specified the user to receive the common events. + * @param options Indicate the CommonEventPublishData containing the common event content and attributes. + * @param callback Specified callback method. + * @return - + * + * @systemapi Hide this for inner system use. + */ + function publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback): void; + /** * create the CommonEventSubscriber for the SubscriberInfo. * diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index c24a7a258e..f9f3f8bb93 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -552,6 +552,22 @@ declare namespace notification { function isSupportTemplate(templateName: string, callback: AsyncCallback): void; function isSupportTemplate(templateName: string): Promise; + /** + * Query notification sending permission. + * + * @since 8 + */ + function isNotificationEnabledSelf(callback: AsyncCallback): void; + function isNotificationEnabledSelf(): Promise; + + /** + * Request permission to send notification. + * + * @since 8 + */ + function requestEnableNotification(callback: AsyncCallback): void; + function requestEnableNotification(): Promise; + /** * Describes a BundleOption. */ diff --git a/api/notification/notificationSubscriber.d.ts b/api/notification/notificationSubscriber.d.ts index d8e2277bc7..c7f58ae0c2 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -43,6 +43,13 @@ export interface NotificationSubscriber { * @since 8 */ onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; + + /** + * Callback when the notificaition permission is changed. + * + * @since 8 + */ + onEnabledNotificationChanged?:(callbackData: EnabledNotificationCallbackData) => void; } /** @@ -62,4 +69,17 @@ export interface SubscribeCallbackData { readonly reason?: number; readonly sound?: string; readonly vibrationValues?: Array; +} + +/** + * Describes the properties of the application that the permission to send notifications has changed. + * + * @name EnabledNotificationCallbackData + * @systemapi Hide this for inner system use. + * @since 8 + */ +export interface EnabledNotificationCallbackData { + readonly bundle: string; + readonly uid: number; + readonly enable: boolean; } \ No newline at end of file -- Gitee