Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 34 additions & 30 deletions 64 tns-core-modules/ui/frame/frame.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1171,46 +1171,50 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {

if (!rootView) {
const mainEntry = application.getMainEntry();
if (!mainEntry) {
throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
}

const intent = activity.getIntent();

if (fireLaunchEvent) {
// entry point for Angular and Vue frameworks
rootView = notifyLaunch(intent, savedInstanceState);
}

if (shouldCreateRootFrame) {
const extras = intent.getExtras();
let frameId = -1;

// We have extras when we call - new Frame().navigate();
// savedInstanceState is used when activity is recreated.
// NOTE: On API 23+ we get extras on first run.
// Check changed - first try to get frameId from Extras if not from saveInstanceState.
if (extras) {
frameId = extras.getInt(INTENT_EXTRA, -1);
}

if (savedInstanceState && frameId < 0) {
frameId = savedInstanceState.getInt(INTENT_EXTRA, -1);
}

if (!rootView) {
// If we have frameId from extras - we are starting a new activity from navigation (e.g. new Frame().navigate()))
// Then we check if we have frameId from savedInstanceState - this happens when Activity is destroyed but app was not (e.g. suspend)
rootView = getFrameByNumberId(frameId) || new Frame();
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 (rootView instanceof Frame) {
rootView.navigate(mainEntry);
if (shouldCreateRootFrame) {
const extras = intent.getExtras();
let frameId = -1;

// We have extras when we call - new Frame().navigate();
// savedInstanceState is used when activity is recreated.
// NOTE: On API 23+ we get extras on first run.
// Check changed - first try to get frameId from Extras if not from saveInstanceState.
if (extras) {
frameId = extras.getInt(INTENT_EXTRA, -1);
}

if (savedInstanceState && frameId < 0) {
frameId = savedInstanceState.getInt(INTENT_EXTRA, -1);
}

if (!rootView) {
// If we have frameId from extras - we are starting a new activity from navigation (e.g. new Frame().navigate()))
// Then we check if we have frameId from savedInstanceState - this happens when Activity is destroyed but app was not (e.g. suspend)
rootView = getFrameByNumberId(frameId) || new Frame();
}

if (rootView instanceof Frame) {
rootView.navigate(mainEntry);
} else {
throw new Error("A Frame must be used to navigate to a Page.");
}
} else {
throw new Error("A Frame must be used to navigate to a Page.");
rootView = createViewFromEntry(mainEntry);
}
} else {
// Create the root view if the notifyLaunch didn't return it
rootView = rootView || createViewFromEntry(mainEntry);
}

this._rootView = rootView;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.