@@ -105,12 +105,15 @@ class NearbyParentFragmentPresenter
105105 *
106106 * @see SchedulePlacesUpdateOptions
107107 */
108- private suspend fun schedulePlacesUpdate (markerPlaceGroups : List <MarkerPlaceGroup >) =
108+ private suspend fun schedulePlacesUpdate (
109+ markerPlaceGroups : List <MarkerPlaceGroup >,
110+ force : Boolean = false
111+ ) =
109112 withContext(Dispatchers .Main ) {
110113 if (markerPlaceGroups.isEmpty()) return @withContext
111114 schedulePlacesUpdateJob?.cancel()
112115 schedulePlacesUpdateJob = launch {
113- if (SchedulePlacesUpdateOptions .skippedCount++
116+ if (! force && SchedulePlacesUpdateOptions .skippedCount++
114117 < SchedulePlacesUpdateOptions .SKIP_LIMIT
115118 ) {
116119 delay(SchedulePlacesUpdateOptions .SKIP_DELAY_MS )
@@ -298,8 +301,6 @@ class NearbyParentFragmentPresenter
298301 lockUnlockNearby(false ) // So that new location updates wont come
299302 nearbyParentFragmentView.setProgressBarVisibility(false )
300303
301- updatePlaceGroupsToControllerAndRender(nearbyPlaceGroups)
302-
303304 loadPlacesDataAyncJob = scope?.launch(Dispatchers .IO ) {
304305 // clear past clicks and bookmarkChanged queues
305306 clickedPlaces.clear()
@@ -312,18 +313,20 @@ class NearbyParentFragmentPresenter
312313 val indicesToUpdate = mutableListOf<Int >()
313314 for (i in 0 .. updatedGroups.lastIndex) {
314315 val repoPlace = placesRepository.fetchPlace(updatedGroups[i].place.entityID)
315- if (repoPlace != null && repoPlace.name != " " ){
316- updatedGroups[i] = MarkerPlaceGroup (
317- bookmarkLocationDao.findBookmarkLocation(repoPlace),
318- repoPlace
319- )
316+ if (repoPlace != null && repoPlace.name != null && repoPlace.name != " " ){
317+ updatedGroups[i].isBookmarked = bookmarkLocationDao.findBookmarkLocation(repoPlace)
318+ updatedGroups[i].place.apply {
319+ name = repoPlace.name
320+ isMonument = repoPlace.isMonument
321+ pic = repoPlace.pic ? : " "
322+ exists = repoPlace.exists ? : true
323+ longDescription = repoPlace.longDescription ? : " "
324+ }
320325 } else {
321326 indicesToUpdate.add(i)
322327 }
323328 }
324- if (indicesToUpdate.size < updatedGroups.size) {
325- schedulePlacesUpdate(updatedGroups)
326- }
329+ schedulePlacesUpdate(updatedGroups, force = true )
327330 // channel for lists of indices of places, each list to be fetched in a single request
328331 val fetchPlacesChannel = Channel <List <Int >>(Channel .UNLIMITED )
329332 var totalBatches = 0
0 commit comments