Fix CleartextTraffic issue. WIP #338

This commit is contained in:
estevez-dev
2019-03-19 23:20:57 +02:00
parent ccb88884a7
commit 0efef33e53
3 changed files with 17 additions and 27 deletions

View File

@ -51,8 +51,6 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
} catch (e) {
_useLovelace = _newUseLovelace = true;
}
oauthUrl = "${ _newSocketProtocol == "wss" ? "https" : "http"}://$_newHassioDomain:${_newHassioPort ?? ''}/auth/authorize?client_id=${Uri.encodeComponent('http://ha-client.homemade.systems/')}&redirect_uri=${Uri.encodeComponent('http://ha-client.homemade.systems/service/auth_callback.html')}";
Logger.d("OAuth url: $oauthUrl");
});
}
@ -80,24 +78,22 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
@override
Widget build(BuildContext context) {
Widget webViewButton;
if (oauthUrl != null) {
webViewButton = FlatButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => WebviewScaffold(
url: oauthUrl,
appBar: new AppBar(
title: new Text("Login"),
)
)
));
},
child: Text("Login with Home Assistant")
);
} else {
webViewButton = Container(height: 0.0,);
}
Widget webViewButton = RaisedButton(
color: Colors.blue[200],
onPressed: () {
oauthUrl = "${ _newSocketProtocol == "wss" ? "https" : "http"}://$_newHassioDomain:${_newHassioPort ?? ''}/auth/authorize?client_id=${Uri.encodeComponent('http://ha-client.homemade.systems/')}&redirect_uri=${Uri.encodeComponent('http://ha-client.homemade.systems/service/auth_callback.html')}";
Logger.d("OAuth url: $oauthUrl");
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => WebviewScaffold(
url: oauthUrl,
appBar: new AppBar(
title: new Text("Login"),
)
)
));
},
child: Text("Login with Home Assistant")
);
return new Scaffold(
appBar: new AppBar(
leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: (){