Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added optional single host MvxStartActivity #4846

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

entdark
Copy link
Contributor

@entdark entdark commented Mar 29, 2024

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Prevent double Acitivity navigation on startup (MvxStartActivity then first VM Activity) and navigate directly to the main launcher Activity that is MvxStartActivity and the host for fragments.

⤵️ What is the current behavior?

Currently MvxStartActivity starts the app and navigates to the first VM that view is expected to be an Activity.

🆕 What is the new behavior (if this is a feature change)?

Made MvxStartActivity to be used simultaneously as the main launcher and the host for fragments.
SingleHostActivity property controls the old and new behaviour.
In the new behaviour it never Finish() the MvxStartActivity when it already launched with first VM.

💥 Does this PR introduce a breaking change?

Should not. I made things optional and defaults to original behaviour. (Maybe should default to the new one and break?)

🐛 Recommendations for testing

Test any first VM that navigates to a Fragment rather than to an Activity.

📝 Links to relevant issues/docs

🤔 Checklist before submitting

@Cheesebaron
Copy link
Member

Using MvxStartActivity is already optional, you can simply not have it in your App and makre you "single host" Activity as the MainLauncher, so I am not sure if this PR is necessary. Can you elaborate exactly what it solves?

@entdark
Copy link
Contributor Author

entdark commented Mar 29, 2024

Can you elaborate exactly what it solves?

MvxStartActivity is the only default way that calls IMvxAppStart.StartAsync(). Calling it manually and handling that IMvxAppStart.IsStarted is a bit overcomplication. It would be cool to have single host activity out of the box that does all the startup magic for you.
In my projects I have to call it manually for now.

Maybe my solution could be designed a bit better and/or named better - I am fine to tune it before the PR.
Additionally, I also thought creating another MvxStartActivity maybe named differently with all that logic or revert back MvxSplashScreenActivity and have them both. Currently MvxStartActivity is more like old MvxSplashScreenActivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants