Refactor contacts management and improve path handling

- Updated ContactsProvider to initialize with device public key for filtering out self contacts.
- Added methods to check if a contact has a learned routing path and to get path quality indicators.
- Enhanced AppProvider to initialize ContactsProvider with device public key.
- Modified ConnectionProvider to log path status when sending messages.
- Created ContactStorageService for persisting contacts to local storage.
- Removed import/export functionality from MapManagementScreen.
- Updated UI components in DirectMessageSheet and SarUpdateSheet to use theme colors.
- Removed file_picker dependency from pubspec.yaml and generated plugin registrant.
This commit is contained in:
Janez T
2025-10-15 19:20:46 +02:00
parent 3f03b2e789
commit 91d9326804
17 changed files with 501 additions and 255 deletions

View File

@@ -1,8 +1,6 @@
import 'dart:io';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:flutter_map_tile_caching/custom_backend_api.dart';
import 'package:path_provider/path_provider.dart';
import '../models/map_layer.dart';
class TileCacheService {
@@ -124,42 +122,6 @@ class TileCacheService {
return stats / (1024 * 1024);
}
Future<String> exportCache() async {
if (!_isInitialized) {
throw StateError('TileCacheService not initialized. Call initialize() first.');
}
final directory = await getApplicationDocumentsDirectory();
final timestamp = DateTime.now().millisecondsSinceEpoch;
final exportPath = '${directory.path}/meshcore_maps_$timestamp.fmtc';
// Export using FMTCBackendAccess
await FMTCBackendAccess.internal.exportStores(
storeNames: [_storeName],
path: exportPath,
);
return exportPath;
}
Future<void> importCache(String filePath) async {
if (!_isInitialized) {
throw StateError('TileCacheService not initialized. Call initialize() first.');
}
final file = File(filePath);
if (!await file.exists()) {
throw Exception('Import file not found: $filePath');
}
// Import using FMTCBackendAccess
await FMTCBackendAccess.internal.importStores(
storeNames: [_storeName],
path: filePath,
strategy: ImportConflictStrategy.rename,
);
}
Future<List<String>> getAvailableStores() async {
if (!_isInitialized) {
throw StateError('TileCacheService not initialized. Call initialize() first.');