-
Notifications
You must be signed in to change notification settings - Fork 28
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 Ability to Close WebView #26
Comments
Hello @one-adam-nolan , I need exactly the same thing and I am interested in your implementation of the dismiss call for SafariViewController. Can you please provide a link to your branch? I checked this repository but I couldn't find the implementation. Thanks. |
@alexmeia Sorry about not getting back with you sooner. I need to check my work computer to see if I still have that repo locally. At the time, I hadn't really used git and had some trouble setting up my fork. |
I'm using this plugin to implement an OAuth flow and ran into this issue aswell. This might help to implement the close() feature or for other people having the same issue. import * as application from 'application';
// Only for IOS
const controller = application.ios.nativeApp.windows[0].rootViewController;
controller.dismissViewControllerAnimatedCompletion(true, () => {
console.log('Safari dismissed')
}); |
thanks @Aqu1nt that works !! |
@bradmartin I'll try to implement the same in Android, and if theres a reliable way to do both in Android and iOS, you can maybe add a method in the library itself that does it ! |
@championswimmer the lib is => here feel free to send a pr 😄 |
actually if |
Two months ago I was in a rush to make it close the advanced webview in iOS after login, and I did a little edit to the plugin to return the SFSafariViewController (or the AdvancedWebView in Android) when the method openAdvancedUrl is called. In this way, you can close the WebView calling the native methods (in my case, as @championswimmer said, this was needed only in iOS). let advancedWebView: any;
advancedWebView = openAdvancedUrl(opts);
export function closeAdvancedWebView(animated: boolean) {
// No need to manually close advancedWebView in Android.
if (advancedWebView && platform.isIOS) {
advancedWebView.dismissViewControllerAnimatedCompletion(animated, null);
}
} If this can be useful, you can see iOS the edit here: https://github.com/phoops/nativescript-advanced-webview/blob/master/advanced-webview.ios.ts#L79 |
This would be really helpful for OpenId Connect using a Hybrid Authorization Workflow. For my case, I launch to the external browser for login (Identity Server 4) and use the redirect with UrlHandler. If the server redirect is something like
adams.app://authorized
I want to programmatically be able to close the webview and pop back into the app.I have a created a branch locally and have implemented the dismiss call for the SafariViewController (iOS) in the Demo app. Unfortunately, its been sometime since I have dealt with native Android; so I am not sure where to start there.
The text was updated successfully, but these errors were encountered: