• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2020 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 */
15
16/**
17 * Defines the AppResponse info.
18 *
19 * @interface AppResponse
20 * @syscap SystemCapability.ArkUI.ArkUI.Lite
21 * @since 3
22 */
23export interface AppResponse {
24  /**
25   * Application bundleName.
26   *
27   * @type { string }
28   * @syscap SystemCapability.ArkUI.ArkUI.Full
29   * @since 6
30   */
31  appID: string;
32
33  /**
34   * Application name.
35   *
36   * @type { string }
37   * @syscap SystemCapability.ArkUI.ArkUI.Lite
38   * @since 3
39   */
40  appName: string;
41
42  /**
43   * Application version name.
44   *
45   * @type { string }
46   * @syscap SystemCapability.ArkUI.ArkUI.Lite
47   * @since 3
48   */
49  versionName: string;
50
51  /**
52   * Application version.
53   *
54   * @type { number }
55   * @syscap SystemCapability.ArkUI.ArkUI.Lite
56   * @since 3
57   */
58  versionCode: number;
59}
60
61/**
62 * Defines the option of screenOnVisible interface.
63 *
64 * @interface ScreenOnVisibleOptions
65 * @syscap SystemCapability.ArkUI.ArkUI.Full
66 * @since 3
67 */
68export interface ScreenOnVisibleOptions {
69  /**
70   * Whether to keep the application visible. The default value is false.
71   *
72   * @type { ?boolean }
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @since 3
75   */
76  visible?: boolean;
77
78  /**
79   * Called when the application always keeps visible.
80   *
81   * @type { ?function }
82   * @syscap SystemCapability.ArkUI.ArkUI.Full
83   * @since 3
84   */
85  success?: () => void;
86
87  /**
88   * Called when the application fails to keep visible.
89   *
90   * @type { ?function }
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @since 3
93   */
94  fail?: (data: string, code: number) => void;
95
96  /**
97   * Called when the execution is completed.
98   *
99   * @type { ?function }
100   * @syscap SystemCapability.ArkUI.ArkUI.Full
101   * @since 3
102   */
103  complete?: () => void;
104}
105
106/**
107 * Defines the option of RequestFullWindow interface.
108 *
109 * @interface RequestFullWindowOptions
110 * @syscap SystemCapability.ArkUI.ArkUI.Full
111 * @since 3
112 */
113export interface RequestFullWindowOptions {
114  /**
115   * Defines the number of animation options.
116   *
117   * @type { number }
118   * @syscap SystemCapability.ArkUI.ArkUI.Full
119   * @since 3
120   */
121  duration: number;
122}
123
124/**
125 * Defines the app class info.
126 *
127 * @syscap SystemCapability.ArkUI.ArkUI.Lite
128 * @since 3
129 */
130export default class App {
131  /**
132   * Obtains the declared information in the config.json file of an application.
133   *
134   * @returns { AppResponse }
135   * @syscap SystemCapability.ArkUI.ArkUI.Lite
136   * @since 3
137   */
138  static getInfo(): AppResponse;
139
140  /**
141   * Destroys the current ability.
142   *
143   * @syscap SystemCapability.ArkUI.ArkUI.Lite
144   * @since 3
145   */
146  static terminate(): void;
147
148  /**
149   * Keeps the application visible after the screen is waken up.
150   * This method prevents the system from returning to the home screen when the screen is locked.
151   *
152   * @param { ScreenOnVisibleOptions } options
153   * @syscap SystemCapability.ArkUI.ArkUI.Full
154   * @since 3
155   * @deprecated since 8
156   */
157  static screenOnVisible(options?: ScreenOnVisibleOptions): void;
158
159  /**
160   * Requests the application to run in full window.
161   * In some scenarios, such as semi-modal FA, the FA runs in non-full window.
162   * In this case, you can call this API.
163   * This API is invalid for an application already in full-window mode.
164   *
165   * @param { RequestFullWindowOptions } options Transition time from non-full window to full window, in milliseconds.
166   * By default, the value is in direct proportion to the distance between the non-full window and the full window.
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @since 3
169   * @deprecated since 8
170   * @useinstead startAbility
171   */
172  static requestFullWindow(options?: RequestFullWindowOptions): void;
173
174  /**
175   * Set image cache capacity of decoded image count.
176   * if not set, the application will not cache any decoded image.
177   *
178   * @param { number } value - capacity of decoded image count.
179   * @syscap SystemCapability.ArkUI.ArkUI.Full
180   * @since 7
181   */
182  static setImageCacheCount(value: number): void;
183
184  /**
185   * Set image cache capacity of raw image data size in bytes before decode.
186   * if not set, the application will not cache any raw image data.
187   *
188   * @param { number } value - capacity of raw image data size in bytes.
189   * @syscap SystemCapability.ArkUI.ArkUI.Full
190   * @since 7
191   */
192  static setImageRawDataCacheSize(value: number): void;
193
194  /**
195   * Set image file cache size in bytes on disk before decode.
196   * if not set, the application will cache 100MB image files on disk.
197   *
198   * @param { number } value - capacity of raw image data size in bytes.
199   * @syscap SystemCapability.ArkUI.ArkUI.Full
200   * @since 7
201   */
202  static setImageFileCacheSize(value: number): void;
203}
204