mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #7075 from NativeScript/myankov/merge
chore: merge release to master
This commit is contained in:
@ -131,9 +131,8 @@ let mainEntry: NavigationEntry;
|
|||||||
let started = false;
|
let started = false;
|
||||||
// NOTE: for backwards compatibility. Remove for 4.0.0.
|
// NOTE: for backwards compatibility. Remove for 4.0.0.
|
||||||
const createRootFrame = { value: true };
|
const createRootFrame = { value: true };
|
||||||
export function start(entry?: NavigationEntry | string) {
|
|
||||||
console.log("application.start() is deprecated; use application.run() instead");
|
|
||||||
|
|
||||||
|
function _start(entry?: NavigationEntry | string) {
|
||||||
if (started) {
|
if (started) {
|
||||||
throw new Error("Application is already started.");
|
throw new Error("Application is already started.");
|
||||||
}
|
}
|
||||||
@ -146,13 +145,18 @@ export function start(entry?: NavigationEntry | string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function start(entry?: NavigationEntry | string) {
|
||||||
|
console.log("application.start() is deprecated; use application.run() instead");
|
||||||
|
_start(entry);
|
||||||
|
}
|
||||||
|
|
||||||
export function shouldCreateRootFrame(): boolean {
|
export function shouldCreateRootFrame(): boolean {
|
||||||
return createRootFrame.value;
|
return createRootFrame.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function run(entry?: NavigationEntry | string) {
|
export function run(entry?: NavigationEntry | string) {
|
||||||
createRootFrame.value = false;
|
createRootFrame.value = false;
|
||||||
start(entry);
|
_start(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CALLBACKS = "_callbacks";
|
const CALLBACKS = "_callbacks";
|
||||||
|
@ -275,16 +275,15 @@ function createRootView(v?: View) {
|
|||||||
let rootView = v;
|
let rootView = v;
|
||||||
if (!rootView) {
|
if (!rootView) {
|
||||||
// try to navigate to the mainEntry (if specified)
|
// try to navigate to the mainEntry (if specified)
|
||||||
if (mainEntry) {
|
if (!mainEntry) {
|
||||||
|
throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
|
||||||
|
} else {
|
||||||
if (createRootFrame.value) {
|
if (createRootFrame.value) {
|
||||||
const frame = rootView = new Frame();
|
const frame = rootView = new Frame();
|
||||||
frame.navigate(mainEntry);
|
frame.navigate(mainEntry);
|
||||||
} else {
|
} else {
|
||||||
rootView = createViewFromEntry(mainEntry);
|
rootView = createViewFromEntry(mainEntry);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// TODO: Throw an exception?
|
|
||||||
throw new Error("A Frame must be used to navigate to a Page.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,9 +301,7 @@ export function getRootView() {
|
|||||||
// NOTE: for backwards compatibility. Remove for 4.0.0.
|
// NOTE: for backwards compatibility. Remove for 4.0.0.
|
||||||
const createRootFrame = { value: true };
|
const createRootFrame = { value: true };
|
||||||
let started: boolean = false;
|
let started: boolean = false;
|
||||||
export function start(entry?: string | NavigationEntry) {
|
function _start(entry?: string | NavigationEntry) {
|
||||||
console.log("application.start() is deprecated; use application.run() instead");
|
|
||||||
|
|
||||||
mainEntry = typeof entry === "string" ? { moduleName: entry } : entry;
|
mainEntry = typeof entry === "string" ? { moduleName: entry } : entry;
|
||||||
started = true;
|
started = true;
|
||||||
|
|
||||||
@ -336,9 +333,14 @@ export function start(entry?: string | NavigationEntry) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function start(entry?: string | NavigationEntry) {
|
||||||
|
console.log("application.start() is deprecated; use application.run() instead");
|
||||||
|
_start(entry);
|
||||||
|
}
|
||||||
|
|
||||||
export function run(entry?: string | NavigationEntry) {
|
export function run(entry?: string | NavigationEntry) {
|
||||||
createRootFrame.value = false;
|
createRootFrame.value = false;
|
||||||
start(entry);
|
_start(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _resetRootView(entry?: NavigationEntry | string) {
|
export function _resetRootView(entry?: NavigationEntry | string) {
|
||||||
|
@ -1174,9 +1174,17 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
|||||||
const intent = activity.getIntent();
|
const intent = activity.getIntent();
|
||||||
|
|
||||||
if (fireLaunchEvent) {
|
if (fireLaunchEvent) {
|
||||||
|
// entry point for Angular and Vue frameworks
|
||||||
rootView = notifyLaunch(intent, savedInstanceState);
|
rootView = notifyLaunch(intent, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rootView) {
|
||||||
|
// entry point for NS Core
|
||||||
|
if (!mainEntry) {
|
||||||
|
// Also handles scenarios with Angular and Vue where the notifyLaunch didn't return a root view.
|
||||||
|
throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldCreateRootFrame) {
|
if (shouldCreateRootFrame) {
|
||||||
const extras = intent.getExtras();
|
const extras = intent.getExtras();
|
||||||
let frameId = -1;
|
let frameId = -1;
|
||||||
@ -1205,8 +1213,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
|||||||
throw new Error("A Frame must be used to navigate to a Page.");
|
throw new Error("A Frame must be used to navigate to a Page.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Create the root view if the notifyLaunch didn't return it
|
rootView = createViewFromEntry(mainEntry);
|
||||||
rootView = rootView || createViewFromEntry(mainEntry);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._rootView = rootView;
|
this._rootView = rootView;
|
||||||
|
Reference in New Issue
Block a user