feat: Version 3.3.4 - Nouvelle architecture pages, optimisations widgets Flutter et API
- Mise à jour VERSION vers 3.3.4 - Optimisations et révisions architecture API (deploy-api.sh, scripts de migration) - Ajout documentation Stripe Tap to Pay complète - Migration vers polices Inter Variable pour Flutter - Optimisations build Android et nettoyage fichiers temporaires - Amélioration système de déploiement avec gestion backups - Ajout scripts CRON et migrations base de données 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_map_cache/flutter_map_cache.dart';
|
||||
import 'package:http_cache_file_store/http_cache_file_store.dart';
|
||||
import 'package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:geosector_app/core/constants/app_keys.dart';
|
||||
@@ -79,8 +78,8 @@ class _MapboxMapState extends State<MapboxMap> {
|
||||
// ignore: unused_field
|
||||
double _currentZoom = 13.0;
|
||||
|
||||
/// Provider de cache pour les tuiles
|
||||
CachedTileProvider? _tileProvider;
|
||||
/// Provider de tuiles (peut être NetworkTileProvider ou CachedTileProvider)
|
||||
TileProvider? _tileProvider;
|
||||
|
||||
/// Indique si le cache est initialisé
|
||||
bool _cacheInitialized = false;
|
||||
@@ -96,18 +95,31 @@ class _MapboxMapState extends State<MapboxMap> {
|
||||
/// Initialise le cache des tuiles
|
||||
Future<void> _initializeCache() async {
|
||||
try {
|
||||
if (kIsWeb) {
|
||||
// Pas de cache sur Web (non supporté)
|
||||
setState(() {
|
||||
_cacheInitialized = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
final dir = await getTemporaryDirectory();
|
||||
// Utiliser un nom de cache différent selon le provider
|
||||
final cacheName = widget.useOpenStreetMap ? 'OSMTileCache' : 'MapboxTileCache';
|
||||
final cacheStore = FileCacheStore('${dir.path}${Platform.pathSeparator}$cacheName');
|
||||
|
||||
_tileProvider = CachedTileProvider(
|
||||
store: cacheStore,
|
||||
// Configuration du cache
|
||||
// maxStale permet de servir des tuiles expirées jusqu'à 30 jours
|
||||
maxStale: const Duration(days: 30),
|
||||
final cacheDir = '${dir.path}/map_tiles_cache';
|
||||
|
||||
// Initialiser le HiveCacheStore
|
||||
final cacheStore = HiveCacheStore(
|
||||
cacheDir,
|
||||
hiveBoxName: 'mapTilesCache',
|
||||
);
|
||||
|
||||
|
||||
// Initialiser le CachedTileProvider
|
||||
_tileProvider = CachedTileProvider(
|
||||
maxStale: const Duration(days: 30),
|
||||
store: cacheStore,
|
||||
);
|
||||
|
||||
debugPrint('MapboxMap: Cache initialisé dans $cacheDir');
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_cacheInitialized = true;
|
||||
@@ -238,6 +250,8 @@ class _MapboxMapState extends State<MapboxMap> {
|
||||
options: MapOptions(
|
||||
initialCenter: widget.initialPosition,
|
||||
initialZoom: widget.initialZoom,
|
||||
minZoom: 7.0, // Zoom minimum pour éviter que les tuiles ne se chargent pas
|
||||
maxZoom: 20.0, // Zoom maximum
|
||||
interactionOptions: InteractionOptions(
|
||||
enableMultiFingerGestureRace: true,
|
||||
flags: widget.disableDrag
|
||||
@@ -265,22 +279,21 @@ class _MapboxMapState extends State<MapboxMap> {
|
||||
userAgentPackageName: 'app.geosector.fr',
|
||||
maxNativeZoom: 19,
|
||||
maxZoom: 20,
|
||||
minZoom: 1,
|
||||
// Retirer tileSize pour utiliser la valeur par défaut
|
||||
// Les additionalOptions ne sont pas nécessaires car le token est dans l'URL
|
||||
// Utilise le cache si disponible sur web, NetworkTileProvider sur mobile
|
||||
tileProvider: _cacheInitialized && _tileProvider != null
|
||||
minZoom: 7,
|
||||
// Utiliser le cache sur mobile, NetworkTileProvider sur Web
|
||||
tileProvider: !kIsWeb && _cacheInitialized && _tileProvider != null
|
||||
? _tileProvider!
|
||||
: NetworkTileProvider(
|
||||
headers: {
|
||||
'User-Agent': 'geosector_app/3.1.3',
|
||||
'User-Agent': 'geosector_app/3.3.1',
|
||||
'Accept': '*/*',
|
||||
},
|
||||
),
|
||||
errorTileCallback: (tile, error, stackTrace) {
|
||||
debugPrint('MapboxMap: Erreur de chargement de tuile: $error');
|
||||
debugPrint('MapboxMap: Coordonnées de la tuile: ${tile.coordinates}');
|
||||
debugPrint('MapboxMap: Stack trace: $stackTrace');
|
||||
// Réduire les logs d'erreur pour ne pas polluer la console
|
||||
if (!error.toString().contains('abortTrigger')) {
|
||||
debugPrint('MapboxMap: Erreur de chargement de tuile: $error');
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user