diff --git a/interfaces/kits/js/@ohos.notification.d.ts b/interfaces/kits/js/@ohos.notification.d.ts index ee4a0894f3d9e781d4506407a7f189f56d3c3fcc..ecfb62086dbc37b1654ea4ccd32311ef0e02fb5a 100644 --- a/interfaces/kits/js/@ohos.notification.d.ts +++ b/interfaces/kits/js/@ohos.notification.d.ts @@ -91,9 +91,8 @@ declare namespace notification { * * @param slot Indicates the notification slot to be created, which is set by {@link NotificationSlot}. * This parameter must be specified. - * - * @systemapi Hide this for inner system use. * @param callback callback function + * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function addSlot(slot: NotificationSlot, callback: AsyncCallback): void; @@ -161,7 +160,7 @@ declare namespace notification { /** * Removes a NotificationSlot of the specified SlotType created by the current application. * - * @param slotType of the NotificationSlot to remove. + * @param slotType Type of the NotificationSlot to remove. * @param callback callback function */ function removeSlot(slotType: SlotType, callback: AsyncCallback): void; @@ -332,6 +331,7 @@ declare namespace notification { * isNotificationEnabled * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback): void; @@ -339,6 +339,7 @@ declare namespace notification { * isNotificationEnabled * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function isNotificationEnabled(bundle: BundleOption): Promise; @@ -351,22 +352,22 @@ declare namespace notification { function isNotificationEnabled(callback: AsyncCallback): void; /** - * Checks whether this application has permission to publish notifications under the user. + * isNotificationEnabled * - * since 8 * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ - function isNotificationEnabled(userId: number, callback: AsyncCallback): void; - function isNotificationEnabled(userId: number): Promise; + function isNotificationEnabled(): Promise; /** - * isNotificationEnabled + * Checks whether this application has permission to publish notifications under the user. * + * since 8 * @systemapi Hide this for inner system use. * @permission ohos.permission.NOTIFICATION_CONTROLLER */ - function isNotificationEnabled(): Promise; + function isNotificationEnabled(userId: number, callback: AsyncCallback): void; + function isNotificationEnabled(userId: number): Promise; /** * displayBadge @@ -622,6 +623,70 @@ 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; + + /** + * Sets whether the device supports distributed notification. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function enableDistributed(enable: boolean, callback: AsyncCallback): void; + function enableDistributed(enable: boolean): Promise; + + /** + * Obtains whether the device supports distributed notification. + * + * @since 8 + */ + function isDistributedEnabled(callback: AsyncCallback): void; + function isDistributedEnabled(): Promise; + + /** + * Sets whether an application supports distributed notification. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void; + function enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise; + + /** + * Obtains whether an application supports distributed notification. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback): void; + function isDistributedEnabledByBundle(bundle: BundleOption): Promise; + + /** + * Obtains the remind modes of the notification. + * + * @since 8 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function getDeviceRemindType(callback: AsyncCallback): void; + function getDeviceRemindType(): Promise; + /** * Describes a BundleOption. */ @@ -694,29 +759,6 @@ declare namespace notification { 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, - } - /** * The type of the Do Not Disturb. * @@ -774,26 +816,31 @@ declare namespace notification { } /** - * Notification source type + * The remind type of the nofication. * * @since 8 * @systemapi Hide this for inner system use. */ - export enum SourceType { + export enum DeviceRemindType { + /** + * The device is not in use, no reminder + */ + IDLE_DONOT_REMIND = 0, + /** - * General notification + * The device is not in use, remind */ - TYPE_NORMAL = 0x00000000, + IDLE_REMIND = 1, /** - * Continuous notification + * The device is in use, no reminder */ - TYPE_CONTINUOUS = 0x00000001, + ACTIVE_DONOT_REMIND = 2, /** - * Scheduled notification + * The device is in use, reminder */ - TYPE_TIMER = 0x00000002, + ACTIVE_REMIND = 3, } } diff --git a/interfaces/kits/js/notification/notificationRequest.d.ts b/interfaces/kits/js/notification/notificationRequest.d.ts index f80d329260afe520c38a98f23a0bd26871570b6d..9accc34cc170b4d355d705ab49b1f0fd1b02c123 100644 --- a/interfaces/kits/js/notification/notificationRequest.d.ts +++ b/interfaces/kits/js/notification/notificationRequest.d.ts @@ -204,6 +204,21 @@ export interface NotificationRequest { */ template?: NotificationTemplate; + /** + * The options to distributed notification. + * + * @since 8 + */ + distributedOption?: DistributedOptions; + + /** + * The device ID of the notification source. + * + * @since 8 + * @systemapi Hide this for inner system use. + */ + readonly deviceId?: string; + /** * Obtains the set of identifiers for the notification. * @@ -211,3 +226,37 @@ export interface NotificationRequest { */ readonly notificationFlags?: NotificationFlags; } + +/** + * Describes distributed options. + * + * @name DistributedOptions + * @since 8 + * @sysCap SystemCapability.Notification.Notification + * @permission N/A + */ +export interface DistributedOptions { + /** + * Obtains whether is the distributed notification. + * + * @default true + */ + isDistributed?: boolean; + + /** + * Obtains the types of devices to which the notification can be synchronized. + */ + supportDisplayDevices?: Array; + + /** + * Obtains the devices on which notifications can be open. + */ + supportOperateDevices?: Array; + + /** + * Obtains the remind mode of the notification. enum DeviceRemindType. + + * @systemapi Hide this for inner system use. + */ + readonly remindType?: number; +} diff --git a/interfaces/kits/js/notification/notificationSubscriber.d.ts b/interfaces/kits/js/notification/notificationSubscriber.d.ts index 2ab26d469efe817a4d6e92445408bf001a2d1305..d14e59c088cd25a309190e869b1de94d54f498e1 100644 --- a/interfaces/kits/js/notification/notificationSubscriber.d.ts +++ b/interfaces/kits/js/notification/notificationSubscriber.d.ts @@ -41,6 +41,13 @@ export interface NotificationSubscriber { * @since 8 */ onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; + + /** + * Callback when the notificaition permission is changed. + * + * @since 8 + */ + onEnabledNotificationChanged?:(callbackData: EnabledNotificationCallbackData) => void; } /** @@ -59,4 +66,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