Skip to content

Commit 585fb51

Browse files
committed
Refactor GPS status logging to reduce verbosity and improve clarity; remove redundant position logging in RX logger
1 parent 9a02915 commit 585fb51

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

lib/providers/app_state_provider.dart

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -509,19 +509,21 @@ class AppStateProvider extends ChangeNotifier {
509509
_gpsService.statusStream.listen((status) {
510510
final previousStatus = _gpsStatus;
511511
_gpsStatus = status;
512-
debugLog('[GPS] Status changed: $previousStatus → $status');
513-
debugLog('[GPS] Post-change state: inZone=$_inZone, isCheckingZone=$_isCheckingZone, '
514-
'hasInternet=$_hasInternet, hasPosition=${_currentPosition != null}');
515512

516-
// Log when we transition to locked state (permission granted + GPS available)
517-
if (status == GpsStatus.locked && previousStatus != GpsStatus.locked) {
518-
debugLog('[GPS] GPS lock acquired - zone check should trigger on first position');
519-
}
520-
// Log when permission is denied or GPS disabled
521-
if (status == GpsStatus.permissionDenied) {
522-
debugLog('[GPS] Location permission denied - zone checks will be blocked');
523-
} else if (status == GpsStatus.disabled) {
524-
debugLog('[GPS] Location services disabled - zone checks will be blocked');
513+
// Only log when status actually changes
514+
if (previousStatus != status) {
515+
debugLog('[GPS] Status changed: $previousStatus → $status');
516+
517+
// Log when we transition to locked state (permission granted + GPS available)
518+
if (status == GpsStatus.locked) {
519+
debugLog('[GPS] GPS lock acquired - zone check should trigger on first position');
520+
}
521+
// Log when permission is denied or GPS disabled
522+
if (status == GpsStatus.permissionDenied) {
523+
debugLog('[GPS] Location permission denied - zone checks will be blocked');
524+
} else if (status == GpsStatus.disabled) {
525+
debugLog('[GPS] Location services disabled - zone checks will be blocked');
526+
}
525527
}
526528
notifyListeners();
527529
});
@@ -533,12 +535,6 @@ class AppStateProvider extends ChangeNotifier {
533535
_currentPosition = position;
534536
notifyListeners();
535537

536-
// Comprehensive diagnostic logging for debugging user issues
537-
debugLog('[GPS] Position received: ${position.latitude.toStringAsFixed(5)}, ${position.longitude.toStringAsFixed(5)} '
538-
'(accuracy: ${position.accuracy.toStringAsFixed(1)}m)');
539-
debugLog('[GPS] Current state: inZone=$_inZone, isCheckingZone=$_isCheckingZone, '
540-
'hasInternet=$_hasInternet, offlineMode=${_preferences.offlineMode}, gpsStatus=$_gpsStatus');
541-
542538
// Check zone on first GPS lock (when _inZone is null)
543539
// Skip zone checks when offline mode is enabled
544540
if (_inZone == null && !_preferences.offlineMode) {

lib/services/meshcore/rx_logger.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,6 @@ class RxLogger {
253253
/// Check all active RX batches for distance threshold on GPS position update
254254
/// Called from GPS service when position changes
255255
Future<void> checkDistanceTriggers(({double lat, double lon}) currentLocation) async {
256-
debugLog('[RX BATCH] checkDistanceTriggers called: active_batches=${_batchBuffer.length}');
257-
258256
if (_batchBuffer.isEmpty) {
259257
return; // No active batches to check
260258
}

0 commit comments

Comments
 (0)