• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import { paramMock } from "../../../utils"
16export const Result = {
17    code: "[PC Preview] unknow code",
18    data: "[PC Preview] unknow data",
19}
20export const SubscribeMessageResponse = {
21    deviceId: "[PC Preview] unknow deviceId",
22    bundleName: "[PC Preview] unknow bundleName",
23    abilityName: "[PC Preview] unknow abilityName",
24    message: "[PC Preview] unknow message",
25}
26export const CallAbilityParam = {
27    bundleName: "[PC Preview] unknow bundleName",
28    abilityName: "[PC Preview] unknow abilityName",
29    messageCode: "[PC Preview] unknow messageCode",
30    abilityType: "[PC Preview] unknow abilityType",
31    data: "[PC Preview] unknow data",
32    syncOption: "[PC Preview] unknow syncOption",
33}
34export const SubscribeAbilityEventParam = {
35    bundleName: "[PC Preview] unknow bundleName",
36    abilityName: "[PC Preview] unknow abilityName",
37    messageCode: "[PC Preview] unknow messageCode",
38    abilityType: "[PC Preview] unknow abilityType",
39    syncOption: "[PC Preview] unknow syncOption",
40}
41export const SendMessageOptions = {
42    deviceId: "[PC Preview] unknow deviceId",
43    bundleName: "[PC Preview] unknow bundleName",
44    abilityName: "[PC Preview] unknow abilityName",
45    message: "[PC Preview] unknow message",
46    success: function () {
47        console.warn("SendMessageOptions.success interface mocked in the Previewer." +
48          " How this interface works on the Previewer may be different from that on a real device.")
49    },
50    fail: function (...args) {
51        console.warn("SendMessageOptions.fail interface mocked in the Previewer." +
52          " How this interface works on the Previewer may be different from that on a real device.")
53    },
54    complete: function () {
55        console.warn("SendMessageOptions.complete interface mocked in the Previewer." +
56          " How this interface works on the Previewer may be different from that on a real device.")
57    }
58}
59export const SubscribeMessageOptions = {
60    success: function (...args) {
61        console.warn("SubscribeMessageOptions.success interface mocked in the Previewer." +
62          " How this interface works on the Previewer may be different from that on a real device.")
63    },
64    fail: function (...args) {
65        console.warn("SubscribeMessageOptions.fail interface mocked in the Previewer." +
66          " How this interface works on the Previewer may be different from that on a real device.")
67    },
68}
69export const RequestParams = {
70    bundleName: "[PC Preview] unknow bundleName",
71    abilityName: "[PC Preview] unknow abilityName",
72    entities: [paramMock.paramStringMock],
73    action: "[PC Preview] unknow action",
74    deviceType: "[PC Preview] unknow deviceType",
75    data: "[PC Preview] unknow data",
76    flag: "[PC Preview] unknow flag",
77    url: "[PC Preview] unknow url",
78}
79export const FinishWithResultParams = {
80    code: "[PC Preview] unknow code",
81    result: "[PC Preview] unknow result",
82}
83export const FeatureAbilityClass = class FeatureAbility {
84    constructor() {
85      console.warn('FeatureAbility.constructor interface mocked in the Previewer. How this interface works on' +
86        ' the Previewer may be different from that on a real device.');
87      this.startAbility = function (...args) {
88        console.warn("FeatureAbility.startAbility interface mocked in the Previewer. How this interface works on the Previewer" +
89          " may be different from that on a real device.")
90        return new Promise((resolve, reject) => {
91            resolve(Result);
92        })
93      };
94      this.startAbilityForResult = function (...args) {
95        console.warn("FeatureAbility.startAbilityForResult interface mocked in the Previewer. How this interface works on the Previewer" +
96          " may be different from that on a real device.")
97        return new Promise((resolve, reject) => {
98            resolve(Result);
99        })
100      };
101      this.finishWithResult = function (...args) {
102        console.warn("FeatureAbility.finishWithResult interface mocked in the Previewer. How this interface works on the Previewer" +
103          " may be different from that on a real device.")
104        return new Promise((resolve, reject) => {
105            resolve(Result);
106        })
107      };
108      this.getDeviceList = function (...args) {
109        console.warn("FeatureAbility.getDeviceList interface mocked in the Previewer. How this interface works on the Previewer" +
110          " may be different from that on a real device.")
111        return new Promise((resolve, reject) => {
112            resolve(Result);
113        })
114      };
115      this.callAbility = function (...args) {
116        console.warn("FeatureAbility.callAbility interface mocked in the Previewer. How this interface works on the Previewer" +
117          " may be different from that on a real device.")
118        return new Promise((resolve, reject) => {
119            resolve(paramMock.paramStringMock);
120        })
121      };
122      this.continueAbility = function () {
123        console.warn("FeatureAbility.continueAbility interface mocked in the Previewer. How this interface works on the Previewer" +
124          " may be different from that on a real device.")
125        return new Promise((resolve, reject) => {
126            resolve(Result);
127        })
128      };
129      this.subscribeAbilityEvent = function (...args) {
130        console.warn("FeatureAbility.subscribeAbilityEvent interface mocked in the Previewer. How this interface works on the Previewer" +
131          " may be different from that on a real device.")
132        return new Promise((resolve, reject) => {
133            resolve(paramMock.paramStringMock);
134        })
135      };
136      this.unsubscribeAbilityEvent = function (...args) {
137        console.warn("FeatureAbility.unsubscribeAbilityEvent interface mocked in the Previewer. How this interface works on the Previewer" +
138          " may be different from that on a real device.")
139        return new Promise((resolve, reject) => {
140            resolve(paramMock.paramStringMock);
141        })
142      };
143      this.sendMsg = function (...args) {
144        console.warn("FeatureAbility.sendMsg interface mocked in the Previewer. How this interface works on the Previewer" +
145          " may be different from that on a real device.")
146      };
147      this.subscribeMsg = function (...args) {
148        console.warn("FeatureAbility.subscribeMsg interface mocked in the Previewer. How this interface works on the Previewer" +
149          " may be different from that on a real device.")
150      };
151      this.unsubscribeMsg = function () {
152        console.warn("FeatureAbility.unsubscribeMsg interface mocked in the Previewer. How this interface works on the Previewer" +
153          " may be different from that on a real device.")
154      };
155    }
156}