diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index 4bee96a6281c82105770c76312fc3190a9855c69..ecfb62086dbc37b1654ea4ccd32311ef0e02fb5a 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -55,6 +55,8 @@ declare namespace notification { * @since 8 * @param Publishes a notification. * @param userId of subscriber receiving the notification + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER * */ function publish(request: NotificationRequest, userId: number, callback: AsyncCallback): void; @@ -91,6 +93,7 @@ declare namespace notification { * This parameter must be specified. * @param callback callback function * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function addSlot(slot: NotificationSlot, callback: AsyncCallback): void; @@ -101,6 +104,7 @@ declare namespace notification { * This parameter must be specified. * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function addSlot(slot: NotificationSlot): Promise; @@ -120,6 +124,7 @@ declare namespace notification { * This parameter must be specified. * @param callback callback function * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function addSlots(slots: Array, callback: AsyncCallback): void; @@ -130,6 +135,7 @@ declare namespace notification { * This parameter must be specified. * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function addSlots(slots: Array): Promise; @@ -325,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; @@ -332,6 +339,7 @@ declare namespace notification { * isNotificationEnabled * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function isNotificationEnabled(bundle: BundleOption): Promise; @@ -339,29 +347,33 @@ declare namespace notification { * isNotificationEnabled * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ 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 * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void; @@ -369,6 +381,7 @@ declare namespace notification { * displayBadge * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function displayBadge(bundle: BundleOption, enable: boolean): Promise; @@ -376,6 +389,7 @@ declare namespace notification { * isBadgeDisplayed * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback): void; @@ -383,6 +397,7 @@ declare namespace notification { * isBadgeDisplayed * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function isBadgeDisplayed(bundle: BundleOption): Promise; @@ -422,6 +437,7 @@ declare namespace notification { * getSlotNumByBundle * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback): void; @@ -429,6 +445,7 @@ declare namespace notification { * getSlotNumByBundle * * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function getSlotNumByBundle(bundle: BundleOption): Promise; @@ -601,6 +618,7 @@ declare namespace notification { * * @since 8 * @param templateName Name of template to be Obtained + * @param callback callback function */ function isSupportTemplate(templateName: string, callback: AsyncCallback): void; function isSupportTemplate(templateName: string): Promise; @@ -621,6 +639,54 @@ declare namespace notification { 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. */ @@ -638,34 +704,59 @@ declare namespace notification { } /** - * DisturbMode + * The type of the Do Not Disturb. * + * @since 8 * @systemapi Hide this for inner system use. */ - export enum DoNotDisturbMode { - ALLOW_UNKNOWN, + export enum DoNotDisturbType { + /** + * Non do not disturb type notification + */ + TYPE_NONE = 0, /** - * Indicates that all notifications are allowed to interrupt the user in Do Not Disturb mode. + * Execute do not disturb once in the set time period (only watch hours and minutes) */ - ALLOW_ALL, + TYPE_ONCE = 1, /** - * Indicates that only notifications meeting the specified priority criteria are allowed to interrupt - * the user in Do Not Disturb mode. + * Execute do not disturb every day with a set time period (only watch hours and minutes) */ - ALLOW_PRIORITY, + TYPE_DAILY = 2, /** - * Indicates that no notifications are allowed to interrupt the user in Do Not Disturb mode. + * Execute in the set time period (specify the time, month, day and hour) */ - ALLOW_NONE, + 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; /** - * Indicates that only notifications of the {@link NotificationRequest#CLASSIFICATION_ALARM} category - * are allowed to interrupt the user in Do Not Disturb mode. + * the end time of the Do Not Disturb. + * + * @since 8 */ - ALLOW_ALARMS + end: Date; } /** @@ -725,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/api/notification/notificationActionButton.d.ts b/api/notification/notificationActionButton.d.ts index 1893fe02c58fe00e7ee67817bb42679e5f9caee2..cd67a4452b33c983db9da96b4c5919dea53f8180 100644 --- a/api/notification/notificationActionButton.d.ts +++ b/api/notification/notificationActionButton.d.ts @@ -4,7 +4,7 @@ * 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 + * 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, diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index f707426293975c6295fcb68b6d15d0d2960d3713..9accc34cc170b4d355d705ab49b1f0fd1b02c123 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -4,7 +4,7 @@ * 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 + * 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, @@ -163,6 +163,7 @@ export interface NotificationRequest { readonly creatorPid?: number; /** + * @since 8 * Read-only UserId of the notification creator. */ readonly creatorUserId?: number; @@ -203,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. * @@ -210,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/api/notification/notificationSubscriber.d.ts b/api/notification/notificationSubscriber.d.ts index 7976a872fb1bbcd9ccd9e1a6d80bf664a050ad96..d14e59c088cd25a309190e869b1de94d54f498e1 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -34,7 +34,6 @@ export interface NotificationSubscriber { onConnect?:() => void; onDisconnect?:() => void; onDestroy?:() => void; - onDisturbModeChange?:(mode: notification.DoNotDisturbMode) => void; /** * Callback when the Do Not Disturb setting changed.