mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-10-11 18:28:48 +02:00
Clear node cache when switching to/from sandbox
This commit is contained in:
1 parent
363439f712
commit
9bf46721f0
2 files changed
+8
-1
No files matched your search
@@ -8,6 +8,8 @@ import 'models/osm_camera_node.dart';
|
|||||||
import 'models/pending_upload.dart';
|
import 'models/pending_upload.dart';
|
||||||
import 'models/tile_provider.dart';
|
import 'models/tile_provider.dart';
|
||||||
import 'services/offline_area_service.dart';
|
import 'services/offline_area_service.dart';
|
||||||
|
import 'services/node_cache.dart';
|
||||||
|
import 'widgets/camera_provider_with_cache.dart';
|
||||||
import 'state/auth_state.dart';
|
import 'state/auth_state.dart';
|
||||||
import 'state/operator_profile_state.dart';
|
import 'state/operator_profile_state.dart';
|
||||||
import 'state/profile_state.dart';
|
import 'state/profile_state.dart';
|
||||||
@@ -238,6 +240,11 @@ class AppState extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setUploadMode(UploadMode mode) async {
|
Future<void> setUploadMode(UploadMode mode) async {
|
||||||
|
// Clear node cache when switching upload modes to prevent mixing production/sandbox data
|
||||||
|
NodeCache.instance.clear();
|
||||||
|
CameraProviderWithCache.instance.notifyListeners();
|
||||||
|
debugPrint('[AppState] Cleared node cache due to upload mode change');
|
||||||
|
|
||||||
await _settingsState.setUploadMode(mode);
|
await _settingsState.setUploadMode(mode);
|
||||||
await _authState.onUploadModeChanged(mode);
|
await _authState.onUploadModeChanged(mode);
|
||||||
_startUploader(); // Restart uploader with new mode
|
_startUploader(); // Restart uploader with new mode
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class MapViewState extends State<MapView> {
|
|||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(message),
|
content: Text(message),
|
||||||
duration: const Duration(seconds: 2),
|
duration: const Duration(seconds: 4),
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user