Comments (8)
I'm using this plugin to implement an OAuth flow and ran into this issue aswell.
After some searching i found the following solution, which seems to work and close the SafariViewController.
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')
});
from nativescript-advanced-webview.
actually if launchMode
is singleTop
in Android, it automatically closes!
from nativescript-advanced-webview.
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
Pretty same for Android.
I'm using our custom version as dependency in my projects, for now.
from nativescript-advanced-webview.
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.
from nativescript-advanced-webview.
@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.
from nativescript-advanced-webview.
thanks @Aqu1nt that works !!
from nativescript-advanced-webview.
@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 !
from nativescript-advanced-webview.
@championswimmer the lib is => here feel free to send a pr 😄
from nativescript-advanced-webview.
Related Issues (20)
- Execution failed for task ':app:processDebugResources' HOT 7
- Fatal Crash on Android running NativeScript 4 HOT 1
- Not working on android HOT 4
- The app is not built since I installed the plugin HOT 3
- Breaks build on Android HOT 14
- pass data via URL HOT 4
- Android: co.fitcom.fancywebview.AdvancedWebViewListener is not defined HOT 1
- 'error' [TypeError: null is not an object (evaluating 'app.keyWindow')] HOT 3
- Does not Work when app is Released
- How to hide toolbar HOT 1
- How to get current URL or HTML? HOT 1
- android.content.ActivityNotFoundException: No Activity found to handle Intent HOT 1
- object dump on init (nativescript angular)
- nativescript-advanced-webview not compatible with latest NativeScript 6 HOT 21
- Error: java.lang.NoSuchMethodError: no static method "Landroid/view/View;.setPadding(IIII)V" HOT 5
- WebPage Not Available Issue
- Changed the links to Nativescript Core Packages to work with NS-8
- Not loading on iOS 15 HOT 7
- Does not work with Angular on iOS HOT 3
- Angular - IOS platform missing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-advanced-webview.