Skip to content

[Hover] Feature: Support/Document setting initialRoute similar to --route #276

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

Closed
devkabiir opened this issue Oct 2, 2019 · 8 comments · Fixed by #288
Closed

[Hover] Feature: Support/Document setting initialRoute similar to --route #276

devkabiir opened this issue Oct 2, 2019 · 8 comments · Fixed by #288
Assignees
Labels
enhancement New feature or request

Comments

@devkabiir
Copy link

When running apps on android flutter supports passing --route argument and sets that as the initial route. This is currently not possible for iOS.

However during testing/debugging, it's more productive to directly launch the app in the correct route. Can this be supported?
Example use
hover run --route="/post/5/edit"

@pchampio
Copy link
Member

pchampio commented Oct 2, 2019

Not duplicate nor related, but it does overlaps #240.

More information is available in #240 (comment).

To implement this feature, it is likely that we will need to write a custom plugin that calls the 'flutter/navigation' Method channel.

I don't know how do design this into hover as this plugin should only be loaded when using hover run. I've looked at the flutter source code, I couldn't find how they implemented flag.

@pchampio
Copy link
Member

pchampio commented Oct 2, 2019

The cleanest way might simply be to add another Options into go-flutter that calls the InvokeMethod on initialization.
The path of the route could be set using hover by injecting a build-time variable with Golang CC.

The second cleanest way might be to have a venv GOFLUTTER_ROUTE="/post/5/edit" hover run or GOFLUTTER_ROUTE="/post/5/edit" MyCompiledGoFlutterApp.exe.
The venv would be check from go-flutter code and if present, call the correct 'flutter/navigation' Method channel

@pchampio pchampio added the enhancement New feature or request label Oct 13, 2019
pchampio added a commit that referenced this issue Oct 19, 2019
pchampio added a commit that referenced this issue Oct 19, 2019
@pchampio
Copy link
Member

@devkabiir you can test #288 by running:
env GOFLUTTER_ROUTE="/post/5/edit" hover run -b '@feature/initial-route'

@pchampio
Copy link
Member

PR for the hover flag done.

@pchampio pchampio self-assigned this Oct 19, 2019
@devkabiir
Copy link
Author

Thanks @Drakirus!, While using a env variable is a good way, they are handled differently based on the host process. So for example, if the host process escapes " quotes and my route contains quotes, it will always provide incorrect route to flutter. Or for example if my route contains $ (special meaning in many shells) it will either be escaped or it will be processed by the host process/shell. I think using the env variable is a good start. It works for simple routes very well. But we will definitely need a better way.

Please consider exposing the functionality to set initialRoute in a more general purpose way. An example usage will be, my-app://token:123/?confirm_login, myapp can register a special url schema my-app:// and anything on the host OS can launch my app. This might require setting the initialRoute programmatically. And this will also require the already running myapp to intercept the my-app:// url and propely switch the route using pushRoute or something similar. (Maybe this should be a separate plugin, what do you think?)

Your initial implementation for setting initialRoute using hover and env variable works nice. Thanks and feel free to close this issue.

@pchampio
Copy link
Member

Please consider exposing the functionality to set initialRoute in a more general purpose way. An example usage will be, my-app://token:123/?confirm_login, myapp can register a special url schema my-app:// and anything on the host OS can launch my app. This might require setting the initialRoute programmatically. And this will also require the already running myapp to intercept the my-app:// url and propely switch the route using pushRoute or something similar. (Maybe this should be a separate plugin, what do you think?)

That's another issue: #240

I think the use of venv is good enough for development purposes. (which was your initial request ^^)

@pchampio
Copy link
Member

pchampio commented Oct 20, 2019

While I see to need for 'uni_links' I don't plan to work on it.
Mainly because it cannot be done without platform specific configuration/code.

I'll be happy to have a plug-in for url-links, please consider contributing on #240 😊😁

pchampio added a commit that referenced this issue Nov 4, 2019
* feat: changes the inital flutter route

fixes: /issues/276

* refactor: address PR comment

* add method to append flutterInitialized cb
@pchampio
Copy link
Member

pchampio commented Nov 4, 2019

Feature available in go-flutter: v0.31.0 and hover v0.36.0.
Please run: go get -u github.com/go-flutter-desktop/hover to update hover, and then hover bumpversion to upgrade hover and the project in which your are.

Then the hover run --route "/XXX" cmd will be available!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants