Resolves #274 Use Lovelace UI by default

This commit is contained in:
Yegor Vialov 2019-01-25 22:29:16 +02:00
parent 724d32dbe2
commit 09199d30e8
2 changed files with 5 additions and 5 deletions

View File

@ -199,7 +199,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
_webSocketApiEndpoint = "${prefs.getString('hassio-protocol')}://$domain:$port/api/websocket"; _webSocketApiEndpoint = "${prefs.getString('hassio-protocol')}://$domain:$port/api/websocket";
homeAssistantWebHost = "${prefs.getString('hassio-res-protocol')}://$domain:$port"; homeAssistantWebHost = "${prefs.getString('hassio-res-protocol')}://$domain:$port";
_password = prefs.getString('hassio-password'); _password = prefs.getString('hassio-password');
_useLovelaceUI = prefs.getBool('use-lovelace') ?? false; _useLovelaceUI = prefs.getBool('use-lovelace') ?? true;
if ((domain == null) || (port == null) || (_password == null) || if ((domain == null) || (port == null) || (_password == null) ||
(domain.length == 0) || (port.length == 0) || (_password.length == 0)) { (domain.length == 0) || (port.length == 0) || (_password.length == 0)) {
throw("Check connection settings"); throw("Check connection settings");

View File

@ -18,8 +18,8 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
String _newHassioPassword = ""; String _newHassioPassword = "";
String _socketProtocol = "wss"; String _socketProtocol = "wss";
String _newSocketProtocol = "wss"; String _newSocketProtocol = "wss";
bool _useLovelace = false; bool _useLovelace = true;
bool _newUseLovelace = false; bool _newUseLovelace = true;
@override @override
void initState() { void initState() {
@ -36,9 +36,9 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
_hassioPassword = _newHassioPassword = prefs.getString("hassio-password") ?? ""; _hassioPassword = _newHassioPassword = prefs.getString("hassio-password") ?? "";
_socketProtocol = _newSocketProtocol = prefs.getString("hassio-protocol") ?? 'wss'; _socketProtocol = _newSocketProtocol = prefs.getString("hassio-protocol") ?? 'wss';
try { try {
_useLovelace = _newUseLovelace = prefs.getBool("use-lovelace") ?? false; _useLovelace = _newUseLovelace = prefs.getBool("use-lovelace") ?? true;
} catch (e) { } catch (e) {
_useLovelace = _newUseLovelace = false; _useLovelace = _newUseLovelace = true;
} }
}); });
} }