Update: 2026-06-30 23:32:14

This commit is contained in:
Hamza-Ayed
2026-06-30 23:32:15 +03:00
parent 808066f4a6
commit d2ce4bdb16
7 changed files with 277 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
import 'package:geolocator/geolocator.dart';
import 'package:siro_rider/services/geofencing_service.dart';
class GeoLocation {
Future<Position> getCurrentLocation() async {
@@ -28,7 +29,16 @@ class GeoLocation {
}
// When we reach here, permissions are granted and we can fetch the location.
return await Geolocator.getCurrentPosition(
final position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
// Update Geofences based on the fresh location
try {
SiroGeofencingService.syncZonesWithServer(position.latitude, position.longitude);
} catch (e) {
// Ignore errors so it doesn't break the main location flow
}
return position;
}
}