Resolves #118 Fix message queue issue
This commit is contained in:
parent
253316fb1f
commit
70b6469bd1
@ -27,9 +27,9 @@ class HomeAssistant {
|
|||||||
|
|
||||||
StreamSubscription _socketSubscription;
|
StreamSubscription _socketSubscription;
|
||||||
|
|
||||||
int messageExpirationTime = 50; //seconds
|
int messageExpirationTime = 45; //seconds
|
||||||
Duration fetchTimeout = Duration(seconds: 30);
|
Duration fetchTimeout = Duration(seconds: 45);
|
||||||
Duration connectTimeout = Duration(seconds: 10);
|
Duration connectTimeout = Duration(seconds: 15);
|
||||||
|
|
||||||
String get locationName => _instanceConfig["location_name"] ?? "";
|
String get locationName => _instanceConfig["location_name"] ?? "";
|
||||||
int get viewsCount => _entities.viewList.length ?? 0;
|
int get viewsCount => _entities.viewList.length ?? 0;
|
||||||
@ -353,6 +353,6 @@ class HAMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isExpired() {
|
bool isExpired() {
|
||||||
return _timeStamp.difference(DateTime.now()).inSeconds > _messageTimeout;
|
return DateTime.now().difference(_timeStamp).inSeconds > _messageTimeout;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -202,6 +202,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_refreshData() async {
|
_refreshData() async {
|
||||||
|
_hideErrorSnackBar();
|
||||||
_homeAssistant.updateConnectionSettings(_apiEndpoint, _apiPassword, _authType);
|
_homeAssistant.updateConnectionSettings(_apiEndpoint, _apiPassword, _authType);
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = 1;
|
_isLoading = 1;
|
||||||
@ -370,7 +371,11 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_showErrorSnackBar({Key key, @required String message, @required int errorCode}) {
|
void _hideErrorSnackBar() {
|
||||||
|
_scaffoldKey?.currentState?.hideCurrentSnackBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showErrorSnackBar({Key key, @required String message, @required int errorCode}) {
|
||||||
SnackBarAction action;
|
SnackBarAction action;
|
||||||
switch (errorCode) {
|
switch (errorCode) {
|
||||||
case 9:
|
case 9:
|
||||||
|
Reference in New Issue
Block a user