bradmartin / nativescript-advanced-webview

NativeScript plugin for Chrome CustomTabs on Android and SafariViewController on iOS.
Other
60 stars 28 forks source link

add ability to close view in ios #42

Closed garystubbings closed 4 years ago

garystubbings commented 5 years ago

Based on one other request I also see the need to close the ios web view so have prepared this pull request.

Reached commented 5 years ago

So with this we can just call advancedWebview.close() and it would close?

That would be awesome!

garystubbings commented 5 years ago

So with this we can just call advancedWebview.close() and it would close?

That would be awesome!

Yeah, it would only work for iOS though, android doesn't support this. I am using this with my authorization_code grant flow, opening the advancedWebView when dispatching login and then closing it after the token response. It's worth noting that android closes automatically when the activity is setup correctly.

Reached commented 5 years ago

@garystubbings - cool, we have a similar flow that we use for our app, where normally I would send the user back with a deep-link after successful authentication (which works for the regular browser), but in the advanced version it just sorta "freezes", so this should fix it!

Thanks, hope it will be merged soon.

garystubbings commented 5 years ago

@garystubbings - cool, we have a similar flow that we use for our app, where normally I would send the user back with a deep-link after successful authentication (which works for the regular browser), but in the advanced version it just sorta "freezes", so this should fix it!

Thanks, hope it will be merged soon.

Exactly the same here @Reached , the deeplink callback dispatches an event to fetch the token and now the advancedWebView is persisted from the authorize request it just needs to simply call advancedWebView .close() as you say.

I think @bradmartin has some uncommitted changes (looking at the source on npm) so not sure if he'll want me to rebase - if he approves of the changes. Or he can integrate the changes with his uncommitted version as there isn't that many.