Parcourir la source

Only use updateLocationTag() to update location tag

ashilkn il y a 2 ans
Parent
commit
652e77ab9d

+ 0 - 32
lib/services/location_service.dart

@@ -127,38 +127,6 @@ class LocationService {
     return [degrees, minutes, seconds];
   }
 
-  Future<void> updateCenterPoint(
-    LocalEntity<LocationTag> locationTagEntity,
-    Location newCenterPoint,
-  ) async {
-    try {
-      // await Future.delayed(const Duration(seconds: 2));
-      // assert(false);
-      final locationTag = locationTagEntity.item;
-      //Semi-major axis of the ellipse (b) doesn't change unless radius is changed.
-      final a = (locationTag.radius * _scaleFactor(newCenterPoint.latitude!)) /
-          kilometersPerDegree;
-      final updatedLoationTag = locationTagEntity.item
-          .copyWith(centerPoint: newCenterPoint, aSquare: a * a);
-      await EntityService.instance.addOrUpdate(
-        EntityType.location,
-        json.encode(updatedLoationTag.toJson()),
-        id: locationTagEntity.id,
-      );
-      Bus.instance.fire(
-        LocationTagUpdatedEvent(
-          LocTagEventType.update,
-          updatedLocTagEntities: [
-            LocalEntity(updatedLoationTag, locationTagEntity.id)
-          ],
-        ),
-      );
-    } catch (e, s) {
-      _logger.severe("Failed to update center point", e, s);
-      rethrow;
-    }
-  }
-
   ///Will only update if there is a change in the locationTag's properties
   Future<void> updateLocationTag({
     required LocalEntity<LocationTag> locationTagEntity,

+ 3 - 3
lib/ui/viewer/location/pick_center_point_widget.dart

@@ -169,9 +169,9 @@ class PickCenterPointWidget extends StatelessWidget {
                                     final selectedFile =
                                         selectedFiles.files.first;
                                     await LocationService.instance
-                                        .updateCenterPoint(
-                                      locationTagEntity,
-                                      selectedFile.location!,
+                                        .updateLocationTag(
+                                      locationTagEntity: locationTagEntity,
+                                      newCenterPoint: selectedFile.location!,
                                     )
                                         .onError((e, s) {
                                       showGenericErrorDialog(context: context);