From 3fca71391f4d1036f184f7d67ecaeef4e6b3837e Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Wed, 20 Mar 2024 21:06:45 +0100 Subject: [PATCH] update: small change no server behavior --- app/lib/pages/default_page.dart | 7 ++++++- app/lib/widgets/choropleth_map.dart | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/lib/pages/default_page.dart b/app/lib/pages/default_page.dart index eeb33511..badd63c2 100644 --- a/app/lib/pages/default_page.dart +++ b/app/lib/pages/default_page.dart @@ -39,7 +39,12 @@ class _DefaultPageState extends State<DefaultPage> { throw Exception("Failed to fetch measurements: $error"); }); - relationFuture = fetchRelation(); + // Attempt to fetch relation from server if app establishes connection + if (serverConnection){ + relationFuture = fetchRelation(); + } else { // Read last saved data + relationFuture = loadSavedRelation(); + } // Schedule fetchMarkerData to run periodically based on fetchInterval const Duration interval = Duration(minutes: fetchInterval); // NB fetchInterval value to be determined diff --git a/app/lib/widgets/choropleth_map.dart b/app/lib/widgets/choropleth_map.dart index a53409b5..2ab4eb52 100644 --- a/app/lib/widgets/choropleth_map.dart +++ b/app/lib/widgets/choropleth_map.dart @@ -40,7 +40,6 @@ class _ChoroplethMapState extends State<ChoroplethMap> { late MapShapeSource mapShapeSource; late final MapZoomPanBehavior _zoomPanBehavior = MapZoomPanBehavior(); List<SubDiv> subdivisions = <SubDiv>[]; - List<SubDiv> groupDivisions = <SubDiv>[]; @override void initState() { -- GitLab