-
Notifications
You must be signed in to change notification settings - Fork 992
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
Embedded Capacitor: Pass urlPath to Bridge #3405
Conversation
This is currently possible by using the following constructor for a new bridge fragment:
where Although this does not suit the use case where you use the BridgeFragment by extending and inflating via XML, as an example. The way this is currently written would allow you to call |
I actually tried to modify Imagine a typical React-app with react-router: I only want to build a single React-app with multiple routes, instead of building multiple React-apps. In other words: |
One more note about the My solution supports both XML-inflation and fragment manager, since it is perfectly fine to subclass a fragment and then instantiate it with Therefore, it might be a good idea to replace the In #3280, I also made the experience that static builder methods are less flexible than simple setter methods. |
Ah I see, so it sounds like there are a couple of use cases:
Am I understanding that correctly? If so then two different settings do make sense. One for the app directory and one optional for a route in that web app (default Yeah, this reminded me of the plugin PR also :) |
Yes this is correct, those are two independent functionalities. Other than that, native route configuration might be also useful if the native app uses Capacitor to present a domain-object like Furthermore, I also want to use This practice removes the necessity to fetch parameters with custom Capacitor plugins, which leads to a potential speedup during launch time of the web-app (and simplified code). In theory, this PR could be entirely replaced with custom Capacitor plugins, but the launch-performance would be worse and it would be more cumbersome to write. |
Any updates on this PR? |
Hi Felix, sorry for delay in response. We think this is definitely a good addition to embedded Capacitor and know there is opportunity to improve the embedded use case. While trying to think of a way to incorporate this now in context of upcoming potentially breaking changes and cleanup, we felt it would be best to wait and include changes to address this use case as part of the overall upcoming improvements for embedded Capacitor in v3 for both mobile platforms. Thanks for bringing attention to this and helping improve Capacitor. |
I have to admit that I am a little bit frustrated about the current merge-situation. One more sidenote: |
@fkirc It's never easy in transitions between major versions like this. Luckily, we are happily accepting bug fixes to the For what it's worth, we don't plan on increasing the scope of Capacitor 3 beyond what this issue outlines, and we're making good progress. |
Perhaps I am mistaken, but I thought that Capacitor 3.X is developed on the |
Yeah, that's correct. I believe @carlpoole is saying that there's a larger suite of changes being planned for the Embedded Capacitor use case. Although it may be possible today in Capacitor 2.x, it isn't a focus or a documented feature. It will be for Capacitor 3.x, though. |
The proposed addition in this PR is great and we are going to include a way to specify the path in 3.x. In its current form the changes will conflict with plans we are exploring in refining the configuration and Embedded developer experience. This development is expected to begin in the coming month and we would rather approach this as one larger improvement to both native platforms than merge a change for Android now that will change again soon. Please do continue to submit bug reports/fixes and suggest features as we are always interested in improving Capacitor. The help is greatly appreciated. |
For Embedded Capacitor, it is often necessary to have multiple Capacitor fragments with different routes.
For example, I have two embedded Capacitor fragments like this:
http://localhost/feature_1
http://localhost/feature_2
This PR passes the
/feature_1
and/feature_2
to the target bridges.It is somewhat similar to the following iOS-issue: #3106
My intended usage of this PR is as follows (although not the only possible usage):
Limitations and Further Work
Passing only the URL path might not be enough for all use cases of Embedded Capacitor.
For example, one might have different hosts instead of different URL paths.
Although this practice might be forbidden by app store guidelines, it might still be a valid use case:
https://remote_host_1.com
https://remote_host_2.com
More generally, I propose a system where the entire Capacitor-configuration can be dynamically modified/overriden by the native code.
In turn, this may or may not lead to the elimination of the native
capacitor.config.json
-files.Nevertheless, I still submit this PR because I cannot estimate how long it would take to have a new configuration system.