Handling of redirect to external site
MichalSznajder opened this issue · 2 comments
I have web shop web application that uses Hotwire and I'm trying to create an native app around it. I am not sure how I should handle following payment scenario:
- User presses
Start Payment
button in my app - I execute
Turbo.visit(BANK_URL)
- Turbo Drive updates
window.location.href
with BANK_URL (kind of redirect to external url) - Browser opens bank payment page
- User pays
- Bank redirect to my application
With Turbo Native it does not work since TurboWebChromeClient
intercepts new window creation and I have CORS failures when fetch
is executed to external page.
What is proper solution for this? I am thinking of creating separate TurboFragment
with new WebView, visit BANK_URLand intercept redirect from bank to navigate on Turbo Native side.
Demo app also show usage of CutomTab but I am not sure if I can intercept redirect in this scenario.
I first tried with androidx.browser.customtabs.CustomTabsIntent
to create separate Chrome instance and than use linking to go back to app. This works quite well.
In the end I ended with new activity with separate WebView
since I have multple flavors and I didn't want to customize ANdroidManifest.xml
for each flavour to allow deep linking.
@MichalSznajder hi, I am not an Android developer, but I am facing a very similar issue. I figured out how to open a Chrome instance, but I am unsure how to use linking to go back to the app. Could you, please, share the way to achieve it or point me in the right direction?