• 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 { FormBindingData } from "../ohos_application_formBindingData"
16import { FormState } from "../ohos_application_formInfo"
17import { paramMock } from "../../utils"
18import { RemoteObjectClass } from "../ohos_rpc"
19import { ResultSet, PacMapType } from "../ohos_ability_featureAbility"
20
21const DataAbilityResult = {
22    uri: "[PC Preview] unknow uri",
23    count: "[PC Preview] unknow count",
24}
25export const LifecycleForm = {
26    onCreate: function (...args) {
27        console.warn("LifecycleForm.onCreate interface mocked in the Previewer. How this interface works on the Previewer may" +
28          " be different from that on a real device.")
29        return FormBindingData;
30    },
31    onCastToNormal: function (...args) {
32        console.warn("LifecycleForm.onCastToNormal interface mocked in the Previewer. How this interface works on the Previewer may" +
33          " be different from that on a real device.")
34    },
35    onUpdate: function (...args) {
36        console.warn("LifecycleForm.onUpdate interface mocked in the Previewer. How this interface works on the Previewer may" +
37          " be different from that on a real device.")
38    },
39    onVisibilityChange: function (...args) {
40        console.warn("LifecycleForm.onVisibilityChange interface mocked in the Previewer. How this interface works on the Previewer may" +
41          " be different from that on a real device.")
42    },
43    onEvent: function (...args) {
44        console.warn("LifecycleForm.onEvent interface mocked in the Previewer. How this interface works on the Previewer may" +
45          " be different from that on a real device.")
46    },
47    onDestroy: function (...args) {
48        console.warn("LifecycleForm.onDestroy interface mocked in the Previewer. How this interface works on the Previewer may" +
49          " be different from that on a real device.")
50    },
51    onAcquireFormState: function (...args) {
52        console.warn("LifecycleForm.onAcquireFormState interface mocked in the Previewer. How this interface works on the Previewer may" +
53          " be different from that on a real device.")
54        return FormState;
55    },
56    onShare: function (...args) {
57      console.warn("LifecycleForm.onShare interface mocked in the Previewer. How this interface works on the Previewer may" +
58        " be different from that on a real device.")
59      return {"key": "unknow any"};
60  },
61}
62export const LifecycleApp = {
63    onShow: function () {
64        console.warn("LifecycleApp.onShow interface mocked in the Previewer. How this interface works on the Previewer may" +
65          " be different from that on a real device.")
66    },
67    onHide: function () {
68        console.warn("LifecycleApp.onHide interface mocked in the Previewer. How this interface works on the Previewer may" +
69          " be different from that on a real device.")
70    },
71    onDestroy: function () {
72        console.warn("LifecycleApp.onDestroy interface mocked in the Previewer. How this interface works on the Previewer may" +
73          " be different from that on a real device.")
74    },
75    onCreate: function () {
76        console.warn("LifecycleApp.onCreate interface mocked in the Previewer. How this interface works on the Previewer may" +
77          " be different from that on a real device.")
78    },
79    onWindowDisplayModeChanged: function (...args) {
80        console.warn("LifecycleApp.onWindowDisplayModeChanged interface mocked in the Previewer. How this interface works on the Previewer may" +
81          " be different from that on a real device.")
82    },
83    onStartContinuation: function () {
84        console.warn("LifecycleApp.onStartContinuation interface mocked in the Previewer. How this interface works on the Previewer may" +
85          " be different from that on a real device.")
86        return paramMock.paramBooleanMock;
87    },
88    onSaveData: function (...args) {
89        console.warn("LifecycleApp.onSaveData interface mocked in the Previewer. How this interface works on the Previewer may" +
90          " be different from that on a real device.")
91        return paramMock.paramBooleanMock;
92    },
93    onCompleteContinuation: function (...args) {
94        console.warn("LifecycleApp.onCompleteContinuation interface mocked in the Previewer. How this interface works on the Previewer may" +
95          " be different from that on a real device.")
96    },
97    onRestoreData: function (...args) {
98        console.warn("LifecycleApp.onRestoreData interface mocked in the Previewer. How this interface works on the Previewer may" +
99          " be different from that on a real device.")
100    },
101    onRemoteTerminated: function () {
102        console.warn("LifecycleApp.onRemoteTerminated interface mocked in the Previewer. How this interface works on the Previewer may" +
103          " be different from that on a real device.")
104    },
105    onSaveAbilityState: function (...args) {
106        console.warn("LifecycleApp.onSaveAbilityState interface mocked in the Previewer. How this interface works on the Previewer may" +
107          " be different from that on a real device.")
108    },
109    onRestoreAbilityState: function (...args) {
110        console.warn("LifecycleApp.onRestoreAbilityState interface mocked in the Previewer. How this interface works on the Previewer may" +
111          " be different from that on a real device.")
112    },
113    onInactive: function () {
114        console.warn("LifecycleApp.onInactive interface mocked in the Previewer. How this interface works on the Previewer may" +
115          " be different from that on a real device.")
116    },
117    onActive: function () {
118        console.warn("LifecycleApp.onActive interface mocked in the Previewer. How this interface works on the Previewer may" +
119          " be different from that on a real device.")
120    },
121    onNewWant: function (...args) {
122        console.warn("LifecycleApp.onNewWant interface mocked in the Previewer. How this interface works on the Previewer may" +
123          " be different from that on a real device.")
124    },
125    onMemoryLevel: function (...args) {
126        console.warn("LifecycleApp.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer may" +
127          " be different from that on a real device.")
128    },
129}
130export const LifecycleService = {
131    onStart: function () {
132        console.warn("LifecycleService.onStart interface mocked in the Previewer. How this interface works on the Previewer may" +
133          " be different from that on a real device.")
134    },
135    onCommand: function (...args) {
136        console.warn("LifecycleService.onCommand interface mocked in the Previewer. How this interface works on the Previewer may" +
137          " be different from that on a real device.")
138    },
139    onStop: function () {
140        console.warn("LifecycleService.onStop interface mocked in the Previewer. How this interface works on the Previewer may" +
141          " be different from that on a real device.")
142    },
143    onConnect: function (...args) {
144        console.warn("LifecycleService.onConnect interface mocked in the Previewer. How this interface works on the Previewer may" +
145          " be different from that on a real device.")
146        return new RemoteObjectClass();
147    },
148    onDisconnect: function (...args) {
149        console.warn("LifecycleService.onDisconnect interface mocked in the Previewer. How this interface works on the Previewer may" +
150          " be different from that on a real device.")
151    },
152    onReconnect: function (...args) {
153        console.warn("LifecycleService.onReconnect interface mocked in the Previewer. How this interface works on the Previewer may" +
154          " be different from that on a real device.")
155    },
156}
157export const LifecycleData = {
158    update: function (...args) {
159        console.warn("LifecycleData.update interface mocked in the Previewer. How this interface works on the Previewer" +
160          " may be different from that on a real device.")
161        const len = args.length
162        if (typeof args[len - 1] === 'function') {
163          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
164        }
165    },
166    query: function (...args) {
167        console.warn("LifecycleData.query interface mocked in the Previewer. How this interface works on the Previewer" +
168          " may be different from that on a real device.")
169        const len = args.length
170        if (typeof args[len - 1] === 'function') {
171          args[len - 1].call(this, paramMock.businessErrorMock, ResultSet);
172        }
173    },
174    delete: function (...args) {
175        console.warn("LifecycleData.delete interface mocked in the Previewer. How this interface works on the Previewer" +
176          " may be different from that on a real device.")
177        const len = args.length
178        if (typeof args[len - 1] === 'function') {
179          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
180        }
181    },
182    normalizeUri: function (...args) {
183        console.warn("LifecycleData.normalizeUri interface mocked in the Previewer. How this interface works on the Previewer" +
184          " may be different from that on a real device.")
185        const len = args.length
186        if (typeof args[len - 1] === 'function') {
187          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock);
188        }
189    },
190    batchInsert: function (...args) {
191        console.warn("LifecycleData.batchInsert interface mocked in the Previewer. How this interface works on the Previewer" +
192          " may be different from that on a real device.")
193        const len = args.length
194        if (typeof args[len - 1] === 'function') {
195          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
196        }
197    },
198    denormalizeUri: function (...args) {
199        console.warn("LifecycleData.denormalizeUri interface mocked in the Previewer. How this interface works on the Previewer" +
200          " may be different from that on a real device.")
201        const len = args.length
202        if (typeof args[len - 1] === 'function') {
203          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock);
204        }
205    },
206    insert: function (...args) {
207        console.warn("LifecycleData.insert interface mocked in the Previewer. How this interface works on the Previewer" +
208          " may be different from that on a real device.")
209        const len = args.length
210        if (typeof args[len - 1] === 'function') {
211          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
212        }
213    },
214    openFile: function (...args) {
215        console.warn("LifecycleData.openFile interface mocked in the Previewer. How this interface works on the Previewer" +
216          " may be different from that on a real device.")
217        const len = args.length
218        if (typeof args[len - 1] === 'function') {
219          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
220        }
221    },
222    getFileTypes: function (...args) {
223        console.warn("LifecycleData.getFileTypes interface mocked in the Previewer. How this interface works on the Previewer" +
224          " may be different from that on a real device.")
225        const len = args.length
226        if (typeof args[len - 1] === 'function') {
227          args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramStringMock]);
228        }
229    },
230    onInitialized: function (...args) {
231        console.warn("LifecycleData.onInitialized interface mocked in the Previewer. How this interface works on the Previewer may" +
232          " be different from that on a real device.")
233    },
234    getType: function (...args) {
235        console.warn("LifecycleData.getType interface mocked in the Previewer. How this interface works on the Previewer" +
236          " may be different from that on a real device.")
237        const len = args.length
238        if (typeof args[len - 1] === 'function') {
239          args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock);
240        }
241    },
242    executeBatch: function (...args) {
243        console.warn("LifecycleData.executeBatch interface mocked in the Previewer. How this interface works on the Previewer" +
244          " may be different from that on a real device.")
245        const len = args.length
246        if (typeof args[len - 1] === 'function') {
247          args[len - 1].call(this, paramMock.businessErrorMock, [DataAbilityResult]);
248        }
249    },
250    call: function (...args) {
251        console.warn("LifecycleData.call interface mocked in the Previewer. How this interface works on the Previewer" +
252          " may be different from that on a real device.")
253        const len = args.length
254        if (typeof args[len - 1] === 'function') {
255          args[len - 1].call(this, paramMock.businessErrorMock, PacMapType);
256        }
257    },
258}