MvvmCross icon indicating copy to clipboard operation
MvvmCross copied to clipboard

Added optional single host MvxStartActivity

Open entdark opened this issue 1 year ago • 2 comments

:sparkles: 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.

:arrow_heading_down: What is the current behavior?

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

:new: 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.

:boom: 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?)

:bug: Recommendations for testing

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

:memo: Links to relevant issues/docs

:thinking: Checklist before submitting

  • [X] All projects build
  • [X] Follows style guide lines (code style guide)
  • [X] Relevant documentation was updated (docs style guide)
  • [X] Rebased onto current develop

entdark avatar Mar 29 '24 16:03 entdark

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?

Cheesebaron avatar Mar 29 '24 18:03 Cheesebaron

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.

entdark avatar Mar 29 '24 18:03 entdark