Compare commits
10 Commits
1.1.0-beta
...
1.1.0
Author | SHA1 | Date | |
---|---|---|---|
5f4a3fbdfc | |||
312ed99e9f | |||
25e6d51c17 | |||
b501574bab | |||
53b31d8e90 | |||
6d80420a9b | |||
e977054139 | |||
6367d38524 | |||
f9b2d7d84c | |||
44c28ad106 |
@ -145,7 +145,7 @@ public class MessagingService extends FirebaseMessagingService {
|
|||||||
connection.connect();
|
connection.connect();
|
||||||
InputStream input = connection.getInputStream();
|
InputStream input = connection.getInputStream();
|
||||||
return BitmapFactory.decodeStream(input);
|
return BitmapFactory.decodeStream(input);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,12 @@ class CardData {
|
|||||||
return BadgesData(rawData);
|
return BadgesData(rawData);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (rawData.containsKey('entity')) {
|
||||||
|
rawData['entities'] = [rawData['entity']];
|
||||||
|
}
|
||||||
|
if (rawData.containsKey('entities') && rawData['entities'] is List) {
|
||||||
|
return EntitiesCardData(rawData);
|
||||||
|
}
|
||||||
return CardData(null);
|
return CardData(null);
|
||||||
}
|
}
|
||||||
} catch (error, stacktrace) {
|
} catch (error, stacktrace) {
|
||||||
@ -103,7 +109,11 @@ class CardData {
|
|||||||
type = rawData['type'];
|
type = rawData['type'];
|
||||||
conditions = rawData['conditions'] ?? [];
|
conditions = rawData['conditions'] ?? [];
|
||||||
showEmpty = rawData['show_empty'] ?? true;
|
showEmpty = rawData['show_empty'] ?? true;
|
||||||
stateFilter = rawData['state_filter'] ?? [];
|
if (rawData.containsKey('state_filter') && rawData['state_filter'] is List) {
|
||||||
|
stateFilter = rawData['state_filter'];
|
||||||
|
} else {
|
||||||
|
stateFilter = [];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
type = CardType.UNKNOWN;
|
type = CardType.UNKNOWN;
|
||||||
conditions = [];
|
conditions = [];
|
||||||
@ -374,7 +384,13 @@ class LightCardData extends CardData {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget buildCardWidget() {
|
Widget buildCardWidget() {
|
||||||
return LightCard(card: this);
|
if (this.entity != null && this.entity.entity is LightEntity) {
|
||||||
|
return LightCard(card: this);
|
||||||
|
}
|
||||||
|
return ErrorCard(
|
||||||
|
errorText: 'Specify an entity from within the light domain.',
|
||||||
|
showReportButton: false,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
LightCardData(rawData) : super(rawData) {
|
LightCardData(rawData) : super(rawData) {
|
||||||
|
@ -2,12 +2,21 @@ part of '../main.dart';
|
|||||||
|
|
||||||
class ErrorCard extends StatelessWidget {
|
class ErrorCard extends StatelessWidget {
|
||||||
final ErrorCardData card;
|
final ErrorCardData card;
|
||||||
|
final String errorText;
|
||||||
|
final bool showReportButton;
|
||||||
|
|
||||||
const ErrorCard({Key key, this.card}) : super(key: key);
|
const ErrorCard({Key key, this.card, this.errorText, this.showReportButton: true}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
String error;
|
||||||
|
if (errorText == null) {
|
||||||
|
error = 'There was an error showing ${card?.type}';
|
||||||
|
} else {
|
||||||
|
error = errorText;
|
||||||
|
}
|
||||||
return CardWrapper(
|
return CardWrapper(
|
||||||
|
color: Theme.of(context).errorColor,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.fromLTRB(Sizes.leftWidgetPadding, Sizes.rowPadding, Sizes.rightWidgetPadding, Sizes.rowPadding),
|
padding: EdgeInsets.fromLTRB(Sizes.leftWidgetPadding, Sizes.rowPadding, Sizes.rightWidgetPadding, Sizes.rowPadding),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -15,21 +24,25 @@ class ErrorCard extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'There was an error rendering card: ${card.type}. Please copy card config to clipboard and report this issue. Thanks!',
|
error,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
card != null ?
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Clipboard.setData(new ClipboardData(text: card.cardConfig));
|
Clipboard.setData(new ClipboardData(text: card.cardConfig));
|
||||||
},
|
},
|
||||||
child: Text('Copy card config'),
|
child: Text('Copy card config'),
|
||||||
),
|
) :
|
||||||
|
Container(width: 0, height: 0),
|
||||||
|
showReportButton ?
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Launcher.launchURLInBrowser("https://github.com/estevez-dev/ha_client/issues/new?assignees=&labels=&template=bug_report.md&title=");
|
Launcher.launchURLInBrowser("https://github.com/estevez-dev/ha_client/issues/new?assignees=&labels=&template=bug_report.md&title=");
|
||||||
},
|
},
|
||||||
child: Text('Report issue'),
|
child: Text('Report issue'),
|
||||||
)
|
) :
|
||||||
|
Container(width: 0, height: 0)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -7,6 +7,6 @@ class UnsupportedCard extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return Container(height: 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,12 +4,14 @@ class CardWrapper extends StatelessWidget {
|
|||||||
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final EdgeInsets padding;
|
final EdgeInsets padding;
|
||||||
|
final Color color;
|
||||||
|
|
||||||
const CardWrapper({Key key, this.child, this.padding: const EdgeInsets.all(0)}) : super(key: key);
|
const CardWrapper({Key key, this.child, this.color, this.padding: const EdgeInsets.all(0)}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Card(
|
||||||
|
color: color,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
child: child
|
child: child
|
||||||
|
@ -40,8 +40,8 @@ class CoverEntity extends Entity {
|
|||||||
CoverEntity.SUPPORT_SET_TILT_POSITION);
|
CoverEntity.SUPPORT_SET_TILT_POSITION);
|
||||||
|
|
||||||
|
|
||||||
double get currentPosition => _getDoubleAttributeValue('current_position');
|
double get currentPosition => _getDoubleAttributeValue('current_position') ?? 0;
|
||||||
double get currentTiltPosition => _getDoubleAttributeValue('current_tilt_position');
|
double get currentTiltPosition => _getDoubleAttributeValue('current_tilt_position') ?? 0;
|
||||||
bool get canBeOpened => ((state != EntityState.opening) && (state != EntityState.open)) || (state == EntityState.open && currentPosition != null && currentPosition > 0.0 && currentPosition < 100.0);
|
bool get canBeOpened => ((state != EntityState.opening) && (state != EntityState.open)) || (state == EntityState.open && currentPosition != null && currentPosition > 0.0 && currentPosition < 100.0);
|
||||||
bool get canBeClosed => ((state != EntityState.closing) && (state != EntityState.closed));
|
bool get canBeClosed => ((state != EntityState.closing) && (state != EntityState.closed));
|
||||||
bool get canTiltBeOpened => currentTiltPosition < 100;
|
bool get canTiltBeOpened => currentTiltPosition < 100;
|
||||||
|
@ -8,8 +8,8 @@ class TimerEntity extends Entity {
|
|||||||
@override
|
@override
|
||||||
void update(Map rawData, String webHost) {
|
void update(Map rawData, String webHost) {
|
||||||
super.update(rawData, webHost);
|
super.update(rawData, webHost);
|
||||||
String durationSource = "${attributes["duration"]}";
|
if (attributes.containsKey('duration')) {
|
||||||
if (durationSource != null && durationSource.isNotEmpty) {
|
String durationSource = "${attributes["duration"]}";
|
||||||
try {
|
try {
|
||||||
List<String> durationList = durationSource.split(":");
|
List<String> durationList = durationSource.split(":");
|
||||||
if (durationList.length == 1) {
|
if (durationList.length == 1) {
|
||||||
|
@ -149,7 +149,7 @@ class EntityCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isExist(String entityId) {
|
bool isExist(String entityId) {
|
||||||
return _allEntities[entityId] != null;
|
return _allEntities.containsKey(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Entity> getByDomains({List<String> includeDomains: const [], List<String> excludeDomains: const [], List<String> stateFiler}) {
|
List<Entity> getByDomains({List<String> includeDomains: const [], List<String> excludeDomains: const [], List<String> stateFiler}) {
|
||||||
|
@ -221,7 +221,7 @@ class HomeAssistant {
|
|||||||
var data = json.decode(prefs.getString('cached_services'));
|
var data = json.decode(prefs.getString('cached_services'));
|
||||||
_parseServices(data ?? {});
|
_parseServices(data ?? {});
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
Logger.e(e, stacktrace: stacktrace);
|
Logger.e(e, stacktrace: stacktrace, skipCrashlytics: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await ConnectionManager().sendSocketMessage(type: "get_services").then((data) => _parseServices(data)).catchError((e) {
|
await ConnectionManager().sendSocketMessage(type: "get_services").then((data) => _parseServices(data)).catchError((e) {
|
||||||
@ -261,7 +261,7 @@ class HomeAssistant {
|
|||||||
var data = json.decode(sharedPrefs.getString('cached_panels'));
|
var data = json.decode(sharedPrefs.getString('cached_panels'));
|
||||||
_parsePanels(data ?? {});
|
_parsePanels(data ?? {});
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
Logger.e(e, stacktrace: stacktrace);
|
Logger.e(e, stacktrace: stacktrace, skipCrashlytics: true);
|
||||||
panels.clear();
|
panels.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,9 +5,9 @@ class MobileAppIntegrationManager {
|
|||||||
static final _appRegistrationData = {
|
static final _appRegistrationData = {
|
||||||
"device_name": "",
|
"device_name": "",
|
||||||
"app_version": "$appVersion",
|
"app_version": "$appVersion",
|
||||||
"manufacturer": DeviceInfoManager().manufacturer,
|
"manufacturer": DeviceInfoManager().manufacturer ?? "unknown",
|
||||||
"model": DeviceInfoManager().model,
|
"model": DeviceInfoManager().model ?? "unknown",
|
||||||
"os_version": DeviceInfoManager().osVersion,
|
"os_version": DeviceInfoManager().osVersion ?? "0",
|
||||||
"app_data": {
|
"app_data": {
|
||||||
"push_token": "",
|
"push_token": "",
|
||||||
"push_url": "https://us-central1-ha-client-c73c4.cloudfunctions.net/pushNotifyV3"
|
"push_url": "https://us-central1-ha-client-c73c4.cloudfunctions.net/pushNotifyV3"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: hass_client
|
name: hass_client
|
||||||
description: Home Assistant Android Client
|
description: Home Assistant Android Client
|
||||||
|
|
||||||
version: 1.1.0+1156
|
version: 1.1.0+1157
|
||||||
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
@ -25,7 +25,7 @@ dependencies:
|
|||||||
webview_flutter: ^0.3.19+7
|
webview_flutter: ^0.3.19+7
|
||||||
hive: ^1.4.1+1
|
hive: ^1.4.1+1
|
||||||
hive_flutter: ^0.3.0+2
|
hive_flutter: ^0.3.0+2
|
||||||
device_info: ^0.4.1+4
|
device_info: ^0.4.2+4
|
||||||
geolocator: ^5.3.1
|
geolocator: ^5.3.1
|
||||||
workmanager: ^0.2.2
|
workmanager: ^0.2.2
|
||||||
battery: ^1.0.0
|
battery: ^1.0.0
|
||||||
|
Reference in New Issue
Block a user