Remove webview plugin
This commit is contained in:
@ -10,47 +10,16 @@ class Launcher {
|
||||
}
|
||||
}
|
||||
|
||||
static void launchAuthenticatedWebView({BuildContext context, String url, String title}) {
|
||||
if (url.contains("?")) {
|
||||
url += "&external_auth=1";
|
||||
} else {
|
||||
url += "?external_auth=1";
|
||||
}
|
||||
final flutterWebViewPlugin = new FlutterWebviewPlugin();
|
||||
flutterWebViewPlugin.onStateChanged.listen((viewState) async {
|
||||
if (viewState.type == WebViewState.startLoad) {
|
||||
Logger.d("[WebView] Injecting external auth JS");
|
||||
rootBundle.loadString('assets/js/externalAuth.js').then((js){
|
||||
flutterWebViewPlugin.evalJavascript(js.replaceFirst("[token]", ConnectionManager()._token));
|
||||
});
|
||||
}
|
||||
});
|
||||
Navigator.of(context).pushNamed(
|
||||
"/webview",
|
||||
arguments: {
|
||||
"url": "$url",
|
||||
"title": "${title ?? ''}"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static void launchURLInCustomTab({BuildContext context, String url, bool enableDefaultShare: true, bool showPageTitle: true}) async {
|
||||
try {
|
||||
await launch(
|
||||
"$url",
|
||||
option: new CustomTabsOption(
|
||||
toolbarColor: Theme.of(context).primaryColor,
|
||||
toolbarColor: context != null ? Theme.of(context).primaryColor : Colors.blue,
|
||||
enableDefaultShare: enableDefaultShare,
|
||||
enableUrlBarHiding: true,
|
||||
showPageTitle: showPageTitle,
|
||||
animation: new CustomTabsAnimation.slideIn()
|
||||
// or user defined animation.
|
||||
/*animation: new CustomTabsAnimation(
|
||||
startEnter: 'slide_up',
|
||||
startExit: 'android:anim/fade_out',
|
||||
endEnter: 'android:anim/fade_in',
|
||||
endExit: 'slide_down',
|
||||
)*/,
|
||||
animation: new CustomTabsAnimation.slideIn(),
|
||||
extraCustomTabs: <String>[
|
||||
// ref. https://play.google.com/store/apps/details?id=org.mozilla.firefox
|
||||
'org.mozilla.firefox',
|
||||
|
Reference in New Issue
Block a user