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

Add cross-origin redirect delegate #203

Closed

Conversation

pfeiffer
Copy link
Contributor

Follow-up of #201.

As discussed in #201 it would be preferrable to handle cross-origin redirects in the SessionDelegate.

This PR takes a stab at that to get the ball rolling so we can get feature parity between iOS and Android libs again :-)

@joemasilotti joemasilotti changed the base branch from cross-origin-redirect to main May 2, 2024 16:12
Copy link
Member

@joemasilotti joemasilotti left a comment

Choose a reason for hiding this comment

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

I like this approach much better! I tested running against the demo PR and everything works as expected after adding the require delegate callback.

I added one suggestion to make the documentation even more obvious where the cross-origin redirect handling code should go.

Comment on lines +112 to +113
navigationController.popViewController(animated: false)
UIApplication.shared.open(url)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
navigationController.popViewController(animated: false)
UIApplication.shared.open(url)
func session(_ session: Session, didProposeVisitToCrossOriginRedirect url: URL) {
navigationController.popViewController(animated: false)
UIApplication.shared.open(url)
}

@tim-vandecasteele
Copy link

Hi @pfeiffer @joemasilotti , I was wondering if there is a reason this is not merged? Is this waiting for something, or just not merged yet because of time?

@joemasilotti
Copy link
Member

We migrated to Hotwire Native before resolving this issue. Please open an issue/PR on that repo if you'd like to continue the discussion!

@jayohms
Copy link
Collaborator

jayohms commented Jan 7, 2025

I'm closing this since the approach does not work across all applications with the javascript Fetch API with varying CORS restrictions. A different approach was implemented on the Android side in Hotwire Native: hotwired/hotwire-native-android#82

We're going to bring this same approach to Hotwire Native iOS as well, shortly.

@jayohms jayohms closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants