@@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
55import 'package:geolocator/geolocator.dart' ;
66import 'package:hive_flutter/hive_flutter.dart' ;
77import '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
1010import '../models/connection_state.dart' ;
1111import '../models/device_model.dart' ;
@@ -26,7 +26,6 @@ import '../services/gps_service.dart';
2626import '../services/gps_simulator_service.dart' ;
2727import '../services/meshcore/channel_service.dart' ;
2828import '../services/meshcore/connection.dart' ;
29- import '../services/meshcore/crypto_service.dart' ;
3029import '../services/meshcore/packet_validator.dart' show PacketValidator, ChannelInfo;
3130import '../services/meshcore/rx_logger.dart' ;
3231import '../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) {
0 commit comments