perf: nettoyage code mort, sécurisation clé, et remplacement des prints

This commit is contained in:
ElPoyo
2026-05-26 13:40:33 +02:00
parent 0bbc77ffc8
commit a59deb19a9
7 changed files with 31 additions and 141 deletions
+7 -7
View File
@@ -66,7 +66,7 @@ class ContainerProvider with ChangeNotifier {
// Charger toutes les pages en boucle
while (hasMore) {
pageCount++;
print('[ContainerProvider] Loading page $pageCount...');
DebugLog.info('[ContainerProvider] Loading page $pageCount...');
final result = await _dataService.getContainersPaginated(
limit: 100, // Charger 100 par page pour aller plus vite
@@ -86,14 +86,14 @@ class ContainerProvider with ChangeNotifier {
hasMore = result['hasMore'] as bool? ?? false;
lastVisible = result['lastVisible'] as String?;
print('[ContainerProvider] Loaded ${containers.length} containers, total: ${_containers.length}, hasMore: $hasMore');
DebugLog.info('[ContainerProvider] Loaded ${containers.length} containers, total: ${_containers.length}, hasMore: $hasMore');
}
_isLoading = false;
_isInitialized = true;
notifyListeners();
} catch (e) {
print('Error loading containers: $e');
DebugLog.error('[ContainerProvider] Error loading containers', e);
_isLoading = false;
notifyListeners();
}
@@ -292,7 +292,7 @@ class ContainerProvider with ChangeNotifier {
Future<List<ContainerModel>> getContainersByIds(List<String> containerIds) async {
if (containerIds.isEmpty) return [];
print('[ContainerProvider] Loading ${containerIds.length} containers by IDs...');
DebugLog.info('[ContainerProvider] Loading ${containerIds.length} containers by IDs...');
try {
// Vérifier d'abord le cache local
@@ -320,7 +320,7 @@ class ContainerProvider with ChangeNotifier {
}
}
print('[ContainerProvider] Found ${cachedContainers.length} in cache, ${missingIds.length} missing');
DebugLog.info('[ContainerProvider] Found ${cachedContainers.length} in cache, ${missingIds.length} missing');
// Si tous sont en cache, retourner directement
if (missingIds.isEmpty) {
@@ -341,12 +341,12 @@ class ContainerProvider with ChangeNotifier {
}
}
print('[ContainerProvider] Loaded ${loadedContainers.length} containers from API');
DebugLog.info('[ContainerProvider] Loaded ${loadedContainers.length} containers from API');
// Retourner tous les conteneurs (cache + chargés)
return [...cachedContainers, ...loadedContainers];
} catch (e) {
print('[ContainerProvider] Error loading containers by IDs: $e');
DebugLog.error('[ContainerProvider] Error loading containers by IDs', e);
rethrow;
}
}