mirror of
https://github.com/go-vikunja/app
synced 2024-06-06 20:49:48 +00:00
fixed problem that disables leaving webview
This commit is contained in:
parent
4c805bfcbe
commit
792aaca687
|
@ -146,7 +146,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) =>
|
||||
LoginWithWebView(_serverController.text))).then((btp) => _loginUserByClientToken(btp));
|
||||
LoginWithWebView(_serverController.text))).then((btp) { if(btp != null) _loginUserByClientToken(btp);});
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Please enter your frontend url")));
|
||||
}
|
||||
|
|
|
@ -41,10 +41,13 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
|
|||
appBar: AppBar(),
|
||||
body: webView
|
||||
),
|
||||
onWillPop: () {_handlePageFinished(""); return Future.value(false);},);
|
||||
onWillPop: () async {
|
||||
bool hasPopped = await _handlePageFinished("");
|
||||
return Future.value(!hasPopped);
|
||||
},);
|
||||
}
|
||||
|
||||
void _handlePageFinished(String pageLocation) async {
|
||||
Future<bool> _handlePageFinished(String pageLocation) async {
|
||||
log("handlePageFinished");
|
||||
if(webViewController != null) {
|
||||
String localStorage = await webViewController
|
||||
|
@ -60,9 +63,11 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
|
|||
BaseTokenPair baseTokenPair = BaseTokenPair(
|
||||
apiUrl, json["token"]);
|
||||
Navigator.pop(context, baseTokenPair);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user