chore: clean up Application, ApplicationSettings, AccessibilityEvents, Connectivity, Http

wip
This commit is contained in:
Igor Randjelovic
2023-05-10 02:05:21 +02:00
parent 407ab567e8
commit 7650cdd890
10 changed files with 253 additions and 309 deletions

View File

@@ -3,7 +3,7 @@ import * as helper from '../../ui-helper';
import { Page } from '@nativescript/core/ui/page';
import { isAndroid } from '@nativescript/core/platform';
import { Frame, NavigationEntry } from '@nativescript/core/ui/frame';
import { _resetRootView, getRootView } from '@nativescript/core/application';
import { resetRootView, getRootView } from '@nativescript/core/application';
import { TabView, TabViewItem } from '@nativescript/core/ui/tab-view';
function waitUntilTabViewReady(page: Page, action: Function) {
@@ -57,7 +57,7 @@ function createTestTabRootEntry() {
export function test_reset_frame_to_frame() {
const testFrameRoot1 = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot1.page, () => _resetRootView(testFrameRoot1.entry));
helper.waitUntilNavigatedTo(testFrameRoot1.page, () => resetRootView(testFrameRoot1.entry));
const rootView1 = getRootView();
const frameStack1 = Frame._stack();
@@ -66,7 +66,7 @@ export function test_reset_frame_to_frame() {
const testFrameRoot2 = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot2.page, () => _resetRootView(testFrameRoot2.entry));
helper.waitUntilNavigatedTo(testFrameRoot2.page, () => resetRootView(testFrameRoot2.entry));
const rootView2 = getRootView();
const frameStack2 = Frame._stack();
@@ -77,7 +77,7 @@ export function test_reset_frame_to_frame() {
export function test_reset_frame_to_tab() {
const testFrameRoot = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
helper.waitUntilNavigatedTo(testFrameRoot.page, () => resetRootView(testFrameRoot.entry));
const rootView1 = getRootView();
const frameStack1 = Frame._stack();
@@ -86,7 +86,7 @@ export function test_reset_frame_to_tab() {
const testTabRoot = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
waitUntilTabViewReady(testTabRoot.page, () => resetRootView(testTabRoot.entry));
const rootView2 = getRootView();
const frameStack2 = Frame._stack();
@@ -97,7 +97,7 @@ export function test_reset_frame_to_tab() {
export function test_reset_tab_to_frame() {
const testTabRoot = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
waitUntilTabViewReady(testTabRoot.page, () => resetRootView(testTabRoot.entry));
const rootView2 = getRootView();
const frameStack2 = Frame._stack();
@@ -106,7 +106,7 @@ export function test_reset_tab_to_frame() {
const testFrameRoot = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
helper.waitUntilNavigatedTo(testFrameRoot.page, () => resetRootView(testFrameRoot.entry));
const rootView1 = getRootView();
const frameStack1 = Frame._stack();
@@ -117,7 +117,7 @@ export function test_reset_tab_to_frame() {
export function test_reset_tab_to_tab() {
const testTabRoot1 = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot1.page, () => _resetRootView(testTabRoot1.entry));
waitUntilTabViewReady(testTabRoot1.page, () => resetRootView(testTabRoot1.entry));
const rootView1 = getRootView();
const frameStack1 = Frame._stack();
@@ -126,7 +126,7 @@ export function test_reset_tab_to_tab() {
const testTabRoot2 = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot2.page, () => _resetRootView(testTabRoot2.entry));
waitUntilTabViewReady(testTabRoot2.page, () => resetRootView(testTabRoot2.entry));
const rootView2 = getRootView();
const frameStack2 = Frame._stack();
@@ -137,13 +137,13 @@ export function test_reset_tab_to_tab() {
export function test_reset_during_tab_index_change() {
const testTabRoot = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
waitUntilTabViewReady(testTabRoot.page, () => resetRootView(testTabRoot.entry));
testTabRoot.root.selectedIndex = 1;
const testFrameRoot = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
helper.waitUntilNavigatedTo(testFrameRoot.page, () => resetRootView(testFrameRoot.entry));
TKUnit.assertTrue(true);
}
@@ -152,6 +152,6 @@ export function tearDownModule() {
// reset the root to frame for other tests
const resetFrameRoot = createTestFrameRootEntry();
_resetRootView(resetFrameRoot.entry);
resetRootView(resetFrameRoot.entry);
TKUnit.waitUntilReady(() => resetFrameRoot.page.isLoaded);
}

View File

@@ -1,6 +1,6 @@
import * as TKUnit from '../../tk-unit';
import { isAndroid } from '@nativescript/core/platform';
import { _resetRootView } from '@nativescript/core/application/';
import { resetRootView } from '@nativescript/core/application';
import { Frame, NavigationEntry } from '@nativescript/core/ui/frame';
import { Page } from '@nativescript/core/ui/page';
import { TabView, TabViewItem } from '@nativescript/core/ui/tab-view';
@@ -80,7 +80,7 @@ export function test_frame_topmost_matches_selectedIndex() {
create: () => tabView,
};
waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page], () => resetRootView(entry));
TKUnit.assertEqual(Frame.topmost().id, 'Tab0 Frame0');
waitUntilNavigatedToMaxTimeout([items[1].page], () => (tabView.selectedIndex = 1));
@@ -130,7 +130,7 @@ export function test_offset_zero_should_raise_same_events() {
create: () => tabView,
};
waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page], () => resetRootView(entry));
const expectedEventsRaisedAfterTabCreated = [['Tab0 Frame0 loaded', 'Tab0 Frame0 Page0 navigatingTo', 'Tab0 Frame0 Page0 loaded', 'Tab0 Frame0 Page0 navigatedTo'], [], []];
@@ -191,7 +191,7 @@ export function test_android_default_offset_should_preload_1_tab_on_each_side()
create: () => tabView,
};
waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => resetRootView(entry));
const expectedEventsRaisedAfterTabCreated = [['Tab0 Frame0 loaded', 'Tab0 Frame0 Page0 navigatingTo', 'Tab0 Frame0 Page0 loaded', 'Tab0 Frame0 Page0 navigatedTo'], ['Tab1 Frame1 loaded', 'Tab1 Frame1 Page1 navigatingTo', 'Tab1 Frame1 Page1 loaded', 'Tab1 Frame1 Page1 navigatedTo'], []];
@@ -223,5 +223,5 @@ export function tearDownModule() {
create: () => frame,
};
waitUntilNavigatedToMaxTimeout([page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([page], () => resetRootView(entry));
}

View File

@@ -1 +0,0 @@
Contains the application abstraction with all related methods.

View File

@@ -39,10 +39,16 @@ const SYSTEM_APPEARANCE_CSS_CLASSES = [`${CSSUtils.CLASS_PREFIX}${CoreTypes.Syst
let cssFile = './app.css';
/**
* Get application level static resources.
*/
export function getResources() {
return bindableResources.get();
}
/**
* Set application level static resources.
*/
export function setResources(res: any) {
bindableResources.set(res);
}
@@ -83,6 +89,9 @@ export function livesync(rootView: View, context?: ModuleContext) {
}
}
/**
* Sets css file name for the application.
*/
export function setCssFileName(cssFileName: string) {
cssFile = cssFileName;
notify(<CssChangedEventData>{
@@ -92,10 +101,19 @@ export function setCssFileName(cssFileName: string) {
});
}
/**
* Gets css file name for the application.
*/
export function getCssFileName(): string {
return cssFile;
}
/**
* Loads immediately the app.css.
* By default the app.css file is loaded shortly after "loaded".
* For the Android snapshot the CSS can be parsed during the snapshot generation,
* as the CSS does not depend on runtime APIs, and loadAppCss will be called explicitly.
*/
export function loadAppCss(): void {
try {
notify(<LoadAppCSSEventData>{
@@ -128,6 +146,9 @@ function increaseStyleScopeApplicationCssSelectorVersion(rootView: View) {
}
}
/**
* Ensure css-class is set on rootView
*/
export function applyCssClass(rootView: View, cssClasses: string[], newCssClass: string): void {
if (!rootView.cssClasses.has(newCssClass)) {
cssClasses.forEach((cssClass) => removeCssClass(rootView, cssClass));
@@ -150,12 +171,24 @@ export function orientationChanged(rootView: View, newOrientation: 'portrait' |
applyCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
});
}
/**
* Boolean to enable/disable systemAppearanceChanged
*/
export let autoSystemAppearanceChanged = true;
/**
* enable/disable systemAppearanceChanged
*/
export function setAutoSystemAppearanceChanged(value: boolean): void {
autoSystemAppearanceChanged = value;
}
/**
* Updates root view classes including those of modals
* @param rootView the root view
* @param newSystemAppearance the new appearance change
*/
export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void {
if (!rootView || !autoSystemAppearanceChanged) {
return;
@@ -171,11 +204,11 @@ export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'da
}
export let inBackground = false;
export let suspended = false;
export function setInBackground(value: boolean): void {
inBackground = value;
}
export let suspended = false;
export function setSuspended(value: boolean): void {
suspended = value;
}

View File

@@ -179,6 +179,7 @@ export interface AndroidApplication {
let androidApp: AndroidApplication;
export { androidApp as android };
ensureNativeApplication();
let mainEntry: NavigationEntry;
let started = false;
@@ -224,7 +225,7 @@ export function addCss(cssText: string, attributeScoped?: boolean): void {
const CALLBACKS = '_callbacks';
export function _resetRootView(entry?: NavigationEntry | string): void {
export function resetRootView(entry?: NavigationEntry | string): void {
ensureNativeApplication();
const activity = androidApp.foregroundActivity || androidApp.startActivity;
if (!activity) {

View File

@@ -3,88 +3,7 @@ import { View } from '../ui/core/view';
import { Observable, EventData } from '../data/observable';
export * from './application-interfaces';
/**
* String value used when hooking to launch event.
*/
export const launchEvent: string;
/**
* String value used when hooking to displayed event.
*/
export const displayedEvent: string;
/**
* String value used when hooking to uncaughtError event.
*/
export const uncaughtErrorEvent: string;
/**
* String value used when hooking to discardedError event.
*/
export const discardedErrorEvent: string;
/**
* String value used when hooking to suspend event.
*/
export const suspendEvent: string;
/**
* String value used when hooking to resume event.
*/
export const resumeEvent: string;
/**
* String value used when hooking to foreground event.
*/
export const foregroundEvent: string;
/**
* String value used when hooking to background event.
*/
export const backgroundEvent: string;
/**
* String value used when hooking to exit event.
*/
export const exitEvent: string;
/**
* String value used when hooking to lowMemory event.
*/
export const lowMemoryEvent: string;
/**
* String value used when hooking to orientationChanged event.
*/
export const orientationChangedEvent: string;
/**
* String value used when hooking to systemAppearanceChanged event.
*/
export const systemAppearanceChangedEvent: string;
/**
* String value used when hooking to fontScaleChanged event.
*/
export const fontScaleChangedEvent: string;
/**
* Boolean to enable/disable systemAppearanceChanged
*/
export let autoSystemAppearanceChanged: boolean;
/**
* enable/disable systemAppearanceChanged
*/
export function setAutoSystemAppearanceChanged(value: boolean): void;
/**
* Updates root view classes including those of modals
* @param rootView the root view
* @param newSystemAppearance the new appearance change
*/
export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void;
export * from './application-common';
/**
* iOS Only
@@ -202,39 +121,6 @@ export function getMainEntry(): NavigationEntry;
*/
export function getRootView(): View;
/**
* Get application level static resources.
*/
export function getResources(): any;
/**
* Set application level static resources.
*/
export function setResources(resources: any): void;
/**
* Sets css file name for the application.
*/
export function setCssFileName(cssFile: string): void;
/**
* Gets css file name for the application.
*/
export function getCssFileName(): string;
/**
* Ensure css-class is set on rootView
*/
export function applyCssClass(rootView: View, cssClasses: string[], newCssClass: string): void;
/**
* Loads immediately the app.css.
* By default the app.css file is loaded shortly after "loaded".
* For the Android snapshot the CSS can be parsed during the snapshot generation,
* as the CSS does not depend on runtime APIs, and loadAppCss will be called explicitly.
*/
export function loadAppCss();
/**
* Adds new values to the application styles.
* @param cssText - A valid styles which will be added to the current application styles.
@@ -252,7 +138,7 @@ export function run(entry?: NavigationEntry | string);
* Call this method to change the root view of your application. Important: Your application must already be running.
* This method won't create Frame as root view.
*/
export function _resetRootView(entry?: NavigationEntry | string);
export function resetRootView(entry?: NavigationEntry | string);
/**
* Removes listener for the specified event name.

View File

@@ -16,15 +16,15 @@ import { CSSUtils } from '../css/system-classes';
import { IOSHelper } from '../ui/core/view/view-helper';
import { Device } from '../platform';
import { profile } from '../profiling';
import { iOSNativeHelper } from '../utils';
import * as Utils from '../utils';
import { initAccessibilityCssHelper } from '../accessibility/accessibility-css-helper';
import { initAccessibilityFontScale } from '../accessibility/font-scale';
import { inBackground, setInBackground, setSuspended, suspended } from './application-common';
const IOS_PLATFORM = 'ios';
const getVisibleViewController = iOSNativeHelper.getVisibleViewController;
const majorVersion = iOSNativeHelper.MajorVersion;
const getVisibleViewController = Utils.ios.getVisibleViewController;
const majorVersion = Utils.ios.MajorVersion;
// NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430
// TODO: Refactor the UIResponder to use Typescript extends when this issue is resolved:
@@ -105,7 +105,7 @@ export function setMaxRefreshRate(options?: { min?: number; max?: number; prefer
}
}
if (iOSNativeHelper.MajorVersion >= 15) {
if (Utils.ios.MajorVersion >= 15) {
const min = options?.min || max / 2;
const preferred = options?.preferred || max;
displayedLink.preferredFrameRateRange = CAFrameRateRangeMake(min, max, preferred);
@@ -394,10 +394,9 @@ export class iOSApplication implements iOSApplicationDefinition {
}
}
/* tslint:disable */
let iosApp: iOSApplication;
/* tslint:enable */
export { iosApp as ios };
ensureNativeApplication();
export function ensureNativeApplication() {
if (!iosApp) {
@@ -504,7 +503,7 @@ export function addCss(cssText: string, attributeScoped?: boolean): void {
}
}
export function _resetRootView(entry?: NavigationEntry | string) {
export function resetRootView(entry?: NavigationEntry | string) {
ensureNativeApplication();
mainEntry = typeof entry === 'string' ? { moduleName: entry } : entry;
iosApp.setWindowContent();

View File

@@ -6,77 +6,90 @@
* Once issue is resolve we can remove this index.d.ts from repo and go back to auto generation on tsc
*/
export type { NativeScriptConfig } from './config';
export { iOSApplication, AndroidApplication } from './application';
export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application';
import { AndroidApplication, iOSApplication, systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, systemAppearance, setAutoSystemAppearanceChanged, setMaxRefreshRate } from './application';
export declare const Application: {
launchEvent: string;
displayedEvent: string;
uncaughtErrorEvent: string;
discardedErrorEvent: string;
suspendEvent: string;
resumeEvent: string;
exitEvent: string;
foregroundEvent: string;
backgroundEvent: string;
lowMemoryEvent: string;
orientationChangedEvent: string;
systemAppearanceChangedEvent: string;
fontScaleChangedEvent: string;
systemAppearanceChanged: typeof systemAppearanceChanged;
setMaxRefreshRate: typeof setMaxRefreshRate;
getMainEntry: typeof getMainEntry;
getRootView: typeof getRootView;
resetRootView: typeof _resetRootView;
getResources: typeof getResources;
setResources: typeof setResources;
setCssFileName: typeof setCssFileName;
getCssFileName: typeof getCssFileName;
loadAppCss: typeof loadAppCss;
addCss: typeof addCss;
on: typeof on;
off: typeof off;
notify: typeof notify;
hasListeners: typeof hasListeners;
run: typeof run;
orientation: typeof orientation;
getNativeApplication: typeof getNativeApplication;
hasLaunched: typeof hasLaunched;
systemAppearance: typeof systemAppearance;
setAutoSystemAppearanceChanged: typeof setAutoSystemAppearanceChanged;
android: AndroidApplication;
ios: iOSApplication;
suspended: boolean;
inBackground: boolean;
};
import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings';
export declare const ApplicationSettings: {
clear: typeof clear;
flush: typeof flush;
hasKey: typeof hasKey;
remove: typeof remove;
setString: typeof setString;
getString: typeof getString;
getAllKeys: typeof getAllKeys;
getBoolean: typeof getBoolean;
setBoolean: typeof setBoolean;
getNumber: typeof getNumber;
setNumber: typeof setNumber;
};
export declare const AccessibilityEvents: {
accessibilityBlurEvent: string;
accessibilityFocusEvent: string;
accessibilityFocusChangedEvent: string;
};
export * as Application from './application';
// import { AndroidApplication, iOSApplication, systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, systemAppearance, setAutoSystemAppearanceChanged, setMaxRefreshRate } from './application';
// export declare const Application: {
// launchEvent: string;
// displayedEvent: string;
// uncaughtErrorEvent: string;
// discardedErrorEvent: string;
// suspendEvent: string;
// resumeEvent: string;
// exitEvent: string;
// foregroundEvent: string;
// backgroundEvent: string;
// lowMemoryEvent: string;
// orientationChangedEvent: string;
// systemAppearanceChangedEvent: string;
// fontScaleChangedEvent: string;
// systemAppearanceChanged: typeof systemAppearanceChanged;
// setMaxRefreshRate: typeof setMaxRefreshRate;
// getMainEntry: typeof getMainEntry;
// getRootView: typeof getRootView;
// resetRootView: typeof _resetRootView;
// getResources: typeof getResources;
// setResources: typeof setResources;
// setCssFileName: typeof setCssFileName;
// getCssFileName: typeof getCssFileName;
// loadAppCss: typeof loadAppCss;
// addCss: typeof addCss;
// on: typeof on;
// off: typeof off;
// notify: typeof notify;
// hasListeners: typeof hasListeners;
// run: typeof run;
// orientation: typeof orientation;
// getNativeApplication: typeof getNativeApplication;
// hasLaunched: typeof hasLaunched;
// systemAppearance: typeof systemAppearance;
// setAutoSystemAppearanceChanged: typeof setAutoSystemAppearanceChanged;
// android: AndroidApplication;
// ios: iOSApplication;
// suspended: boolean;
// inBackground: boolean;
// };
export * as ApplicationSettings from './application-settings';
// import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings';
// export declare const ApplicationSettings: {
// clear: typeof clear;
// flush: typeof flush;
// hasKey: typeof hasKey;
// remove: typeof remove;
// setString: typeof setString;
// getString: typeof getString;
// getAllKeys: typeof getAllKeys;
// getBoolean: typeof getBoolean;
// setBoolean: typeof setBoolean;
// getNumber: typeof getNumber;
// setNumber: typeof setNumber;
// };
// export declare const AccessibilityEvents: {
// accessibilityBlurEvent: string;
// accessibilityFocusEvent: string;
// accessibilityFocusChangedEvent: string;
// };
import * as Accessibility from './accessibility';
export namespace AccessibilityEvents {
export const accessibilityBlurEvent = Accessibility.accessibilityBlurEvent;
export const accessibilityFocusEvent = Accessibility.accessibilityFocusEvent;
export const accessibilityFocusChangedEvent = Accessibility.accessibilityFocusChangedEvent;
export const accessibilityPerformEscapeEvent = Accessibility.accessibilityPerformEscapeEvent;
}
export { AccessibilityLiveRegion, AccessibilityRole, AccessibilityState, AccessibilityTrait, FontScaleCategory } from './accessibility';
export { Color } from './color';
import { connectionType, getConnectionType, startMonitoring, stopMonitoring } from './connectivity';
export declare const Connectivity: {
connectionType: typeof connectionType;
getConnectionType: typeof getConnectionType;
startMonitoring: typeof startMonitoring;
stopMonitoring: typeof stopMonitoring;
};
export * as Connectivity from './connectivity';
// import { connectionType, getConnectionType, startMonitoring, stopMonitoring } from './connectivity';
// export declare const Connectivity: {
// connectionType: typeof connectionType;
// getConnectionType: typeof getConnectionType;
// startMonitoring: typeof startMonitoring;
// stopMonitoring: typeof stopMonitoring;
// };
export * from './core-types';
export { CSSUtils } from './css/system-classes';
export { ObservableArray, ChangeType } from './data/observable-array';
@@ -87,14 +100,15 @@ export { VirtualArray } from './data/virtual-array';
export type { ItemsLoading } from './data/virtual-array';
export { File, FileSystemEntity, Folder, knownFolders, path, getFileAccess, AndroidDirectory } from './file-system';
export type { HttpRequestOptions, HttpResponse, Headers, HttpResponseEncoding, HttpContent } from './http';
import { getFile, getImage, getJSON, getString as httpGetString } from './http';
export declare const Http: {
getFile: typeof getFile;
getImage: typeof getImage;
getJSON: typeof getJSON;
getString: typeof httpGetString;
request: (options: import('./http').HttpRequestOptions) => Promise<import('./http').HttpResponse>;
};
export * as Http from './http';
// import { getFile, getImage, getJSON, getString as httpGetString } from './http';
// export declare const Http: {
// getFile: typeof getFile;
// getImage: typeof getImage;
// getJSON: typeof getJSON;
// getString: typeof httpGetString;
// request: (options: import('./http').HttpRequestOptions) => Promise<import('./http').HttpResponse>;
// };
export { ImageAsset } from './image-asset';
export type { ImageAssetOptions } from './image-asset';
export { ImageSource } from './image-source';

View File

@@ -6,95 +6,105 @@ import './globals';
export { iOSApplication, AndroidApplication } from './application';
export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application';
import { fontScaleChangedEvent, launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance, setAutoSystemAppearanceChanged, ensureNativeApplication, setMaxRefreshRate } from './application';
import { inBackground, suspended, foregroundEvent, backgroundEvent } from './application/application-common';
export * as Application from './application';
export const Application = {
launchEvent,
displayedEvent,
uncaughtErrorEvent,
discardedErrorEvent,
suspendEvent,
resumeEvent,
exitEvent,
foregroundEvent,
backgroundEvent,
lowMemoryEvent,
orientationChangedEvent,
systemAppearanceChangedEvent,
systemAppearanceChanged,
fontScaleChangedEvent,
setMaxRefreshRate,
// import { fontScaleChangedEvent, launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance, setAutoSystemAppearanceChanged, ensureNativeApplication, setMaxRefreshRate } from './application';
// import { inBackground, suspended, foregroundEvent, backgroundEvent } from './application/application-common';
getMainEntry,
getRootView,
resetRootView: _resetRootView,
getResources,
setResources,
setCssFileName,
getCssFileName,
loadAppCss,
addCss,
on,
off,
notify,
hasListeners,
run,
orientation,
getNativeApplication,
hasLaunched,
systemAppearance,
setAutoSystemAppearanceChanged,
get android() {
ensureNativeApplication();
return appAndroid;
},
get ios() {
ensureNativeApplication();
return iosApp;
},
get suspended() {
return suspended;
},
get inBackground() {
return inBackground;
},
};
// export const Application = {
// launchEvent,
// displayedEvent,
// uncaughtErrorEvent,
// discardedErrorEvent,
// suspendEvent,
// resumeEvent,
// exitEvent,
// foregroundEvent,
// backgroundEvent,
// lowMemoryEvent,
// orientationChangedEvent,
// systemAppearanceChangedEvent,
// systemAppearanceChanged,
// fontScaleChangedEvent,
// setMaxRefreshRate,
// Export all methods from "application-settings" as ApplicationSettings
import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings';
export const ApplicationSettings = {
clear,
flush,
hasKey,
remove,
setString,
getString,
getAllKeys,
getBoolean,
setBoolean,
getNumber,
setNumber,
};
// getMainEntry,
// getRootView,
// resetRootView: _resetRootView,
// getResources,
// setResources,
// setCssFileName,
// getCssFileName,
// loadAppCss,
// addCss,
// on,
// off,
// notify,
// hasListeners,
// run,
// orientation,
// getNativeApplication,
// hasLaunched,
// systemAppearance,
// setAutoSystemAppearanceChanged,
// get android() {
// ensureNativeApplication();
// return appAndroid;
// },
// get ios() {
// ensureNativeApplication();
// return iosApp;
// },
// get suspended() {
// return suspended;
// },
// get inBackground() {
// return inBackground;
// },
// };
import { accessibilityBlurEvent, accessibilityFocusEvent, accessibilityFocusChangedEvent, accessibilityPerformEscapeEvent } from './accessibility';
export const AccessibilityEvents = {
accessibilityBlurEvent,
accessibilityFocusEvent,
accessibilityFocusChangedEvent,
accessibilityPerformEscapeEvent,
};
export * as ApplicationSettings from './application-settings';
// // Export all methods from "application-settings" as ApplicationSettings
// import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings';
// export const ApplicationSettings = {
// clear,
// flush,
// hasKey,
// remove,
// setString,
// getString,
// getAllKeys,
// getBoolean,
// setBoolean,
// getNumber,
// setNumber,
// };
import * as Accessibility from './accessibility';
export namespace AccessibilityEvents {
export const accessibilityBlurEvent = Accessibility.accessibilityBlurEvent;
export const accessibilityFocusEvent = Accessibility.accessibilityFocusEvent;
export const accessibilityFocusChangedEvent = Accessibility.accessibilityFocusChangedEvent;
export const accessibilityPerformEscapeEvent = Accessibility.accessibilityPerformEscapeEvent;
}
// export const AccessibilityEvents = {
// accessibilityBlurEvent,
// accessibilityFocusEvent,
// accessibilityFocusChangedEvent,
// accessibilityPerformEscapeEvent,
// };
export { AccessibilityLiveRegion, AccessibilityRole, AccessibilityState, AccessibilityTrait, FontScaleCategory } from './accessibility';
export { Color } from './color';
import { connectionType, getConnectionType, startMonitoring, stopMonitoring } from './connectivity';
export const Connectivity = {
connectionType,
getConnectionType,
startMonitoring,
stopMonitoring,
};
export * as Connectivity from './connectivity';
// import { connectionType, getConnectionType, startMonitoring, stopMonitoring } from './connectivity';
// export const Connectivity = {
// connectionType,
// getConnectionType,
// startMonitoring,
// stopMonitoring,
// };
export * from './core-types';
@@ -110,15 +120,17 @@ export { File, FileSystemEntity, Folder, knownFolders, path, getFileAccess, Andr
// Export all interfaces from "http" module
export type { HttpRequestOptions, HttpResponse, Headers, HttpResponseEncoding, HttpContent } from './http';
export * as Http from './http';
// Export all methods from "http" as Http
import { getFile, getImage, getJSON, getString as httpGetString, request } from './http';
export const Http = {
getFile,
getImage,
getJSON,
getString: httpGetString,
request,
};
// import { getFile, getImage, getJSON, getString as httpGetString, request } from './http';
// export const Http = {
// getFile,
// getImage,
// getJSON,
// getString: httpGetString,
// request,
// };
export { ImageAsset } from './image-asset';
export type { ImageAssetOptions } from './image-asset';

View File

@@ -1354,7 +1354,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
// 1. Application initial start - there is no rootView in callbacks.
// 2. Application revived after Activity is destroyed. this._rootView should have been restored by id in onCreate.
// 3. Livesync if rootView has no custom _onLivesync. this._rootView should have been cleared upfront. Launch event should not fired
// 4. _resetRootView method. this._rootView should have been cleared upfront. Launch event should not fired
// 4. resetRootView method. this._rootView should have been cleared upfront. Launch event should not fired
private setActivityContent(activity: androidx.appcompat.app.AppCompatActivity, savedInstanceState: android.os.Bundle, fireLaunchEvent: boolean): void {
let rootView = this._rootView;