Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into prod/festapp
Browse files Browse the repository at this point in the history
  • Loading branch information
miakh committed Aug 13, 2024
2 parents e009710 + 812a999 commit 431a39d
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions lib/pages/MapPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ class _MapPageState extends State<MapPage> with TickerProviderStateMixin {
offlinePlaces.where((element) => !element.isHidden).toList();
}

if(placeId != null) {
var p = offlinePlaces.firstWhereOrNull((p)=>p.id == placeId);
if(p != null) {
mapOfflinePlaces.add(p);
}
}

await addEventsToPlace(mapOfflinePlaces);
addPlacesToMap(mapOfflinePlaces);

Expand All @@ -100,6 +107,8 @@ class _MapPageState extends State<MapPage> with TickerProviderStateMixin {

_icons = await DataService.getAllIcons();
List<PlaceModel> mapPlaces = [];
List<PlaceModel> showMapPlaces = [];

if (loadOtherGroups) {
var groups = await DataService.getGroupsWithPlaces();
for (var element in groups) {
Expand All @@ -111,15 +120,22 @@ class _MapPageState extends State<MapPage> with TickerProviderStateMixin {
}
} else {
mapPlaces = await DataService.getAllPlaces();
mapPlaces = mapPlaces.where((p)=>!p.isHidden).toList();
mapPlaces.sortPlaces(false);
showMapPlaces = mapPlaces.where((p)=>!p.isHidden).toList();
showMapPlaces.sortPlaces(false);
await OfflineDataHelper.saveAllPlaces(mapPlaces);
}

if (mapPlaces.isNotEmpty) {
if(placeId != null) {
var p = mapPlaces.firstWhereOrNull((p)=>p.id == placeId);
if(p != null) {
showMapPlaces.add(p);
}
}

if (showMapPlaces.isNotEmpty) {
_markers.clear();
await addEventsToPlace(mapPlaces);
addPlacesToMap(mapPlaces);
await addEventsToPlace(showMapPlaces);
addPlacesToMap(showMapPlaces);
}

if(placeId != null) {
Expand Down

0 comments on commit 431a39d

Please sign in to comment.