0.7.0
This commit is contained in:
parent
5cda98da46
commit
9c42ad687d
@ -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");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +373,7 @@ class SendMessageQueue {
|
|||||||
void add(String message) {
|
void add(String message) {
|
||||||
_queue.add(HAMessage(_messageTimeout, message));
|
_queue.add(HAMessage(_messageTimeout, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> getActualMessages() {
|
List<String> getActualMessages() {
|
||||||
_queue.removeWhere((item) => item.isExpired());
|
_queue.removeWhere((item) => item.isExpired());
|
||||||
List<String> result = [];
|
List<String> result = [];
|
||||||
@ -379,22 +383,22 @@ class SendMessageQueue {
|
|||||||
this.clear();
|
this.clear();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
_queue.clear();
|
_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class HAMessage {
|
class HAMessage {
|
||||||
DateTime _timeStamp;
|
DateTime _timeStamp;
|
||||||
int _messageTimeout;
|
int _messageTimeout;
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
HAMessage(this._messageTimeout, this.message) {
|
HAMessage(this._messageTimeout, this.message) {
|
||||||
_timeStamp = DateTime.now();
|
_timeStamp = DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isExpired() {
|
bool isExpired() {
|
||||||
return DateTime.now().difference(_timeStamp).inSeconds > _messageTimeout;
|
return DateTime.now().difference(_timeStamp).inSeconds > _messageTimeout;
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
@ -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();
|
||||||
|
@ -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"
|
||||||
|
Reference in New Issue
Block a user