This commit is contained in:
Yegor Vialov 2019-10-28 10:43:10 +00:00
parent 5cda98da46
commit 9c42ad687d
4 changed files with 16 additions and 12 deletions

View File

@ -13,6 +13,7 @@ class HomeAssistant {
Map _instanceConfig = {}; Map _instanceConfig = {};
Map services; Map services;
String _userName; String _userName;
bool childMode;
HSVColor savedColor; HSVColor savedColor;
int savedPlayerPosition; int savedPlayerPosition;
String sendToPlayerId; String sendToPlayerId;
@ -68,7 +69,7 @@ class HomeAssistant {
)); ));
Future.wait(futures).then((_) { Future.wait(futures).then((_) {
if (isMobileAppEnabled) { if (isMobileAppEnabled) {
_createUI(); if (!childMode) _createUI();
_fetchCompleter.complete(); _fetchCompleter.complete();
MobileAppIntegrationManager.checkAppRegistration(); MobileAppIntegrationManager.checkAppRegistration();
} else { } else {
@ -113,8 +114,11 @@ class HomeAssistant {
Future _getUserInfo() async { Future _getUserInfo() async {
_userName = null; _userName = null;
await ConnectionManager().sendSocketMessage(type: "auth/current_user").then((data) => _userName = data["name"]).catchError((e) { await ConnectionManager().sendSocketMessage(type: "auth/current_user").then((data) {
Logger.w("Can't get user info: ${e}"); _userName = data["name"];
childMode = _userName.startsWith("[child]");
}).catchError((e) {
Logger.w("Can't get user info: $e");
}); });
} }
@ -124,7 +128,7 @@ class HomeAssistant {
Logger.d("Media extractor: ${data["media_extractor"]}"); Logger.d("Media extractor: ${data["media_extractor"]}");
services = data; services = data;
}).catchError((e) { }).catchError((e) {
Logger.w("Can't get services: ${e}"); Logger.w("Can't get services: $e");
}); });
} }

View File

@ -142,7 +142,7 @@ final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin(); FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
const String appName = "HA Client"; const String appName = "HA Client";
const appVersionNumber = "0.7.0"; const appVersionNumber = "0.7.0";
const appVersionAdd = "alpha1"; const appVersionAdd = "";
const appVersion = "$appVersionNumber-$appVersionAdd"; const appVersion = "$appVersionNumber-$appVersionAdd";
void main() async { void main() async {

View File

@ -14,7 +14,7 @@ class StartupUserMessagesManager {
bool _supportAppDevelopmentMessageShown; bool _supportAppDevelopmentMessageShown;
bool _whatsNewMessageShown; bool _whatsNewMessageShown;
static final _supportAppDevelopmentMessageKey = "user-message-shown-support-development_3"; static final _supportAppDevelopmentMessageKey = "user-message-shown-support-development_3";
static final _whatsNewMessageKey = "user-message-shown-whats-new-705"; static final _whatsNewMessageKey = "user-message-shown-whats-new-706";
void checkMessagesToShow() async { void checkMessagesToShow() async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();

View File

@ -1,7 +1,7 @@
name: hass_client name: hass_client
description: Home Assistant Android Client description: Home Assistant Android Client
version: 0.7.0+705 version: 0.7.0+706
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.0.0-dev.68.0 <3.0.0"