Expose a new handle(externalURL)
function
#165
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found two issues that I think need solving in
TurboNavigationHierarchyController.openExternal(url: URL, navigationType: NavigationStackType)
.UIApplication
(for example, a deeplink to another app).For the hard-coded behavior, I've moved the behavior to TurboNavigator and exposed another function in
TurboNavigatorDelegate
,handle(externalURL:) -> ExternalURLNavigationAction
. The default I chose is to send it to the system so it opens Safari (the app). The framework consumer may choose to open it in-app via a SafariController or it can choose to handle it on its own, maybe alerting the user before navigating away.The delegation pattern solves handling non-http/https URLs. We'll report all external URLs to
TurboNavigator
's delegate, http/https or otherwise.Again, I'm opening a draft so we can discuss it. Happy to change the approach and add unit tests once we're ok with it.