1 | import type { View } from '../ui/core/view';
|
2 | import type { NavigationEntry } from '../ui/frame/frame-interfaces';
|
3 | import type { AndroidApplication as IAndroidApplication, iOSApplication as IiOSApplication } from './';
|
4 | import type { ApplicationEventData, CssChangedEventData, DiscardedErrorEventData, FontScaleChangedEventData, LaunchEventData, OrientationChangedEventData, SystemAppearanceChangedEventData, UnhandledErrorEventData } from './application-interfaces';
|
5 | interface ApplicationEvents {
|
6 | off(eventNames: string, callback?: any, thisArg?: any): void;
|
7 | notify<T = ApplicationEventData>(eventData: T): void;
|
8 | hasListeners(eventName: string): boolean;
|
9 | on(eventNames: string, callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
10 | |
11 |
|
12 |
|
13 | on(event: 'cssChanged', callback: (args: CssChangedEventData) => void, thisArg?: any): void;
|
14 | |
15 |
|
16 |
|
17 | on(event: 'livesync', callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
18 | |
19 |
|
20 |
|
21 | on(event: 'cssChanged', callback: (args: CssChangedEventData) => void, thisArg?: any): void;
|
22 | |
23 |
|
24 |
|
25 | on(event: 'launch', callback: (args: LaunchEventData) => void, thisArg?: any): void;
|
26 | |
27 |
|
28 |
|
29 |
|
30 |
|
31 | on(event: 'displayed', callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
32 | |
33 |
|
34 |
|
35 | on(event: 'suspend', callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
36 | |
37 |
|
38 |
|
39 | on(event: 'resume', callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
40 | |
41 |
|
42 |
|
43 | on(event: 'exit', callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
44 | |
45 |
|
46 |
|
47 | on(event: 'lowMemory', callback: (args: ApplicationEventData) => void, thisArg?: any): void;
|
48 | |
49 |
|
50 |
|
51 | on(event: 'uncaughtError', callback: (args: UnhandledErrorEventData) => void, thisArg?: any): void;
|
52 | |
53 |
|
54 |
|
55 | on(event: 'discardedError', callback: (args: DiscardedErrorEventData) => void, thisArg?: any): void;
|
56 | |
57 |
|
58 |
|
59 | on(event: 'orientationChanged', callback: (args: OrientationChangedEventData) => void, thisArg?: any): void;
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 | on(event: 'systemAppearanceChanged', callback: (args: SystemAppearanceChangedEventData) => void, thisArg?: any): void;
|
66 | on(event: 'fontScaleChanged', callback: (args: FontScaleChangedEventData) => void, thisArg?: any): void;
|
67 | }
|
68 | export declare class ApplicationCommon {
|
69 | readonly launchEvent = "launch";
|
70 | readonly suspendEvent = "suspend";
|
71 | readonly displayedEvent = "displayed";
|
72 | readonly backgroundEvent = "background";
|
73 | readonly foregroundEvent = "foreground";
|
74 | readonly resumeEvent = "resume";
|
75 | readonly exitEvent = "exit";
|
76 | readonly lowMemoryEvent = "lowMemory";
|
77 | readonly uncaughtErrorEvent = "uncaughtError";
|
78 | readonly discardedErrorEvent = "discardedError";
|
79 | readonly orientationChangedEvent = "orientationChanged";
|
80 | readonly systemAppearanceChangedEvent = "systemAppearanceChanged";
|
81 | readonly fontScaleChangedEvent = "fontScaleChanged";
|
82 | readonly livesyncEvent = "livesync";
|
83 | readonly loadAppCssEvent = "loadAppCss";
|
84 | readonly cssChangedEvent = "cssChanged";
|
85 | readonly initRootViewEvent = "initRootView";
|
86 | |
87 |
|
88 |
|
89 | static on: ApplicationEvents['on'];
|
90 | |
91 |
|
92 |
|
93 | static once: ApplicationEvents['on'];
|
94 | |
95 |
|
96 |
|
97 | static off: ApplicationEvents['off'];
|
98 | |
99 |
|
100 |
|
101 | static notify: ApplicationEvents['notify'];
|
102 | |
103 |
|
104 |
|
105 | static hasListeners: ApplicationEvents['hasListeners'];
|
106 | on: ApplicationEvents['on'];
|
107 | once: ApplicationEvents['on'];
|
108 | off: ApplicationEvents['off'];
|
109 | notify: ApplicationEvents['notify'];
|
110 | hasListeners: ApplicationEvents['hasListeners'];
|
111 | |
112 |
|
113 |
|
114 | constructor();
|
115 | /**
|
116 | * @internal
|
117 | */
|
118 | livesync(rootView: View, context?: ModuleContext): void;
|
119 | /**
|
120 | * Applies the the `newCssClass` to the `rootView` and removes all other css classes from `cssClasses`
|
121 | * previously applied to the `rootView`.
|
122 | * @param rootView
|
123 | * @param cssClasses
|
124 | * @param newCssClass
|
125 | * @param skipCssUpdate
|
126 | */
|
127 | applyCssClass(rootView: View, cssClasses: string[], newCssClass: string, skipCssUpdate?: boolean): void;
|
128 | private addCssClass;
|
129 | private removeCssClass;
|
130 | private increaseStyleScopeApplicationCssSelectorVersion;
|
131 | private setRootViewCSSClasses;
|
132 | /**
|
133 | * iOS Only
|
134 | * Dynamically change the preferred frame rate
|
135 | * For devices (iOS 15+) which support min/max/preferred frame rate you can specify ranges
|
136 | * For devices (iOS < 15), you can specify the max frame rate
|
137 | * see: https://developer.apple.com/documentation/quartzcore/optimizing_promotion_refresh_rates_for_iphone_13_pro_and_ipad_pro
|
138 | * To use, ensure your Info.plist has:
|
139 | * ```xml
|
140 | * <key>CADisableMinimumFrameDurationOnPhone</key>
|
141 | * <true/>
|
142 | * ```
|
143 | * @param options { min?: number; max?: number; preferred?: number }
|
144 | */
|
145 | setMaxRefreshRate(options?: {
|
146 | min?: number;
|
147 | max?: number;
|
148 | preferred?: number;
|
149 | }): void;
|
150 | protected mainEntry: NavigationEntry;
|
151 | |
152 |
|
153 |
|
154 | getMainEntry(): NavigationEntry;
|
155 | protected notifyLaunch(additionalLanchEventData?: any): View | null;
|
156 | createRootView(view?: View, fireLaunchEvent?: boolean, additionalLanchEventData?: any): View;
|
157 | getRootView(): View;
|
158 | resetRootView(entry?: NavigationEntry | string): void;
|
159 | initRootView(rootView: View): void;
|
160 | |
161 |
|
162 |
|
163 | getResources(): any;
|
164 | |
165 |
|
166 |
|
167 | setResources(res: any): void;
|
168 | private cssFile;
|
169 | |
170 |
|
171 |
|
172 | setCssFileName(cssFileName: string): void;
|
173 | |
174 |
|
175 |
|
176 | getCssFileName(): string;
|
177 | |
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | loadAppCss(): void;
|
184 | addCss(cssText: string, attributeScoped?: boolean): void;
|
185 | run(entry?: string | NavigationEntry): void;
|
186 | private _orientation;
|
187 | protected getOrientation(): 'portrait' | 'landscape' | 'unknown';
|
188 | protected setOrientation(value: 'portrait' | 'landscape' | 'unknown'): void;
|
189 | orientation(): 'portrait' | 'landscape' | 'unknown';
|
190 | orientationChanged(rootView: View, newOrientation: 'portrait' | 'landscape' | 'unknown'): void;
|
191 | getNativeApplication(): any;
|
192 | hasLaunched(): boolean;
|
193 | private _systemAppearance;
|
194 | protected getSystemAppearance(): 'dark' | 'light' | null;
|
195 | protected setSystemAppearance(value: 'dark' | 'light'): void;
|
196 | systemAppearance(): 'dark' | 'light' | null;
|
197 | |
198 |
|
199 |
|
200 | autoSystemAppearanceChanged: boolean;
|
201 | |
202 |
|
203 |
|
204 | setAutoSystemAppearanceChanged(value: boolean): void;
|
205 | |
206 |
|
207 |
|
208 |
|
209 |
|
210 | systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void;
|
211 | private _inBackground;
|
212 | get inBackground(): boolean;
|
213 | setInBackground(value: boolean, additonalData?: any): void;
|
214 | private _suspended;
|
215 | get suspended(): boolean;
|
216 | setSuspended(value: boolean, additonalData?: any): void;
|
217 | started: boolean;
|
218 | get android(): IAndroidApplication;
|
219 | get ios(): IiOSApplication;
|
220 | get AndroidApplication(): IAndroidApplication;
|
221 | get iOSApplication(): IiOSApplication;
|
222 | }
|
223 | export {};
|