mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-19 14:33:33 -04:00
Signed-off-by: zero-cyc <chenlien@huawei.com> Change-Id: Ideeca1ba818dcd69724209b22ff93beea829fcee
This commit is contained in:
@@ -39,7 +39,6 @@ import {
|
||||
import { mockNetwork } from './network'
|
||||
import { mockOhosNfc } from './ohos/nfc'
|
||||
import { mockNotification } from './notification'
|
||||
import { mockOhosNotification } from './ohos/notification'
|
||||
import { mockCommonEvent } from './ohos/commonEvent'
|
||||
import { mockWantAgent } from './ohos/wantAgent'
|
||||
import { mockOhosBatteryinfo } from './batteryinfo'
|
||||
@@ -93,7 +92,6 @@ export function mockSystemPlugin() {
|
||||
global.ohosplugin = {}
|
||||
|
||||
mockNotification()
|
||||
mockOhosNotification()
|
||||
mockCommonEvent()
|
||||
mockWantAgent()
|
||||
mockFetch()
|
||||
|
||||
@@ -3,6 +3,7 @@ import { mockAbility } from './applicationAbility'
|
||||
import { mockFormExtension } from './applicationFormExtension'
|
||||
import { mockServiceExtension } from './applicationServiceExtension'
|
||||
import { mockAbilityStage } from './applicationAbilityStage'
|
||||
import { mockNotification } from './notification'
|
||||
import { mockFileio } from './fileio'
|
||||
import { mockWorker } from './worker'
|
||||
import { mockUtil } from './util'
|
||||
@@ -42,9 +43,11 @@ export function mockRequireNapiFun() {
|
||||
return mockServiceExtension();
|
||||
case "application.AbilityStage":
|
||||
return mockAbilityStage();
|
||||
case "notification":
|
||||
return mockNotification();
|
||||
case "fileio":
|
||||
return mockFileio();
|
||||
case "worker" :
|
||||
case "worker":
|
||||
return mockWorker();
|
||||
case "util":
|
||||
return mockUtil();
|
||||
|
||||
@@ -0,0 +1,617 @@
|
||||
import { paramMock } from "../utils"
|
||||
|
||||
export function mockNotification() {
|
||||
const DateMock = {
|
||||
toString: function () {
|
||||
console.warn("Date.toString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toDateString: function () {
|
||||
console.warn("Date.toDateString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toTimeString: function () {
|
||||
console.warn("Date.toTimeString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toLocaleString: function () {
|
||||
console.warn("Date.toLocaleString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toLocaleDateString: function () {
|
||||
console.warn("Date.toLocaleDateString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toLocaleTimeString: function () {
|
||||
console.warn("Date.toLocaleTimeString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
valueOf: function () {
|
||||
console.warn("Date.valueOf interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getTime: function () {
|
||||
console.warn("Date.getTime interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getFullYear: function () {
|
||||
console.warn("Date.getFullYear interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCFullYear: function () {
|
||||
console.warn("Date.getUTCFullYear interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getMonth: function () {
|
||||
console.warn("Date.getMonth interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCMonth: function () {
|
||||
console.warn("Date.getUTCMonth interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getDate: function () {
|
||||
console.warn("Date.getDate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCDate: function () {
|
||||
console.warn("Date.getUTCDate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getDay: function () {
|
||||
console.warn("Date.getDay interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCDay: function () {
|
||||
console.warn("Date.getUTCDay interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getHours: function () {
|
||||
console.warn("Date.getHours interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCHours: function () {
|
||||
console.warn("Date.getUTCHours interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getMinutes: function () {
|
||||
console.warn("Date.getMinutes interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCMinutes: function () {
|
||||
console.warn("Date.getUTCMinutes interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getSeconds: function () {
|
||||
console.warn("Date.getSeconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCSeconds: function () {
|
||||
console.warn("Date.getUTCSeconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getMilliseconds: function () {
|
||||
console.warn("Date.getMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getUTCMilliseconds: function () {
|
||||
console.warn("Date.getUTCMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getTimezoneOffset: function () {
|
||||
console.warn("Date.getTimezoneOffset interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setTime: function (...args) {
|
||||
console.warn("Date.setTime interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setMilliseconds: function (...args) {
|
||||
console.warn("Date.setMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCMilliseconds: function (...args) {
|
||||
console.warn("Date.setUTCMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setSeconds: function (...args) {
|
||||
console.warn("Date.setSeconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCSeconds: function (...args) {
|
||||
console.warn("Date.setUTCSeconds interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setMinutes: function (...args) {
|
||||
console.warn("Date.setMinutes interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCMinutes: function (...args) {
|
||||
console.warn("Date.setUTCMinutes interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setHours: function (...args) {
|
||||
console.warn("Date.setHours interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCHours: function (...args) {
|
||||
console.warn("Date.setUTCHours interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setDate: function (...args) {
|
||||
console.warn("Date.setDate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCDate: function (...args) {
|
||||
console.warn("Date.setUTCDate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setMonth: function (...args) {
|
||||
console.warn("Date.setMonth interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCMonth: function (...args) {
|
||||
console.warn("Date.setUTCMonth interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setFullYear: function (...args) {
|
||||
console.warn("Date.setFullYear interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
setUTCFullYear: function (...args) {
|
||||
console.warn("Date.setUTCFullYear interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
toUTCString: function () {
|
||||
console.warn("Date.toUTCString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toISOString: function () {
|
||||
console.warn("Date.toISOString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
toJSON: function (...args) {
|
||||
console.warn("Date.toJSON interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
}
|
||||
const DoNotDisturbDateMock = {
|
||||
DoNotDisturbTypeMock:'[PC preview] unknow DoNotDisturbTypeMock',
|
||||
begin: DateMock,
|
||||
end: DateMock
|
||||
}
|
||||
const NotificationSlotMock = {
|
||||
SlotTypeMock: '[PC preview] unknow SlotTypeMock',
|
||||
SlotLevelMock: '[PC preview] unknow SlotLevelMock',
|
||||
desc: '[PC preview] unknow desc',
|
||||
badgeFlag: '[PC preview] unknow badgeFlag',
|
||||
bypassDnd: '[PC preview] unknow bypassDnd',
|
||||
lockscreenVisibility: '[PC preview] unknow lockscreenVisibility',
|
||||
vibrationEnabled: '[PC preview] unknow vibrationEnabled',
|
||||
sound: '[PC preview] unknow sound',
|
||||
lightEnabled: '[PC preview] unknow lightEnabled',
|
||||
lightColor: '[PC preview] unknow lightColor',
|
||||
vibrationValues: [paramMock.paramNumberMock]
|
||||
};
|
||||
const NotificationActionButtonMock = {
|
||||
title: '[PC preview] unknow title',
|
||||
wantAgent: '[PC preview] unknow wantAgent',
|
||||
extras: {},
|
||||
userInput: '[PC preview] unknow userInput',
|
||||
}
|
||||
const NotificationRequestMock = {
|
||||
content: '[PC preview] unknow content',
|
||||
id: '[PC preview] unknow id',
|
||||
slotTypeMock: '[PC preview] unknow slotTypeMock',
|
||||
isOngoing: '[PC preview] unknow isOngoing',
|
||||
isUnremovable: '[PC preview] unknow isUnremovable',
|
||||
deliveryTime: '[PC preview] unknow deliveryTime',
|
||||
tapDismissed: '[PC preview] unknow tapDismissed',
|
||||
autoDeletedTime: '[PC preview] unknow autoDeletedTime',
|
||||
wantAgent: '[PC preview] unknow wantAgent',
|
||||
extraInfo: {},
|
||||
color: '[PC preview] unknow color',
|
||||
colorEnabled: '[PC preview] unknow colorEnabled',
|
||||
isAlertOnce: '[PC preview] unknow isAlertOnce',
|
||||
isStopwatch: '[PC preview] unknow isStopwatch',
|
||||
isCountDown: '[PC preview] unknow isCountDown',
|
||||
isFloatingIcon: '[PC preview] unknow isFloatingIcon',
|
||||
label: '[PC preview] unknow label',
|
||||
badgeIconStyle: '[PC preview] unknow badgeIconStyle',
|
||||
showDeliveryTime: '[PC preview] unknow showDeliveryTime',
|
||||
actionButtons: [NotificationActionButtonMock],
|
||||
smallIcon: '[PC preview] unknow smallIcon',
|
||||
largeIcon: '[PC preview] unknow largeIcon',
|
||||
groupName: '[PC preview] unknow groupName',
|
||||
creatorBundleName: '[PC preview] unknow creatorBundleName',
|
||||
creatorUid: '[PC preview] unknow creatorUid',
|
||||
creatorPid: '[PC preview] unknow creatorPid',
|
||||
classification: '[PC preview] unknow classification',
|
||||
hashCode: '[PC preview] unknow hashCode',
|
||||
isRemveAllowd: '[PC preview] unknow isRemveAllowd',
|
||||
source: '[PC preview] unknow source',
|
||||
template: '[PC preview] unknow template'
|
||||
};
|
||||
const notification = {
|
||||
publish: function(...args) {
|
||||
console.warn('notification.publish interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel: function(...args) {
|
||||
console.warn('notification.cancel interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
cancelAll: function(...args) {
|
||||
console.warn('notification.cancelAll interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
addSlot: function(...args) {
|
||||
console.warn('notification.addSlot interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
addSlots: function(...args) {
|
||||
console.warn('notification.addSlots interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlot: function(...args) {
|
||||
console.warn('notification.getSlot interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, NotificationSlotMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(NotificationSlotMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlots: function(...args) {
|
||||
console.warn('notification.getSlots interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationSlotMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationSlotMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
removeSlot: function(...args) {
|
||||
console.warn('notification.removeSlot interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
removeAllSlots: function(...args) {
|
||||
console.warn('notification.removeAllSlots interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
subscribe: function(...args) {
|
||||
console.warn('notification.subscribe interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
unsubscribe: function(...args) {
|
||||
console.warn('notification.unsubscribe interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
enableNotification: function(...args) {
|
||||
console.warn('notification.enableNotification interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
isNotificationEnabled: function(...args) {
|
||||
console.warn('notification.isNotificationEnabled interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
displayBadge: function(...args) {
|
||||
console.warn('notification.displayBadge interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
isBadgeDisplayed: function(...args) {
|
||||
console.warn('notification.isBadgeDisplayed interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
setSlotByBundle: function(...args) {
|
||||
console.warn('notification.setSlotByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlotsByBundle: function(...args) {
|
||||
console.warn('notification.getSlotsByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationSlotMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationSlotMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlotNumByBundle: function(...args) {
|
||||
console.warn('notification.getSlotNumByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
remove: function(...args) {
|
||||
console.warn('notification.remove interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
removeAll: function(...args) {
|
||||
console.warn('notification.removeAll interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getAllActiveNotifications: function(...args) {
|
||||
console.warn('notification.getAllActiveNotifications interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationRequestMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationRequestMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
getActiveNotificationCount: function(...args) {
|
||||
console.warn('notification.getActiveNotificationCount interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
getActiveNotifications: function(...args) {
|
||||
console.warn('notification.getActiveNotifications interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationRequestMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationRequestMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
cancelGroup: function (...args) {
|
||||
console.warn("notification.cancelGroup interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
removeGroupByBundle: function (...args) {
|
||||
console.warn("notification.removeGroupByBundle interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
setDoNotDisturbDate: function (...args) {
|
||||
console.warn("notification.setDoNotDisturbDate interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
getDoNotDisturbDate: function (...args) {
|
||||
console.warn("notification.getDoNotDisturbDate interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, DoNotDisturbDateMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(DoNotDisturbDateMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
supportDoNotDisturbMode: function (...args) {
|
||||
console.warn("notification.supportDoNotDisturbMode interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return notification
|
||||
}
|
||||
@@ -1,487 +0,0 @@
|
||||
import {paramMock} from '../utils';
|
||||
|
||||
export function mockOhosNotification() {
|
||||
const NotificationSlotMock = {
|
||||
type: '[PC preview] unknow type',
|
||||
level: '[PC preview] unknow level',
|
||||
desc: '[PC preview] unknow desc',
|
||||
badgeFlag: '[PC preview] unknow badgeFlag',
|
||||
bypassDnd: '[PC preview] unknow bypassDnd',
|
||||
lockscreenVisibility: '[PC preview] unknow lockscreenVisibility',
|
||||
vibrationEnabled: '[PC preview] unknow vibrationEnabled',
|
||||
sound: '[PC preview] unknow sound',
|
||||
lightEnabled: '[PC preview] unknow lightEnabled',
|
||||
lightColor: '[PC preview] unknow lightColor',
|
||||
vibrationValues: '[PC preview] unknow vibrationValues'
|
||||
};
|
||||
const DoNotDisturbDateMock = {
|
||||
type: '[PC preview] unknow type',
|
||||
begin: '[PC preview] unknow begin',
|
||||
end: '[PC preview] unknow end'
|
||||
};
|
||||
const NotificationRequestMock = {
|
||||
content: '[PC preview] unknow content',
|
||||
id: '[PC preview] unknow id',
|
||||
slotType: '[PC preview] unknow slotType',
|
||||
isOngoing: '[PC preview] unknow isOngoing',
|
||||
isUnremovable: '[PC preview] unknow isUnremovable',
|
||||
deliveryTime: '[PC preview] unknow deliveryTime',
|
||||
tapDismissed: '[PC preview] unknow tapDismissed',
|
||||
autoDeletedTime: '[PC preview] unknow autoDeletedTime',
|
||||
wantAgent: '[PC preview] unknow wantAgent',
|
||||
extraInfo: '[PC preview] unknow extraInfo',
|
||||
color: '[PC preview] unknow color',
|
||||
colorEnabled: '[PC preview] unknow colorEnabled',
|
||||
isAlertOnce: '[PC preview] unknow isAlertOnce',
|
||||
isStopwatch: '[PC preview] unknow isStopwatch',
|
||||
isCountDown: '[PC preview] unknow isCountDown',
|
||||
isFloatingIcon: '[PC preview] unknow isFloatingIcon',
|
||||
label: '[PC preview] unknow label',
|
||||
badgeIconStyle: '[PC preview] unknow badgeIconStyle',
|
||||
showDeliveryTime: '[PC preview] unknow showDeliveryTime',
|
||||
actionButtons: '[PC preview] unknow actionButtons',
|
||||
creatorBundleName: '[PC preview] unknow creatorBundleName',
|
||||
creatorUid: '[PC preview] unknow creatorUid',
|
||||
creatorPid: '[PC preview] unknow creatorPid',
|
||||
classification: '[PC preview] unknow classification',
|
||||
hashCode: '[PC preview] unknow hashCode',
|
||||
groupName: '[PC preview] unknow groupName',
|
||||
template: '[PC preview] unknow template'
|
||||
};
|
||||
global.ohosplugin.notification = {
|
||||
SlotType: {
|
||||
UNKNOWN_TYPE: 0,
|
||||
SOCIAL_COMMUNICATION: 1,
|
||||
SERVICE_INFORMATION: 2,
|
||||
CONTENT_INFORMATION: 3,
|
||||
OTHER_TYPES: 0xFFFF
|
||||
},
|
||||
ContentType: {
|
||||
NOTIFICATION_CONTENT_BASIC_TEXT: 0,
|
||||
NOTIFICATION_CONTENT_LONG_TEXT: 1,
|
||||
NOTIFICATION_CONTENT_PICTURE: 2,
|
||||
NOTIFICATION_CONTENT_CONVERSATION: 3,
|
||||
NOTIFICATION_CONTENT_MULTILINE: 4
|
||||
},
|
||||
SlotLevel: {
|
||||
LEVEL_NONE: 0,
|
||||
LEVEL_MIN: 1,
|
||||
LEVEL_LOW: 2,
|
||||
LEVEL_DEFAULT: 3,
|
||||
LEVEL_HIGH: 4
|
||||
},
|
||||
publish: function(...args) {
|
||||
console.warn('notification.publish interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel: function(...args) {
|
||||
console.warn('notification.cancel interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
cancelAll: function(...args) {
|
||||
console.warn('notification.cancelAll interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
addSlot: function(...args) {
|
||||
console.warn('notification.addSlot interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
addSlots: function(...args) {
|
||||
console.warn('notification.addSlots interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlot: function(...args) {
|
||||
console.warn('notification.getSlot interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, NotificationSlotMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(NotificationSlotMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlots: function(...args) {
|
||||
console.warn('notification.getSlots interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationSlotMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationSlotMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
removeSlot: function(...args) {
|
||||
console.warn('notification.removeSlot interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
removeAllSlots: function(...args) {
|
||||
console.warn('notification.removeAllSlots interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
subscribe: function(...args) {
|
||||
console.warn('notification.subscribe interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
unsubscribe: function(...args) {
|
||||
console.warn('notification.unsubscribe interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
enableNotification: function(...args) {
|
||||
console.warn('notification.enableNotification interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
isNotificationEnabled: function(...args) {
|
||||
console.warn('notification.isNotificationEnabled interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
displayBadge: function(...args) {
|
||||
console.warn('notification.displayBadge interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
isBadgeDisplayed: function(...args) {
|
||||
console.warn('notification.isBadgeDisplayed interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
setSlotByBundle: function(...args) {
|
||||
console.warn('notification.setSlotByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlotsByBundle: function(...args) {
|
||||
console.warn('notification.getSlotsByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationSlotMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationSlotMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
getSlotNumByBundle: function(...args) {
|
||||
console.warn('notification.getSlotNumByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
remove: function(...args) {
|
||||
console.warn('notification.remove interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
removeAll: function(...args) {
|
||||
console.warn('notification.removeAll interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getAllActiveNotifications: function(...args) {
|
||||
console.warn('notification.getAllActiveNotifications interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationRequestMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationRequestMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
getActiveNotificationCount: function(...args) {
|
||||
console.warn('notification.getActiveNotificationCount interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
getActiveNotifications: function(...args) {
|
||||
console.warn('notification.getActiveNotifications interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [NotificationRequestMock]);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([NotificationRequestMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
isDistributedEnabled: function(...args) {
|
||||
console.warn('notification.isDistributedEnabled interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
enableDistributed: function(...args) {
|
||||
console.warn('notification.enableDistributed interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
enableDistributedSelf: function(...args) {
|
||||
console.warn('notification.enableDistributedSelf interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
enableDistributedByBundle: function(...args) {
|
||||
console.warn('notification.enableDistributedByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
isDistributedEnabledByBundle: function(...args) {
|
||||
console.warn('notification.isDistributedEnabledByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
cancelGroup: function(...args) {
|
||||
console.warn('notification.cancelGroup interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
removeGroupByBundle: function(...args) {
|
||||
console.warn('notification.removeGroupByBundle interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
isSupportDoNotDisturbMode: function(...args) {
|
||||
console.warn('notification.isSupportDoNotDisturbMode interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
setDoNotDisturbDate: function(...args) {
|
||||
console.warn('notification.setDoNotDisturbDate interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getDoNotDisturbDate: function(...args) {
|
||||
console.warn('notification.getDoNotDisturbDate interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, DoNotDisturbDateMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(DoNotDisturbDateMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
DoNotDisturbType: {
|
||||
TYPE_NONE: 0,
|
||||
TYPE_ONCE: 1,
|
||||
TYPE_DAILY: 2,
|
||||
TYPE_CLEARLY: 3
|
||||
},
|
||||
TemplateType: {
|
||||
TYPE_NONE: 0,
|
||||
TYPE_PROCESS_BAR: 0x100
|
||||
},
|
||||
DoNotDisturbMode: {
|
||||
ALLOW_UNKNOWN: 0,
|
||||
ALLOW_ALL: 1,
|
||||
ALLOW_PRIORITY: 2,
|
||||
ALLOW_NONE: 3,
|
||||
ALLOW_ALARMS: 4
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user