Skip to content

Commit c011de9

Browse files
committed
Cleaned tons of compiling errors
1 parent 8d6c60b commit c011de9

27 files changed

+328
-292
lines changed

android/local.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
sdk.dir=/opt/homebrew/share/android-commandlinetools
22
flutter.sdk=/opt/homebrew/share/flutter
3-
flutter.buildMode=release
3+
flutter.buildMode=debug
44
flutter.versionName=1.0.0
5-
flutter.versionCode=1769344571
5+
flutter.versionCode=1

lib/main.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'dart:io';
33
import 'package:flutter/foundation.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter_blue_plus/flutter_blue_plus.dart' as fbp;
6-
import 'package:geolocator/geolocator.dart';
76
import 'package:hive_flutter/hive_flutter.dart';
87
import 'package:permission_handler/permission_handler.dart';
98
import 'package:provider/provider.dart';

lib/models/ping_data.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class RepeaterInfo {
150150
if (s == 0) {
151151
r = g = b = l;
152152
} else {
153-
double q = l < 0.5 ? l * (1 + s) : l + s - l * s;
154-
double p = 2 * l - q;
153+
final q = l < 0.5 ? l * (1 + s) : l + s - l * s;
154+
final p = 2 * l - q;
155155
r = _hueToRgb(p, q, h + 1 / 3);
156156
g = _hueToRgb(p, q, h);
157157
b = _hueToRgb(p, q, h - 1 / 3);

lib/providers/app_state_provider.dart

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
55
import 'package:geolocator/geolocator.dart';
66
import 'package:hive_flutter/hive_flutter.dart';
77
import 'package:uuid/uuid.dart';
8-
import 'package:share_plus/share_plus.dart';
8+
import 'package:share_plus/share_plus.dart' show SharePlus, ShareParams, XFile;
99

1010
import '../models/connection_state.dart';
1111
import '../models/device_model.dart';
@@ -26,7 +26,6 @@ import '../services/gps_service.dart';
2626
import '../services/gps_simulator_service.dart';
2727
import '../services/meshcore/channel_service.dart';
2828
import '../services/meshcore/connection.dart';
29-
import '../services/meshcore/crypto_service.dart';
3029
import '../services/meshcore/packet_validator.dart' show PacketValidator, ChannelInfo;
3130
import '../services/meshcore/rx_logger.dart';
3231
import '../services/meshcore/tx_tracker.dart';
@@ -154,7 +153,6 @@ class AppStateProvider extends ChangeNotifier {
154153
bool? _inZone; // null = not checked yet, true/false = checked
155154
Map<String, dynamic>? _currentZone; // Zone info when inZone == true
156155
Map<String, dynamic>? _nearestZone; // Nearest zone info when inZone == false
157-
DateTime? _lastZoneCheck;
158156
Position? _lastZoneCheckPosition;
159157
bool _isCheckingZone = false;
160158

@@ -1205,7 +1203,7 @@ class AppStateProvider extends ChangeNotifier {
12051203
/// Check session validity before starting a wardrive action
12061204
/// Returns true if session is valid, false if expired (triggers disconnect)
12071205
Future<bool> _checkSessionBeforeAction() async {
1208-
final pos = _gpsService?.lastPosition;
1206+
final pos = _gpsService.lastPosition;
12091207
final result = await _apiService.checkSessionValid(
12101208
lat: pos?.latitude,
12111209
lon: pos?.longitude,
@@ -1335,7 +1333,7 @@ class AppStateProvider extends ChangeNotifier {
13351333
_apiService.enableHeartbeat(
13361334
gpsProvider: () {
13371335
// Provide current GPS coordinates for heartbeat (matching wardrive.js)
1338-
final pos = _gpsService?.lastPosition;
1336+
final pos = _gpsService.lastPosition;
13391337
if (pos == null) return null;
13401338
return (lat: pos.latitude, lon: pos.longitude);
13411339
},
@@ -1432,7 +1430,6 @@ class AppStateProvider extends ChangeNotifier {
14321430
_inZone = null;
14331431
_currentZone = null;
14341432
_nearestZone = null;
1435-
_lastZoneCheck = null;
14361433
_lastZoneCheckPosition = null;
14371434
debugLog('[GEOFENCE] Cleared zone data for offline mode');
14381435
} else {
@@ -1705,29 +1702,6 @@ class AppStateProvider extends ChangeNotifier {
17051702
}
17061703
}
17071704

1708-
/// Handle auth error response and show appropriate status
1709-
void _handleAuthError(Map<String, dynamic> result) {
1710-
final reason = result['reason'] as String?;
1711-
final message = result['message'] as String?;
1712-
final userMessage = _getErrorMessage(reason, message);
1713-
1714-
// Special handling for zone_full - this is actually a partial success
1715-
if (reason == 'zone_full') {
1716-
debugLog('[API] Auth returned zone_full - RX-only mode allowed: $userMessage');
1717-
return;
1718-
}
1719-
1720-
// Special case: outofdate is a critical error requiring app update
1721-
if (reason == 'outofdate') {
1722-
debugError('[API] App version outdated - update required: $userMessage');
1723-
return;
1724-
}
1725-
1726-
// Log error and add to error log
1727-
debugError('[API] Auth error: $reason - $userMessage');
1728-
logError(userMessage, severity: ErrorSeverity.error);
1729-
}
1730-
17311705
/// Handle session error from wardrive/heartbeat API calls
17321706
/// This may trigger auto-disconnect
17331707
Future<void> handleSessionError(String? reason, String? message) async {
@@ -1879,7 +1853,6 @@ class AppStateProvider extends ChangeNotifier {
18791853
return;
18801854
}
18811855

1882-
_lastZoneCheck = DateTime.now();
18831856
_lastZoneCheckPosition = _currentPosition;
18841857

18851858
final success = result['success'] == true;
@@ -2034,9 +2007,11 @@ class AppStateProvider extends ChangeNotifier {
20342007
/// Uses the native share sheet to allow users to share logs via email, messaging, etc.
20352008
Future<void> shareDebugLog(File file) async {
20362009
try {
2037-
final result = await Share.shareXFiles(
2038-
[XFile(file.path)],
2039-
subject: 'MeshMapper Debug Log',
2010+
final result = await SharePlus.instance.share(
2011+
ShareParams(
2012+
files: [XFile(file.path)],
2013+
subject: 'MeshMapper Debug Log',
2014+
),
20402015
);
20412016
debugLog('[DEBUG] Shared log: ${file.path}, status: ${result.status}');
20422017
} catch (e) {

lib/screens/connection_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ class _ConnectionScreenState extends State<ConnectionScreen> with WidgetsBinding
467467
padding: const EdgeInsets.all(12),
468468
margin: const EdgeInsets.only(bottom: 16),
469469
decoration: BoxDecoration(
470-
color: Colors.green.withOpacity(0.1),
470+
color: Colors.green.withValues(alpha: 0.1),
471471
border: Border.all(color: Colors.green),
472472
borderRadius: BorderRadius.circular(8),
473473
),
@@ -519,7 +519,7 @@ class _ConnectionScreenState extends State<ConnectionScreen> with WidgetsBinding
519519
Container(
520520
padding: const EdgeInsets.all(8),
521521
decoration: BoxDecoration(
522-
color: Colors.blue.withOpacity(0.1),
522+
color: Colors.blue.withValues(alpha: 0.1),
523523
borderRadius: BorderRadius.circular(4),
524524
),
525525
child: Row(
@@ -555,7 +555,7 @@ class _ConnectionScreenState extends State<ConnectionScreen> with WidgetsBinding
555555
child: Column(
556556
mainAxisSize: MainAxisSize.min,
557557
children: [
558-
Icon(
558+
const Icon(
559559
Icons.error_outline,
560560
size: 64,
561561
color: Colors.red,

lib/screens/main_scaffold.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class _MainScaffoldState extends State<MainScaffold> {
2727
bool _hasCheckedDisclosure = false;
2828

2929
final List<Widget> _screens = [
30-
HomeScreen(),
31-
LogScreen(),
32-
ConnectionScreen(),
33-
SettingsScreen(),
30+
const HomeScreen(),
31+
const LogScreen(),
32+
const ConnectionScreen(),
33+
const SettingsScreen(),
3434
];
3535

3636
@override

lib/screens/settings_screen.dart

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import '../utils/web_file_helpers_stub.dart'
1313
if (dart.library.html) '../utils/web_file_helpers.dart';
1414

1515
import '../providers/app_state_provider.dart';
16+
import '../utils/debug_logger_io.dart';
1617
import '../models/user_preferences.dart';
1718
import '../services/gps_simulator_service.dart';
1819
import '../services/offline_session_service.dart';
@@ -222,8 +223,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
222223

223224
// About section
224225
_buildSectionHeader(context, 'About'),
225-
ListTile(
226-
leading: const Icon(Icons.info_outline),
226+
const ListTile(
227+
leading: Icon(Icons.info_outline),
227228
title: Text(AppConstants.appName),
228229
),
229230
GestureDetector(
@@ -753,7 +754,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
753754

754755
Future<void> _pickRouteFile(BuildContext context, AppStateProvider appState) async {
755756
try {
756-
print('[SETTINGS] Opening file picker...');
757+
debugLog('[SETTINGS] Opening file picker...');
757758

758759
if (kIsWeb) {
759760
// Use dart:html directly on web to avoid file_picker initialization issues
@@ -767,21 +768,21 @@ class _SettingsScreenState extends State<SettingsScreen> {
767768
);
768769

769770
if (result != null && result.files.isNotEmpty) {
770-
print('[SETTINGS] File picked: ${result.files.first.name}');
771+
debugLog('[SETTINGS] File picked: ${result.files.first.name}');
771772
final file = result.files.first;
772773
final content = file.bytes != null
773774
? String.fromCharCodes(file.bytes!)
774775
: null;
775776

776-
if (content != null) {
777-
print('[SETTINGS] File content loaded, ${content.length} chars');
777+
if (content != null && context.mounted) {
778+
debugLog('[SETTINGS] File content loaded, ${content.length} chars');
778779
_processRouteFile(context, appState, content, file.name);
779780
}
780781
}
781782
}
782783
} catch (e, stackTrace) {
783-
print('[SETTINGS] Error: $e');
784-
print('[SETTINGS] Stack trace: $stackTrace');
784+
debugLog('[SETTINGS] Error: $e');
785+
debugLog('[SETTINGS] Stack trace: $stackTrace');
785786
if (context.mounted) {
786787
ScaffoldMessenger.of(context).showSnackBar(
787788
SnackBar(
@@ -798,20 +799,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
798799
pickFileWeb(
799800
accept: '.kml,.gpx,.xml',
800801
onFilePicked: (content, filename) {
801-
print('[SETTINGS] File picked: $filename');
802-
print('[SETTINGS] File content loaded, ${content.length} chars');
802+
debugLog('[SETTINGS] File picked: $filename');
803+
debugLog('[SETTINGS] File content loaded, ${content.length} chars');
803804
_processRouteFile(context, appState, content, filename);
804805
},
805806
);
806807
}
807808

808809
void _processRouteFile(BuildContext context, AppStateProvider appState, String content, String filename) {
809-
print('[SETTINGS] Calling loadSimulatorRoute...');
810+
debugLog('[SETTINGS] Calling loadSimulatorRoute...');
810811
final success = appState.loadSimulatorRoute(
811812
content,
812813
filename: filename,
813814
);
814-
print('[SETTINGS] loadSimulatorRoute returned: $success');
815+
debugLog('[SETTINGS] loadSimulatorRoute returned: $success');
815816

816817
if (context.mounted) {
817818
ScaffoldMessenger.of(context).showSnackBar(

lib/services/api_queue_service.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ApiQueueService {
2828
bool _isUploading = false;
2929

3030
// Offline mode
31-
bool _offlineMode = false;
31+
bool offlineMode = false;
3232
final List<Map<String, dynamic>> _offlinePings = [];
3333

3434
// RX buffer for grouping by repeater
@@ -40,17 +40,9 @@ class ApiQueueService {
4040
/// Callback for successful uploads (passes count of items uploaded)
4141
void Function(int uploadedCount)? onUploadSuccess;
4242

43-
/// Offline mode status
44-
bool get offlineMode => _offlineMode;
45-
4643
/// Number of pings accumulated in current offline session
4744
int get offlinePingCount => _offlinePings.length;
4845

49-
/// Set offline mode
50-
set offlineMode(bool value) {
51-
_offlineMode = value;
52-
}
53-
5446
ApiQueueService({required ApiService apiService}) : _apiService = apiService;
5547

5648
/// Initialize the queue (must be called before use)
@@ -96,7 +88,7 @@ class ApiQueueService {
9688
);
9789

9890
// In offline mode, accumulate to offline pings list instead of queue
99-
if (_offlineMode) {
91+
if (offlineMode) {
10092
_offlinePings.add(item.toApiJson());
10193
debugLog('[API QUEUE] TX enqueued (offline): $heardRepeats');
10294
return;
@@ -127,7 +119,7 @@ class ApiQueueService {
127119
);
128120

129121
// In offline mode, accumulate to offline pings list instead of queue
130-
if (_offlineMode) {
122+
if (offlineMode) {
131123
_offlinePings.add(item.toApiJson());
132124
return;
133125
}
@@ -171,7 +163,7 @@ class ApiQueueService {
171163
);
172164

173165
// In offline mode, accumulate to offline pings list instead of queue
174-
if (_offlineMode) {
166+
if (offlineMode) {
175167
_offlinePings.add(item.toApiJson());
176168
debugLog('[API QUEUE] DISC enqueued (offline): $repeaterId');
177169
return;

0 commit comments

Comments
 (0)