-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Update hotwire-native-ios to 1.2 #224
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
base: main
Are you sure you want to change the base?
Conversation
* update API changes that includes updating visitableURL to initialVisitableURL and currentVisitableURL
| func session(_ session: Session, decidePolicyFor navigationAction: WKNavigationAction) -> WebViewPolicyManager.Decision { | ||
| guard let url = navigationAction.request.url else { | ||
| return .allow | ||
| } | ||
| // regardless of the return value here nothing happens, so we have to manually open external URL | ||
| visitableView?.didOpenExternalUrl(url: url) | ||
| return .allow | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has introduced a new behavior in our app. This seems to be called for on-page <iframe src=".."> elements.
As an example, in our app we use Google Tag Manager. They have an initialization script that includes an <iframe src="https://www.googletagmanager.com/ns.html?...">. On every page view in the app, we see that didOpenExternalUrl is called with the Google Tag Manager URL with no way to differentiate if it was a user-decided navigation action or an on-page iframe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hotwire Native has an extension that provides some additional properties to indicate if the navigationAction happened in the main frame etc: https://github.com/hotwired/hotwire-native-ios/blob/f18b87938f55cbe8976e96702b5512fa9afcd674/Source/Turbo/Navigator/Extensions/WKNavigationAction%2BUtils.swift#L1C1-L12C1
I think there's a few things going on here:
- The previous
Session#openExternalURLthat we relied on to trigger thedidOpenExternalUrlon the RN-side was changed in Hotwire Native iOS to support the cross-origin redirects. - We have not yet fully supported the change
- The current implementation in this PR is to naive and triggers even for iframes etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a PR #225 that addresses this.
|
After extensive testing, I think this isn't ready to merge. I'll see if I can wrap up a PR that addresses the issues separately - there are a few regressions here besides the one in #225. |
|
Hello @pfeiffer 👋 I was planning to merge #225 and wanted to check if this PR fully addresses the three issues you mentioned there. Regarding the unresolved regressions – could you clarify what they are exactly? If possible, a minimal, reproducible example would be super helpful. I've just started working with this repository and am trying to understand the context. |
Summary
visitableURLtoinitialVisitableURLandcurrentVisitableURL. Related hotwire-native-ios PR: Reflect current web view page location inVisitableViewControllerhotwired/hotwire-native-ios#108.session(decidePolicyFor)that opens external URL. We might consider making it more configurable with props but it's out of the scope of this PR. Related hotwire-native-ios PR: Route decision handlers hotwired/hotwire-native-ios#105Test plan