mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
refactor: guard ng and vue entry points (#7071)
This commit is contained in:
@ -1171,16 +1171,20 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
|||||||
|
|
||||||
if (!rootView) {
|
if (!rootView) {
|
||||||
const mainEntry = application.getMainEntry();
|
const mainEntry = application.getMainEntry();
|
||||||
if (!mainEntry) {
|
|
||||||
throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
@ -1209,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