Missed location changes
This commit is contained in:
parent
bc72956365
commit
40eb564c29
@ -9,7 +9,6 @@ import android.os.Looper;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.concurrent.futures.CallbackToFutureAdapter;
|
import androidx.concurrent.futures.CallbackToFutureAdapter;
|
||||||
import androidx.work.BackoffPolicy;
|
|
||||||
import androidx.work.Constraints;
|
import androidx.work.Constraints;
|
||||||
import androidx.work.Data;
|
import androidx.work.Data;
|
||||||
import androidx.work.ExistingWorkPolicy;
|
import androidx.work.ExistingWorkPolicy;
|
||||||
|
@ -644,6 +644,35 @@ class MarkdownCardData extends CardData {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MapCardData extends CardData {
|
||||||
|
|
||||||
|
String title;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget buildCardWidget() {
|
||||||
|
return MapCard(card: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
MapCardData(rawData) : super(rawData) {
|
||||||
|
//Parsing card data
|
||||||
|
title = rawData['title'];
|
||||||
|
List<String> geoLocationSources = rawData['geo_location_sources'] ?? [];
|
||||||
|
if (geoLocationSources.isNotEmpty) {
|
||||||
|
//TODO add entities by source
|
||||||
|
}
|
||||||
|
var rawEntities = rawData["entities"] ?? [];
|
||||||
|
rawEntities.forEach((rawEntity) {
|
||||||
|
if (rawEntity is String) {
|
||||||
|
if (HomeAssistant().entities.isExist(rawEntity)) {
|
||||||
|
entities.add(
|
||||||
|
EntityWrapper(entity: HomeAssistant().entities.get(rawEntity)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class MediaControlCardData extends CardData {
|
class MediaControlCardData extends CardData {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
25
lib/cards/map_card.dart
Normal file
25
lib/cards/map_card.dart
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
part of '../main.dart';
|
||||||
|
|
||||||
|
class MapCard extends StatelessWidget {
|
||||||
|
final MapCardData card;
|
||||||
|
|
||||||
|
const MapCard({Key key, this.card}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CardWrapper(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(Sizes.leftWidgetPadding, Sizes.rowPadding, Sizes.rightWidgetPadding, Sizes.rowPadding),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: <Widget>[
|
||||||
|
CardHeader(name: card.title)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -58,6 +58,7 @@ part 'entities/entity_model.widget.dart';
|
|||||||
part 'entities/default_entity_container.widget.dart';
|
part 'entities/default_entity_container.widget.dart';
|
||||||
part 'entities/missed_entity.widget.dart';
|
part 'entities/missed_entity.widget.dart';
|
||||||
part 'cards/entity_button_card.dart';
|
part 'cards/entity_button_card.dart';
|
||||||
|
part 'cards/map_card.dart';
|
||||||
part 'pages/widgets/entity_attributes_list.dart';
|
part 'pages/widgets/entity_attributes_list.dart';
|
||||||
part 'entities/entity_icon.widget.dart';
|
part 'entities/entity_icon.widget.dart';
|
||||||
part 'entities/entity_name.widget.dart';
|
part 'entities/entity_name.widget.dart';
|
||||||
|
@ -33,7 +33,6 @@ class AppSettings {
|
|||||||
bool nextAlarmSensorCreated = false;
|
bool nextAlarmSensorCreated = false;
|
||||||
DisplayMode displayMode;
|
DisplayMode displayMode;
|
||||||
AppTheme appTheme;
|
AppTheme appTheme;
|
||||||
final int defaultLocationUpdateIntervalSeconds = 900;
|
|
||||||
|
|
||||||
bool get isAuthenticated => longLivedToken != null;
|
bool get isAuthenticated => longLivedToken != null;
|
||||||
bool get isTempAuthenticated => tempToken != null;
|
bool get isTempAuthenticated => tempToken != null;
|
||||||
|
@ -12,10 +12,10 @@ class IntegrationSettingsPage extends StatefulWidget {
|
|||||||
class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
|
class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
|
||||||
|
|
||||||
static const platform = const MethodChannel('com.keyboardcrumbs.hassclient/native');
|
static const platform = const MethodChannel('com.keyboardcrumbs.hassclient/native');
|
||||||
static final locationAccuracy = {
|
/*static final locationAccuracy = {
|
||||||
100: "High",
|
100: "High",
|
||||||
102: "Balanced"
|
102: "Balanced"
|
||||||
};
|
};*/
|
||||||
|
|
||||||
Duration _locationInterval;
|
Duration _locationInterval;
|
||||||
bool _locationTrackingEnabled = false;
|
bool _locationTrackingEnabled = false;
|
||||||
@ -35,11 +35,11 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
|
|||||||
await prefs.reload();
|
await prefs.reload();
|
||||||
SharedPreferences.getInstance().then((prefs) {
|
SharedPreferences.getInstance().then((prefs) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_accuracy = prefs.getInt("location-updates-priority") ?? 100;
|
_accuracy = /*prefs.getInt("location-updates-priority") ??*/ 100;
|
||||||
_locationTrackingEnabled = (prefs.getInt("location-updates-state") ?? 0) > 0;
|
_locationTrackingEnabled = (prefs.getInt("location-updates-state") ?? 0) > 0;
|
||||||
_showNotification = prefs.getBool("location-updates-show-notification") ?? true;
|
_showNotification = prefs.getBool("location-updates-show-notification") ?? true;
|
||||||
_locationInterval = Duration(milliseconds: prefs.getInt("location-updates-interval") ??
|
_locationInterval = Duration(milliseconds: prefs.getInt("location-updates-interval") ??
|
||||||
AppSettings().defaultLocationUpdateIntervalSeconds);
|
900000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -146,10 +146,8 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
|
|||||||
}
|
}
|
||||||
if ((_locationInterval?.inMinutes ?? 15) < 15) {
|
if ((_locationInterval?.inMinutes ?? 15) < 15) {
|
||||||
notes.add(_getNoteWidget('* Notification is mandatory for location updates with interval less than every 15 minutes', false));
|
notes.add(_getNoteWidget('* Notification is mandatory for location updates with interval less than every 15 minutes', false));
|
||||||
if (_accuracy < 102) {
|
|
||||||
notes.add(_getNoteWidget('* Battery consumption will be noticeable', true));
|
notes.add(_getNoteWidget('* Battery consumption will be noticeable', true));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (notes.isEmpty) {
|
if (notes.isEmpty) {
|
||||||
return Container(width: 0, height: 0);
|
return Container(width: 0, height: 0);
|
||||||
}
|
}
|
||||||
@ -184,7 +182,7 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(height: Sizes.rowPadding),
|
Container(height: Sizes.rowPadding),
|
||||||
Text("Accuracy:", style: Theme.of(context).textTheme.body2),
|
/*Text("Accuracy:", style: Theme.of(context).textTheme.body2),
|
||||||
Container(height: Sizes.rowPadding),
|
Container(height: Sizes.rowPadding),
|
||||||
DropdownButton<int>(
|
DropdownButton<int>(
|
||||||
value: _accuracy,
|
value: _accuracy,
|
||||||
@ -203,7 +201,7 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Container(height: Sizes.rowPadding),
|
Container(height: Sizes.rowPadding),*/
|
||||||
Text("Update interval"),
|
Text("Update interval"),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
Reference in New Issue
Block a user