From 34293306bb0b1d996b6ef2736f9e2a9f028fdff5 Mon Sep 17 00:00:00 2001 From: leo9001 Date: Thu, 3 Jul 2025 10:23:25 +0800 Subject: [PATCH] =?UTF-8?q?overload=E6=95=B4=E6=94=B9=20ets=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/bundlemanager_bundle_framework/issues/ICJJUP?from=project-issue Signed-off-by: leo9001 --- .../ets/ets/@ohos.notificationManager.ets | 278 ++++++++++++------ .../ets/ets/@ohos.notificationSubscribe.ets | 41 ++- 2 files changed, 205 insertions(+), 114 deletions(-) diff --git a/frameworks/ets/ets/@ohos.notificationManager.ets b/frameworks/ets/ets/@ohos.notificationManager.ets index 786e8a0cc..d7e87c6a7 100644 --- a/frameworks/ets/ets/@ohos.notificationManager.ets +++ b/frameworks/ets/ets/@ohos.notificationManager.ets @@ -641,7 +641,7 @@ export default namespace notificationManager { return error; } - export function getSlotNumByBundle(bundle: BundleOption): Promise { + export function getSlotNumByBundle_chinast_1(bundle: BundleOption): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -658,7 +658,7 @@ export default namespace notificationManager { return pPromise; } - export function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback): void { + export function getSlotNumByBundle_chinast_2(bundle: BundleOption, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -677,7 +677,9 @@ export default namespace notificationManager { }); } - export function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback): void { + overload getSlotNumByBundle { getSlotNumByBundle_chinast_1, getSlotNumByBundle_chinast_2 }; + + export function setSlotByBundle_chinast_1(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -698,7 +700,7 @@ export default namespace notificationManager { }); } - export function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise { + export function setSlotByBundle_chinast_2(bundle: BundleOption, slot: NotificationSlot): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -718,7 +720,9 @@ export default namespace notificationManager { return pPromise; } - export function removeAllSlots(callback: AsyncCallback): void { + overload setSlotByBundle { setSlotByBundle_chinast_1, setSlotByBundle_chinast_2 }; + + export function removeAllSlots_chinast_1(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; } @@ -731,7 +735,7 @@ export default namespace notificationManager { }); } - export function removeAllSlots(): Promise { + export function removeAllSlots_chinast_2(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return nativeRemoveAllSlots(); }); p.then((data: NullishType): void => { @@ -743,7 +747,9 @@ export default namespace notificationManager { return pPromise; } - export function removeSlot(slotType: SlotType, callback: AsyncCallback): void { + overload removeAllSlots { removeAllSlots_chinast_1, removeAllSlots_chinast_2 }; + + export function removeSlot_chinast_1(slotType: SlotType, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; } @@ -756,7 +762,7 @@ export default namespace notificationManager { }); } - export function removeSlot(slotType: SlotType): Promise { + export function removeSlot_chinast_2(slotType: SlotType): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return nativeRemoveSlot(slotType); }); p.then((data: NullishType): void => { @@ -768,7 +774,9 @@ export default namespace notificationManager { return pPromise; } - export function getSlots(): Promise> { + overload removeSlot { removeSlot_chinast_1, removeSlot_chinast_2 }; + + export function getSlots_chinast_1(): Promise> { let pPromise = new Promise>((resolve: ResolveCallback>, reject: RejectCallback): void => { let p = taskpool.execute((): Array => { return nativeGetSlots(); }); p.then((data: NullishType): void => { @@ -781,7 +789,7 @@ export default namespace notificationManager { return pPromise; } - export function getSlots(callback: AsyncCallback>): void { + export function getSlots_chinast_2(callback: AsyncCallback>): void { if (callback == null) { throw errorParamInvalid; } @@ -796,7 +804,9 @@ export default namespace notificationManager { }); } - export function getSlot(slotType: SlotType): Promise { + overload getSlots { getSlots_chinast_1, getSlots_chinast_2 }; + + export function getSlot_chinast_1(slotType: SlotType): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): NotificationSlot => { return nativeGetSlot(slotType); }); p.then((data: NullishType): void => { @@ -809,7 +819,7 @@ export default namespace notificationManager { return pPromise; } - export function getSlot(slotType: SlotType, callback: AsyncCallback): void { + export function getSlot_chinast_2(slotType: SlotType, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; } @@ -824,6 +834,8 @@ export default namespace notificationManager { }); } + overload getSlot { getSlot_chinast_1, getSlot_chinast_2 }; + export function getSlotByBundle(bundle: BundleOption, slotType: SlotType): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -841,7 +853,7 @@ export default namespace notificationManager { return pPromise; } - export function addSlots(slots: Array): Promise { + export function addSlots_chinast_1(slots: Array): Promise { if (!slots || slots.length === 0) { throw errorParamInvalid; } @@ -856,7 +868,7 @@ export default namespace notificationManager { return pPromise; } - export function addSlots(slots: Array, callback: AsyncCallback): void { + export function addSlots_chinast_2(slots: Array, callback: AsyncCallback): void { if (!slots || slots.length === 0) { throw errorParamInvalid; } @@ -872,7 +884,9 @@ export default namespace notificationManager { }); } - export function addSlot(slot: NotificationSlot): Promise { + overload addSlots { addSlots_chinast_1, addSlots_chinast_2 }; + + export function addSlot_chinast_1(slot: NotificationSlot): Promise { let slotError: BusinessError = isInvalidParameter(slot); if (slotError.code !== ERROR_OK) { throw slotError; @@ -888,7 +902,7 @@ export default namespace notificationManager { return pPromise; } - export function addSlot(slot: NotificationSlot, callback: AsyncCallback): void { + export function addSlot_chinast_2(slot: NotificationSlot, callback: AsyncCallback): void { let slotError: BusinessError = isInvalidParameter(slot); if (slotError.code !== ERROR_OK) { throw slotError; @@ -905,7 +919,7 @@ export default namespace notificationManager { }); } - export function addSlot(type: SlotType, callback: AsyncCallback): void { + export function addSlot_chinast_3(type: SlotType, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; } @@ -918,7 +932,7 @@ export default namespace notificationManager { }); } - export function addSlot(type: SlotType): Promise { + export function addSlot_chinast_4(type: SlotType): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return nativeAddSlotBySlotType(type); }); p.then((data: NullishType): void => { @@ -930,7 +944,9 @@ export default namespace notificationManager { return pPromise; } - export function setNotificationEnable(bundle: BundleOption, enable: boolean): Promise + overload addSlot { addSlot_chinast_1, addSlot_chinast_2, addSlot_chinast_3, addSlot_chinast_4 }; + + export function setNotificationEnable_chinast_1(bundle: BundleOption, enable: boolean): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -947,7 +963,7 @@ export default namespace notificationManager { return pPromise; } - export function setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void + export function setNotificationEnable_chinast_2(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -965,7 +981,9 @@ export default namespace notificationManager { }); } - export function isNotificationEnabled(bundleOption: BundleOption, callback: AsyncCallback): void + overload setNotificationEnable { setNotificationEnable_chinast_1, setNotificationEnable_chinast_2 }; + + export function isNotificationEnabled_chinast_1(bundleOption: BundleOption, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundleOption); if (error.code !== ERROR_OK) { @@ -985,7 +1003,7 @@ export default namespace notificationManager { }) } - export function isNotificationEnabled(bundleOption: BundleOption): Promise + export function isNotificationEnabled_chinast_2(bundleOption: BundleOption): Promise { let error: BusinessError = isInvalidParameter(bundleOption); if (error.code !== ERROR_OK) { @@ -1005,7 +1023,7 @@ export default namespace notificationManager { return pPromise; } - export function isNotificationEnabled(userId: number, callback: AsyncCallback): void + export function isNotificationEnabled_chinast_3(userId: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -1021,7 +1039,7 @@ export default namespace notificationManager { }) } - export function isNotificationEnabled(userId: number): Promise + export function isNotificationEnabled_chinast_4(userId: number): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): boolean => { return nativeIsNotificationEnabledWithId(userId); }); @@ -1035,7 +1053,7 @@ export default namespace notificationManager { return pPromise; } - export function isNotificationEnabled(callback: AsyncCallback): void + export function isNotificationEnabled_chinast_5(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -1051,7 +1069,7 @@ export default namespace notificationManager { }) } - export function isNotificationEnabled(): Promise + export function isNotificationEnabled_chinast_6(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): boolean => { return nativeIsNotificationEnabled(); }); @@ -1065,7 +1083,10 @@ export default namespace notificationManager { return pPromise; } - export function setNotificationEnableSlot( + overload isNotificationEnabled{isNotificationEnabled_chinast_1, isNotificationEnabled_chinast_2, isNotificationEnabled_chinast_3, + isNotificationEnabled_chinast_4, isNotificationEnabled_chinast_5, isNotificationEnabled_chinast_6} + + export function setNotificationEnableSlot_chinast_1( bundle: BundleOption, type: SlotType, enable: boolean, @@ -1090,7 +1111,7 @@ export default namespace notificationManager { }); } - export function setNotificationEnableSlot( + export function setNotificationEnableSlot_chinast_2( bundle: BundleOption, type: SlotType, enable: boolean, isForceControl?: boolean): Promise { let error: BusinessError = isInvalidParameter(bundle); @@ -1114,7 +1135,7 @@ export default namespace notificationManager { return pPromise; } - export function setNotificationEnableSlot( + export function setNotificationEnableSlot_chinast_3( bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); @@ -1133,7 +1154,9 @@ export default namespace notificationManager { }) } - export function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise + overload setNotificationEnableSlot { setNotificationEnableSlot_chinast_1, setNotificationEnableSlot_chinast_2, setNotificationEnableSlot_chinast_3 }; + + export function isNotificationSlotEnabled_chinast_1(bundle: BundleOption, type: SlotType): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1151,7 +1174,7 @@ export default namespace notificationManager { return pPromise; } - export function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback): void + export function isNotificationSlotEnabled_chinast_2(bundle: BundleOption, type: SlotType, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1171,7 +1194,9 @@ export default namespace notificationManager { }) } - export function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback>): void + overload isNotificationSlotEnabled { isNotificationSlotEnabled_chinast_1, isNotificationSlotEnabled_chinast_2 }; + + export function getSlotsByBundle_chinast_1(bundle: BundleOption, callback: AsyncCallback>): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1191,7 +1216,7 @@ export default namespace notificationManager { }) } - export function getSlotsByBundle(bundle: BundleOption): Promise> + export function getSlotsByBundle_chinast_2(bundle: BundleOption): Promise> { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1210,6 +1235,8 @@ export default namespace notificationManager { return pPromise; } + overload getSlotsByBundle { getSlotsByBundle_chinast_1, getSlotsByBundle_chinast_2 }; + export function setSlotFlagsByBundle(bundle: BundleOption, slotFlags: number): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1243,7 +1270,7 @@ export default namespace notificationManager { return pPromise; } - export function publish(request: NotificationRequest, callback: AsyncCallback): void { + export function publish_chinast_1(request: NotificationRequest, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { throw error; @@ -1260,7 +1287,7 @@ export default namespace notificationManager { }); } - export function publish(request: NotificationRequest): Promise { + export function publish_chinast_2(request: NotificationRequest): Promise { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { throw error; @@ -1276,7 +1303,7 @@ export default namespace notificationManager { return pPromise; } - export function publish(request: NotificationRequest, userId: number, callback: AsyncCallback): void { + export function publish_chinast_3(request: NotificationRequest, userId: number, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { throw error; @@ -1293,7 +1320,7 @@ export default namespace notificationManager { }) } - export function publish(request: NotificationRequest, userId: number): Promise { + export function publish_chinast_4(request: NotificationRequest, userId: number): Promise { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { throw error; @@ -1309,6 +1336,8 @@ export default namespace notificationManager { return pPromise; } + overload publish { publish_chinast_1, publish_chinast_2, publish_chinast_3, publish_chinast_4 }; + export function triggerSystemLiveView( bundle: BundleOption, notificationId: number, buttonOptions: ButtonOptions): Promise { @@ -1379,7 +1408,7 @@ export default namespace notificationManager { return pPromise; } - export function getAllActiveNotifications(callback: AsyncCallback>): void { + export function getAllActiveNotifications_chinast_1(callback: AsyncCallback>): void { if (!callback) { throw errorParamInvalid; } @@ -1394,7 +1423,7 @@ export default namespace notificationManager { }) } - export function getAllActiveNotifications(): Promise> { + export function getAllActiveNotifications_chinast_2(): Promise> { let pPromise = new Promise>( (resolve: ResolveCallback>, reject: RejectCallback): void => { @@ -1409,7 +1438,9 @@ export default namespace notificationManager { return pPromise; } - export function getActiveNotifications(): Promise> { + overload getAllActiveNotifications { getAllActiveNotifications_chinast_1, getAllActiveNotifications_chinast_2 }; + + export function getActiveNotifications_chinast_1(): Promise> { let pPromise = new Promise>((resolve: ResolveCallback>, reject: RejectCallback): void => { let p = taskpool.execute((): Array => { return nativeGetActiveNotifications(); }); p.then((data: NullishType): void => { @@ -1422,7 +1453,7 @@ export default namespace notificationManager { return pPromise; } - export function getActiveNotifications(callback: AsyncCallback>): void { + export function getActiveNotifications_chinast_2(callback: AsyncCallback>): void { if (!callback) { throw errorParamInvalid; } @@ -1437,7 +1468,9 @@ export default namespace notificationManager { }) } - export function getActiveNotificationCount(callback: AsyncCallback): void + overload getActiveNotifications { getActiveNotifications_chinast_1, getActiveNotifications_chinast_2 }; + + export function getActiveNotificationCount_chinast_1(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -1452,7 +1485,7 @@ export default namespace notificationManager { }) } - export function getActiveNotificationCount(): Promise { + export function getActiveNotificationCount_chinast_2(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback):void => { let p = taskpool.execute((): number => { return nativeGetActiveNotificationCount(); }); p.then((data :NullishType): void => { @@ -1465,7 +1498,9 @@ export default namespace notificationManager { return pPromise; } - export function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void { + overload getActiveNotificationCount { getActiveNotificationCount_chinast_1, getActiveNotificationCount_chinast_2 }; + + export function displayBadge_chinast_1(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -1482,7 +1517,7 @@ export default namespace notificationManager { }) } - export function displayBadge(bundle: BundleOption, enable: boolean): Promise { + export function displayBadge_chinast_2(bundle: BundleOption, enable: boolean): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -1498,7 +1533,9 @@ export default namespace notificationManager { return pPromise; } - export function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback): void { + overload displayBadge { displayBadge_chinast_1, displayBadge_chinast_2 }; + + export function isBadgeDisplayed_chinast_1(bundle: BundleOption, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -1514,7 +1551,7 @@ export default namespace notificationManager { }) } - export function isBadgeDisplayed(bundle: BundleOption): Promise { + export function isBadgeDisplayed_chinast_2(bundle: BundleOption): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -1531,7 +1568,9 @@ export default namespace notificationManager { return pPromise; } - export function cancel(bundle: BundleOption, id: number): Promise { + overload isBadgeDisplayed { isBadgeDisplayed_chinast_1, isBadgeDisplayed_chinast_2 }; + + export function cancel_chinast_1(bundle: BundleOption, id: number): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -1547,7 +1586,7 @@ export default namespace notificationManager { return pPromise; } - export function cancel(id: number, label?: string): Promise { + export function cancel_chinast_2(id: number, label?: string): Promise { if (label == null || label?.length === 0) { throw errorParamInvalid; } @@ -1562,7 +1601,7 @@ export default namespace notificationManager { return pPromise; } - export function cancel(id: number, label: string, callback: AsyncCallback): void { + export function cancel_chinast_3(id: number, label: string, callback: AsyncCallback): void { if (label == null || label?.length === 0) { throw errorParamInvalid; } @@ -1578,7 +1617,7 @@ export default namespace notificationManager { }) } - export function cancel(id: number, callback: AsyncCallback): void { + export function cancel_chinast_4(id: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; } @@ -1591,7 +1630,9 @@ export default namespace notificationManager { }) } - export function cancelAll(): Promise { + overload cancel { cancel_chinast_1, cancel_chinast_2, cancel_chinast_3, cancel_chinast_4 }; + + export function cancelAll_chinast_1(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return nativeCancelAll(); }); p.then((data: NullishType): void => { @@ -1603,7 +1644,7 @@ export default namespace notificationManager { return pPromise; } - export function cancelAll(callback: AsyncCallback): void { + export function cancelAll_chinast_2(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; } @@ -1616,7 +1657,9 @@ export default namespace notificationManager { }) } - export function requestEnableNotification(context: UIAbilityContext): Promise + overload cancelAll { cancelAll_chinast_1, cancelAll_chinast_2 }; + + export function requestEnableNotification_chinast_1(context: UIAbilityContext): Promise { if (context == undefined) { throw errorParamInvalid; @@ -1644,7 +1687,7 @@ export default namespace notificationManager { return pPromise; } - export function requestEnableNotification(context: UIAbilityContext, callback: AsyncCallback): void + export function requestEnableNotification_chinast_2(context: UIAbilityContext, callback: AsyncCallback): void { if (context == undefined || callback == undefined) { throw errorParamInvalid; @@ -1670,6 +1713,8 @@ export default namespace notificationManager { ) } + overload requestEnableNotification { requestEnableNotification_chinast_1, requestEnableNotification_chinast_2 }; + export interface NotificationCheckResult { code: number; message: string; @@ -1680,7 +1725,7 @@ export default namespace notificationManager { public message: string = ''; } - export function on( + export function on_chinast_1( type: 'checkNotification', callback: (checkInfo: NotificationCheckInfo) => NotificationCheckResult): void { let errCode = nativeOn(type, callback); @@ -1690,7 +1735,7 @@ export default namespace notificationManager { } } - export function on(type: 'checkNotification', checkRequest: NotificationCheckRequest, + export function on_chinast_2(type: 'checkNotification', checkRequest: NotificationCheckRequest, callback: (checkInfo: NotificationCheckInfo) => Promise): void { let onFuncCallback: CallbackForCheckInfo = @@ -1720,6 +1765,8 @@ export default namespace notificationManager { } } + overload on { on_chinast_1, on_chinast_2 }; + export function off( type: 'checkNotification', callback?: (checkInfo: NotificationCheckInfo) => NotificationCheckResult @@ -1777,7 +1824,7 @@ export default namespace notificationManager { return nativeIsNotificationEnabledSync(); } - export function setBadgeNumber(badgeNumber: number, callback: AsyncCallback): void + export function setBadgeNumber_chinast_1(badgeNumber: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -1791,7 +1838,7 @@ export default namespace notificationManager { }) } - export function setBadgeNumber(badgeNumber: number): Promise { + export function setBadgeNumber_chinast_2(badgeNumber: number): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return nativeSetBadgeNumber(badgeNumber); }); p.then((data: NullishType): void => { @@ -1803,6 +1850,8 @@ export default namespace notificationManager { return pPromise; } + overload setBadgeNumber { setBadgeNumber_chinast_1, setBadgeNumber_chinast_2 }; + export function setBadgeNumberByBundle(bundle: BundleOption, badgeNumber: number): Promise { let error: BusinessError = isInvalidParameter(bundle); @@ -1820,7 +1869,7 @@ export default namespace notificationManager { return pPromise; } - export function getActiveNotificationByFilter(filter: NotificationFilter, callback: AsyncCallback): void + export function getActiveNotificationByFilter_chinast_1(filter: NotificationFilter, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(filter); if (error.code !== ERROR_OK) { @@ -1853,7 +1902,7 @@ export default namespace notificationManager { }) } - export function getActiveNotificationByFilter(filter: NotificationFilter): Promise + export function getActiveNotificationByFilter_chinast_2(filter: NotificationFilter): Promise { let error: BusinessError = isInvalidParameter(filter); if (error.code !== ERROR_OK) { @@ -1871,7 +1920,9 @@ export default namespace notificationManager { return pPromise; } - export function isSupportTemplate(templateName: string): Promise + overload getActiveNotificationByFilter { getActiveNotificationByFilter_chinast_1, getActiveNotificationByFilter_chinast_2 }; + + export function isSupportTemplate_chinast_1(templateName: string): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): boolean => { return nativeIsSupportTemplate(templateName); }); @@ -1885,7 +1936,7 @@ export default namespace notificationManager { return pPromise; } - export function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void + export function removeGroupByBundle_chinast_1(bundle: BundleOption, groupName: string, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1906,7 +1957,7 @@ export default namespace notificationManager { }) } - export function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise + export function removeGroupByBundle_chinast_2(bundle: BundleOption, groupName: string): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -1926,7 +1977,9 @@ export default namespace notificationManager { return pPromise; } - export function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback): void + overload removeGroupByBundle { removeGroupByBundle_chinast_1, removeGroupByBundle_chinast_2 }; + + export function publishAsBundle_chinast_1(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { @@ -1948,7 +2001,7 @@ export default namespace notificationManager { }); } - export function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise + export function publishAsBundle_chinast_2(request: NotificationRequest, representativeBundle: string, userId: number): Promise { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { @@ -1968,7 +2021,7 @@ export default namespace notificationManager { return pPromise; } - export function publishAsBundle(representativeBundle: BundleOption, request: NotificationRequest): Promise + export function publishAsBundle_chinast_3(representativeBundle: BundleOption, request: NotificationRequest): Promise { let error: BusinessError = isInvalidParameter(request); if (error.code !== ERROR_OK) { @@ -1989,7 +2042,9 @@ export default namespace notificationManager { return pPromise; } - export function cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback): void + overload publishAsBundle { publishAsBundle_chinast_1, publishAsBundle_chinast_2, publishAsBundle_chinast_3 }; + + export function cancelAsBundle_chinast_1(id: number, representativeBundle: string, userId: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2006,7 +2061,7 @@ export default namespace notificationManager { }); } - export function cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise + export function cancelAsBundle_chinast_2(id: number, representativeBundle: string, userId: number): Promise { if (representativeBundle == null || representativeBundle?.length === 0) { throw errorParamInvalid; @@ -2022,7 +2077,7 @@ export default namespace notificationManager { return pPromise; } - export function cancelAsBundle(representativeBundle: BundleOption, id: number): Promise + export function cancelAsBundle_chinast_3(representativeBundle: BundleOption, id: number): Promise { let error: BusinessError = isInvalidParameter(representativeBundle); if (error.code !== ERROR_OK) { @@ -2040,7 +2095,9 @@ export default namespace notificationManager { return pPromise; } - export function cancelGroup(groupName: string, callback: AsyncCallback): void + overload cancelAsBundle { cancelAsBundle_chinast_1, cancelAsBundle_chinast_2, cancelAsBundle_chinast_3 }; + + export function cancelGroup_chinast_1(groupName: string, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2057,7 +2114,7 @@ export default namespace notificationManager { }); } - export function cancelGroup(groupName: string): Promise + export function cancelGroup_chinast_2(groupName: string): Promise { if (groupName == null || groupName?.length === 0) { throw errorParamInvalid; @@ -2073,7 +2130,9 @@ export default namespace notificationManager { return pPromise; } - export function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback): void + overload cancelGroup { cancelGroup_chinast_1, cancelGroup_chinast_2 }; + + export function setDoNotDisturbDate_chinast_1(date: DoNotDisturbDate, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2091,7 +2150,7 @@ export default namespace notificationManager { }); } - export function setDoNotDisturbDate(date: DoNotDisturbDate): Promise + export function setDoNotDisturbDate_chinast_2(date: DoNotDisturbDate): Promise { let error: BusinessError = isInvalidParameter(date); if (error.code !== ERROR_OK) { @@ -2108,7 +2167,7 @@ export default namespace notificationManager { return pPromise; } - export function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback): void + export function setDoNotDisturbDate_chinast_3(date: DoNotDisturbDate, userId: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2126,7 +2185,7 @@ export default namespace notificationManager { }); } - export function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise + export function setDoNotDisturbDate_chinast_4(date: DoNotDisturbDate, userId: number): Promise { let error: BusinessError = isInvalidParameter(date); if (error.code !== ERROR_OK) { @@ -2143,7 +2202,9 @@ export default namespace notificationManager { return pPromise; } - export function getDoNotDisturbDate(callback: AsyncCallback): void + overload setDoNotDisturbDate { setDoNotDisturbDate_chinast_1, setDoNotDisturbDate_chinast_2, setDoNotDisturbDate_chinast_3, setDoNotDisturbDate_chinast_4 }; + + export function getDoNotDisturbDate_chinast_1(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2159,7 +2220,7 @@ export default namespace notificationManager { }) } - export function getDoNotDisturbDate(): Promise + export function getDoNotDisturbDate_chinast_2(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): DoNotDisturbDate => { return nativeGetDoNotDisturbDate(); }); @@ -2173,7 +2234,7 @@ export default namespace notificationManager { return pPromise; } - export function getDoNotDisturbDate(userId: number, callback: AsyncCallback): void + export function getDoNotDisturbDate_chinast_3(userId: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2189,7 +2250,7 @@ export default namespace notificationManager { }); } - export function getDoNotDisturbDate(userId: number): Promise + export function getDoNotDisturbDate_chinast_4(userId: number): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): DoNotDisturbDate => { return nativeGetDoNotDisturbDateWithId(userId); }); @@ -2203,7 +2264,9 @@ export default namespace notificationManager { return pPromise; } - export function isSupportDoNotDisturbMode(callback: AsyncCallback): void + overload getDoNotDisturbDate { getDoNotDisturbDate_chinast_1, getDoNotDisturbDate_chinast_2, getDoNotDisturbDate_chinast_3, getDoNotDisturbDate_chinast_4 }; + + export function isSupportDoNotDisturbMode_chinast_1(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2219,7 +2282,7 @@ export default namespace notificationManager { }) } - export function isSupportTemplate(templateName: string, callback: AsyncCallback): void + export function isSupportTemplate_chinast_2(templateName: string, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2235,7 +2298,9 @@ export default namespace notificationManager { }) } - export function isSupportDoNotDisturbMode(): Promise + overload isSupportTemplate { isSupportTemplate_chinast_1, isSupportTemplate_chinast_2 }; + + export function isSupportDoNotDisturbMode_chinast_2(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): boolean => { return nativeIsSupportDoNotDisturbMode(); }); @@ -2249,6 +2314,8 @@ export default namespace notificationManager { return pPromise; } + overload isSupportDoNotDisturbMode { isSupportDoNotDisturbMode_chinast_1, isSupportDoNotDisturbMode_chinast_2 }; + export function getDoNotDisturbProfile(id: number): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { @@ -2321,7 +2388,7 @@ export default namespace notificationManager { } - export function setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise + export function setDistributedEnableByBundle_chinast_1(bundle: BundleOption, enable: boolean): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -2421,7 +2488,7 @@ export default namespace notificationManager { return pPromise; } - export function setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void + export function setDistributedEnableByBundle_chinast_2(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -2439,7 +2506,9 @@ export default namespace notificationManager { }); } - export function setDistributedEnable(enable: boolean, callback: AsyncCallback): void + overload setDistributedEnableByBundle { setDistributedEnableByBundle_chinast_1, setDistributedEnableByBundle_chinast_2 }; + + export function setDistributedEnable_chinast_1(enable: boolean, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2453,7 +2522,7 @@ export default namespace notificationManager { }); } - export function setDistributedEnable(enable: boolean): Promise + export function setDistributedEnable_chinast_2(enable: boolean): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return nativeSetDistributedEnable(enable); }); @@ -2466,7 +2535,9 @@ export default namespace notificationManager { return pPromise; } - export function isDistributedEnabled(): Promise + overload setDistributedEnable { setDistributedEnable_chinast_1, setDistributedEnable_chinast_2 }; + + export function isDistributedEnabled_chinast_1(): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): boolean => { return nativeIsDistributedEnabled(); }); @@ -2480,7 +2551,7 @@ export default namespace notificationManager { return pPromise; } - export function isDistributedEnabled(callback: AsyncCallback): void + export function isDistributedEnabled_chinast_2(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2496,7 +2567,9 @@ export default namespace notificationManager { }) } - export function isDistributedEnabledByBundle(bundle: BundleOption): Promise + overload isDistributedEnabled { isDistributedEnabled_chinast_1, isDistributedEnabled_chinast_2 }; + + export function isDistributedEnabledByBundle_chinast_1(bundle: BundleOption): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -2514,7 +2587,7 @@ export default namespace notificationManager { return pPromise; } - export function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback): void + export function isDistributedEnabledByBundle_chinast_2(bundle: BundleOption, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); @@ -2535,7 +2608,7 @@ export default namespace notificationManager { }) } - export function isDistributedEnabledByBundle(bundle: BundleOption, deviceType: string): Promise + export function isDistributedEnabledByBundle_chinast_3(bundle: BundleOption, deviceType: string): Promise { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { @@ -2553,7 +2626,9 @@ export default namespace notificationManager { return pPromise; } - export function getDeviceRemindType(): Promise + overload isDistributedEnabledByBundle { isDistributedEnabledByBundle_chinast_1, isDistributedEnabledByBundle_chinast_2, isDistributedEnabledByBundle_chinast_3 }; + + export function getDeviceRemindType_chinast_1(): Promise { let pPromise = new Promise( (resolve: ResolveCallback, reject: RejectCallback): void => { @@ -2568,7 +2643,7 @@ export default namespace notificationManager { return pPromise; } - export function getDeviceRemindType(callback: AsyncCallback): void + export function getDeviceRemindType_chinast_2(callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2584,7 +2659,9 @@ export default namespace notificationManager { }) } - export function setSyncNotificationEnabledWithoutApp + overload getDeviceRemindType { getDeviceRemindType_chinast_1, getDeviceRemindType_chinast_2 }; + + export function setSyncNotificationEnabledWithoutApp_chinast_1 (userId: number, enable: boolean, callback: AsyncCallback): void { if (callback == null) { @@ -2600,7 +2677,7 @@ export default namespace notificationManager { }) } - export function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise + export function setSyncNotificationEnabledWithoutApp_chinast_2(userId: number, enable: boolean): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => @@ -2614,7 +2691,9 @@ export default namespace notificationManager { return pPromise; } - export function getSyncNotificationEnabledWithoutApp(userId: number): Promise { + overload setSyncNotificationEnabledWithoutApp { setSyncNotificationEnabledWithoutApp_chinast_1, setSyncNotificationEnabledWithoutApp_chinast_2 }; + + export function getSyncNotificationEnabledWithoutApp_chinast_1(userId: number): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): boolean => { return nativeGetSyncNotificationEnabledWithoutApp(userId); }); @@ -2628,7 +2707,7 @@ export default namespace notificationManager { return pPromise; } - export function getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback): void + export function getSyncNotificationEnabledWithoutApp_chinast_2(userId: number, callback: AsyncCallback): void { if (callback == null) { throw errorParamInvalid; @@ -2643,4 +2722,7 @@ export default namespace notificationManager { callback(err, ret); }) } + + overload getSyncNotificationEnabledWithoutApp { getSyncNotificationEnabledWithoutApp_chinast_1, getSyncNotificationEnabledWithoutApp_chinast_2 }; + } diff --git a/frameworks/ets/ets/@ohos.notificationSubscribe.ets b/frameworks/ets/ets/@ohos.notificationSubscribe.ets index 1f42a216f..340ad7211 100644 --- a/frameworks/ets/ets/@ohos.notificationSubscribe.ets +++ b/frameworks/ets/ets/@ohos.notificationSubscribe.ets @@ -84,7 +84,7 @@ export default namespace notificationSubscribe { export native function nativeRemoveAllForUserId(userId: number): void; export native function nativeRemoveAll(): void; - export function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void { + export function subscribe_chinast_1(subscriber: NotificationSubscriber, callback: AsyncCallback): void { if (subscriber == undefined || callback == undefined) { throw errorParamInvalid; } @@ -98,7 +98,7 @@ export default namespace notificationSubscribe { } ) } - export function subscribe( + export function subscribe_chinast_2( subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback @@ -116,7 +116,7 @@ export default namespace notificationSubscribe { } ) } - export function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise { + export function subscribe_chinast_3(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise { if (subscriber == undefined) { throw errorParamInvalid; } @@ -133,7 +133,9 @@ export default namespace notificationSubscribe { return pPromise; } - export function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void { + overload subscribe { subscribe_chinast_1, subscribe_chinast_2, subscribe_chinast_3 }; + + export function unsubscribe_chinast_1(subscriber: NotificationSubscriber, callback: AsyncCallback): void { if (subscriber == undefined || callback == undefined) { throw errorParamInvalid; } @@ -148,7 +150,7 @@ export default namespace notificationSubscribe { ) } - export function unsubscribe(subscriber: NotificationSubscriber): Promise { + export function unsubscribe_chinast_2(subscriber: NotificationSubscriber): Promise { if (subscriber == undefined) { throw errorParamInvalid; } @@ -165,7 +167,9 @@ export default namespace notificationSubscribe { return pPromise; } - export function remove( + overload unsubscribe { unsubscribe_chinast_1, unsubscribe_chinast_2 }; + + export function remove_chinast_1( bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, @@ -187,7 +191,7 @@ export default namespace notificationSubscribe { ) } - export function remove( + export function remove_chinast_2( bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason @@ -210,7 +214,7 @@ export default namespace notificationSubscribe { return pPromise; } - export function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback): void { + export function remove_chinast_3(hashCode: string, reason: RemoveReason, callback: AsyncCallback): void { if (hashCode == undefined || reason == undefined || callback == undefined) { throw errorParamInvalid; } @@ -227,7 +231,7 @@ export default namespace notificationSubscribe { ) } - export function remove(hashCode: string, reason: RemoveReason): Promise { + export function remove_chinast_4(hashCode: string, reason: RemoveReason): Promise { if (hashCode == undefined || reason == undefined) { throw errorParamInvalid; } @@ -246,7 +250,7 @@ export default namespace notificationSubscribe { return pPromise; } - export function remove(hashCodes: Array, reason: RemoveReason, callback: AsyncCallback): void { + export function remove_chinast_5(hashCodes: Array, reason: RemoveReason, callback: AsyncCallback): void { if (hashCodes == undefined || reason == undefined || callback == undefined) { throw errorParamInvalid; } @@ -263,7 +267,7 @@ export default namespace notificationSubscribe { ) } - export function remove(hashCodes: Array, reason: RemoveReason): Promise { + export function remove_chinast_6(hashCodes: Array, reason: RemoveReason): Promise { if (hashCodes == undefined || reason == undefined) { throw errorParamInvalid; } @@ -282,6 +286,8 @@ export default namespace notificationSubscribe { return pPromise; } + overload remove { remove_chinast_1, remove_chinast_2, remove_chinast_3, remove_chinast_4, remove_chinast_5, remove_chinast_6 }; + export function distributeOperation(hashcode: string, operationInfo?: OperationInfo): Promise { if (hashcode == undefined) { throw errorParamInvalid; @@ -340,7 +346,7 @@ export default namespace notificationSubscribe { return pPromise; } - export function removeAll(bundle: BundleOption, callback: AsyncCallback): void { + export function removeAll_chinast_1(bundle: BundleOption, callback: AsyncCallback): void { let error: BusinessError = isInvalidParameter(bundle); if (error.code !== ERROR_OK) { throw error; @@ -361,7 +367,7 @@ export default namespace notificationSubscribe { ) } - export function removeAll(bundle?: BundleOption): Promise + export function removeAll_chinast_2(bundle?: BundleOption): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { @@ -380,7 +386,7 @@ export default namespace notificationSubscribe { return pPromise; } - export function removeAll(callback: AsyncCallback): void { + export function removeAll_chinast_3(callback: AsyncCallback): void { if (callback == undefined) { throw errorParamInvalid; } @@ -397,7 +403,7 @@ export default namespace notificationSubscribe { ) } - export function removeAll(userId: number, callback: AsyncCallback): void { + export function removeAll_chinast_4(userId: number, callback: AsyncCallback): void { if (callback == undefined) { throw errorParamInvalid; } @@ -414,7 +420,7 @@ export default namespace notificationSubscribe { ) } - export function removeAll(userId: number): Promise { + export function removeAll_chinast_5(userId: number): Promise { let pPromise = new Promise((resolve: ResolveCallback, reject: RejectCallback): void => { let p = taskpool.execute((): void => { return notificationSubscribe.nativeRemoveAllForUserId(userId); }); p.then((data: NullishType): void => { @@ -425,4 +431,7 @@ export default namespace notificationSubscribe { }); return pPromise; } + + overload removeAll { removeAll_chinast_1, removeAll_chinast_2, removeAll_chinast_3, removeAll_chinast_4, removeAll_chinast_5 }; + } -- Gitee