Closed mcomella closed 7 years ago
The problem is the places in the PlacesProvider is updated after we check if the number of places are zero, to determine if we should show the "Try again" text.
In PlacesController.swift:
private func didFinishFetchingPlaces(places: [Place], forLocation location: CLLocation) {
...
eventsProvider.getEventsWithPlaces(forLocation: location, usingPlacesDatabase: self.database) { placesWithEvents in
...
self.displayPlaces(places: Array(union), forLocation: location) // <- waits on promise to set places
DispatchQueue.main.async {
...
self.delegate?.placesProviderDidFinishFetchingPlaces(self) // <- checks if places.count == 0
}
}
}
The Delegate is located in PlaceCarouselViewController
.
The promise waited on in self.displayPlaces is waiting for the places to get their travel times and for the places to be correctly sorted, before setting them.
fwiw, I think this is a regression from 6228e378d406852441554f738313dcb194090561.
WIP in https://github.com/mcomella/prox/tree/i519-dont-find, Brian is going to take this over.
This gives the false impression the app didn't load places when we're, I think, actually just waiting for the UI to render.
This is especially visible on device with Mock Location for "Chicago Cultural Center".