Fix CleartextTraffic issue. WIP #338
This commit is contained in:
parent
ccb88884a7
commit
0efef33e53
@ -16,7 +16,7 @@
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="HA Client"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:networkSecurityConfig="@xml/network_security_config">
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="true">homemade.systems</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
@ -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: (){
|
||||
|
Reference in New Issue
Block a user