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

Expose wry navigation_handler via WindowBuilder closes #4080 #5686

Merged
merged 5 commits into from
Dec 27, 2022

Conversation

silvanshade
Copy link
Contributor

@silvanshade silvanshade commented Nov 24, 2022

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

Rationale

Currently, it is difficult to use tauri for certain situations, for example, those involving OAuth redirects. This has been noted in issues #3020, #5411, and elsewhere.

In some cases it is possible to find workarounds, such as by launching a local warp server and handling localhost redirects that way, but this is not always possible, particularly when the service in question uses deep linking and app-specific custom URI schemes.

A simple way to address this problem is to allow handling of URL navigation events with a callback configured for the webview. This is already possible now with wry using WebViewBuilder::with_navigation_handler. However, as far as I could tell, there was no way to access this functionality from wry directly through tauri prior to this PR.

This PR resolves that problem by allowing the user to set a navigation handler with tauri::WindowBuilder which then gets passed on to wry when the window is created via the runtime.

@silvanshade
Copy link
Contributor Author

Fixes #5411.

@silvanshade silvanshade force-pushed the feature/navigation_handler branch 2 times, most recently from d98e9bf to 8685edd Compare November 24, 2022 20:28
@silvanshade silvanshade marked this pull request as ready for review November 24, 2022 20:41
@silvanshade silvanshade requested a review from a team as a code owner November 24, 2022 20:41
@lucasfernog lucasfernog changed the title Expose wry navigation_handler via WindowBuilder Expose wry navigation_handler via WindowBuilder closes #4080 Dec 27, 2022
lucasfernog
lucasfernog previously approved these changes Dec 27, 2022
Copy link
Member

@lucasfernog lucasfernog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR, thanks!

@lucasfernog lucasfernog merged commit 3f35b45 into tauri-apps:dev Dec 27, 2022
luoffei pushed a commit to luoffei/tauri that referenced this pull request Dec 29, 2022
tauri-apps#5686)

Co-authored-by: silvanshade <silvanshade@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants