finished tracking. But not tested enough yet

time
This commit is contained in:
Nico
2025-05-19 22:11:52 +02:00
parent fccc810b8c
commit b97f703a47
18 changed files with 263 additions and 62 deletions

View File

@@ -1,10 +1,11 @@
import 'package:fforte/screens/addCam/exceptions/location_disabled_exception.dart';
import 'package:fforte/screens/addCam/exceptions/location_forbidden_exception.dart';
import 'package:fforte/screens/excursion/exceptions/need_always_location_exception.dart';
import 'package:geolocator/geolocator.dart';
class GeolocatorService {
// determine live position with checks for denied permission and turned off location service
static Future<Position> deteterminePosition() async {
static Future<Position> deteterminePosition({bool alwaysOnNeeded = false}) async {
bool locationEnabled;
LocationPermission permissionGiven;
@@ -20,6 +21,10 @@ class GeolocatorService {
throw LocationForbiddenException();
}
}
if (alwaysOnNeeded && permissionGiven != LocationPermission.always) {
throw NeedAlwaysLocation();
}
return await Geolocator.getCurrentPosition();
}