diff --git a/api/@ohos.commonEvent.d.ts b/api/@ohos.commonEvent.d.ts index fa253c212deea260be2e4f35a6102d91ee8f9903..e3e4e6296d153af76f08df712afb04de919c1207 100644 --- a/api/@ohos.commonEvent.d.ts +++ b/api/@ohos.commonEvent.d.ts @@ -47,6 +47,33 @@ declare namespace commonEvent { */ 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 00b3bd98bff8318a1ef7a977bd17f86f3fe020f1..05b0c6ee1c15112d4f7336e4bcb0d20fb91e1d95 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -555,6 +555,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 dba87297bda4f4e32d0880bf5801921608a1238c..7976a872fb1bbcd9ccd9e1a6d80bf664a050ad96 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -42,6 +42,13 @@ export interface NotificationSubscriber { * @since 8 */ onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; + + /** + * Callback when the notificaition permission is changed. + * + * @since 8 + */ + onEnabledNotificationChanged?:(callbackData: EnabledNotificationCallbackData) => void; } /** @@ -60,4 +67,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