From 3f1ece26ec442dbf954ac2cc02597e318e7114e7 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Tue, 10 Dec 2019 21:19:29 +0000 Subject: [PATCH] Remove background task logging and reporting --- lib/home_assistant.class.dart | 1 + lib/managers/location_manager.class.dart | 18 +++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/home_assistant.class.dart b/lib/home_assistant.class.dart index 645711b..f83400c 100644 --- a/lib/home_assistant.class.dart +++ b/lib/home_assistant.class.dart @@ -104,6 +104,7 @@ class HomeAssistant { Future _getLovelace() { Completer completer = Completer(); + ConnectionManager().sendSocketMessage(type: "lovelace/config").then((data) { _rawLovelaceData = data; completer.complete(); diff --git a/lib/managers/location_manager.class.dart b/lib/managers/location_manager.class.dart index 627a61c..ab46f01 100644 --- a/lib/managers/location_manager.class.dart +++ b/lib/managers/location_manager.class.dart @@ -149,15 +149,14 @@ class LocationManager { void updateDeviceLocationIsolate() { workManager.Workmanager.executeTask((backgroundTask, data) { - print("[Background $backgroundTask] Started"); - final SentryClient sentryBackgroundClient = SentryClient(dsn: "https://5c868e5ef26947e2b61b189e391ec31b@sentry.io/1836366"); + //print("[Background $backgroundTask] Started"); Geolocator geolocator = Geolocator(); var battery = Battery(); int batteryLevel = 100; String webhookId = data["webhookId"]; String httpWebHost = data["httpWebHost"]; if (webhookId != null && webhookId.isNotEmpty) { - print("[Background $backgroundTask] hour=$battery"); + //print("[Background $backgroundTask] hour=$battery"); String url = "$httpWebHost/api/webhook/$webhookId"; Map headers = {}; headers["Content-Type"] = "application/json"; @@ -169,15 +168,15 @@ void updateDeviceLocationIsolate() { "battery": batteryLevel } }; - print("[Background $backgroundTask] Getting battery level..."); + //print("[Background $backgroundTask] Getting battery level..."); battery.batteryLevel.then((val) => data["data"]["battery"] = val).whenComplete((){ - print("[Background $backgroundTask] Getting device location..."); + //print("[Background $backgroundTask] Getting device location..."); geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high, locationPermissionLevel: GeolocationPermission.locationAlways).then((location) { if (location != null) { - print("[Background $backgroundTask] Got location: ${location.latitude} ${location.longitude}"); + //print("[Background $backgroundTask] Got location: ${location.latitude} ${location.longitude}"); data["data"]["gps"] = [location.latitude, location.longitude]; data["data"]["gps_accuracy"] = location.accuracy; - print("[Background $backgroundTask] Sending data home."); + //print("[Background $backgroundTask] Sending data home."); http.post( url, headers: headers, @@ -187,10 +186,7 @@ void updateDeviceLocationIsolate() { throw "Can't get device location. Location is null"; } }).catchError((e) { - sentryBackgroundClient.captureException( - exception: "${e.toString()}" - ); - print("[Background $backgroundTask] Error getting current location: ${e.toString()}"); + //print("[Background $backgroundTask] Error getting current location: ${e.toString()}"); }); }); }