refactor(01-01): rewire all imports, replace logging, apply constants
- Update gps_data_manager.dart: import ProcessedGpsData from models/, use GpsConfig constants, replace all print() with Logger calls - Update gps_service.dart: use GpsConfig.VALID_HEADING_MIN/MAX for heading validation - Update main.dart: import from config/, models/, replace all customDebugPrint() and print() with Logger, use TimingConfig/OverlayConfig constants, convert overlay IPC to OverlayMessage typed class - Delete customDebugPrint() function definition - Delete lib/speed_units.dart and lib/color_themes.dart (moved to config/) - Zero analyzer errors, zero bare print() calls remaining
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import 'dart:async';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'config/gps_constants.dart';
|
||||
|
||||
class GpsService {
|
||||
static double? _lastValidHeading;
|
||||
|
||||
|
||||
static Stream<Position> get positionStream {
|
||||
return Geolocator.getPositionStream(
|
||||
locationSettings: const LocationSettings(
|
||||
@@ -13,18 +14,18 @@ class GpsService {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static Future<bool> requestPermissions() async {
|
||||
final permission = await Permission.locationWhenInUse.request();
|
||||
return permission.isGranted;
|
||||
}
|
||||
|
||||
|
||||
static Future<bool> isLocationServiceEnabled() async {
|
||||
return await Geolocator.isLocationServiceEnabled();
|
||||
}
|
||||
|
||||
|
||||
static double getCachedHeading(double heading) {
|
||||
if (heading >= 0 && heading <= 360) {
|
||||
if (heading >= GpsConfig.VALID_HEADING_MIN && heading <= GpsConfig.VALID_HEADING_MAX) {
|
||||
_lastValidHeading = heading;
|
||||
return heading;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user