@@ -105,12 +105,15 @@ class NearbyParentFragmentPresenter
105
105
*
106
106
* @see SchedulePlacesUpdateOptions
107
107
*/
108
- private suspend fun schedulePlacesUpdate (markerPlaceGroups : List <MarkerPlaceGroup >) =
108
+ private suspend fun schedulePlacesUpdate (
109
+ markerPlaceGroups : List <MarkerPlaceGroup >,
110
+ force : Boolean = false
111
+ ) =
109
112
withContext(Dispatchers .Main ) {
110
113
if (markerPlaceGroups.isEmpty()) return @withContext
111
114
schedulePlacesUpdateJob?.cancel()
112
115
schedulePlacesUpdateJob = launch {
113
- if (SchedulePlacesUpdateOptions .skippedCount++
116
+ if (! force && SchedulePlacesUpdateOptions .skippedCount++
114
117
< SchedulePlacesUpdateOptions .SKIP_LIMIT
115
118
) {
116
119
delay(SchedulePlacesUpdateOptions .SKIP_DELAY_MS )
@@ -298,8 +301,6 @@ class NearbyParentFragmentPresenter
298
301
lockUnlockNearby(false ) // So that new location updates wont come
299
302
nearbyParentFragmentView.setProgressBarVisibility(false )
300
303
301
- updatePlaceGroupsToControllerAndRender(nearbyPlaceGroups)
302
-
303
304
loadPlacesDataAyncJob = scope?.launch(Dispatchers .IO ) {
304
305
// clear past clicks and bookmarkChanged queues
305
306
clickedPlaces.clear()
@@ -312,18 +313,20 @@ class NearbyParentFragmentPresenter
312
313
val indicesToUpdate = mutableListOf<Int >()
313
314
for (i in 0 .. updatedGroups.lastIndex) {
314
315
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
+ }
320
325
} else {
321
326
indicesToUpdate.add(i)
322
327
}
323
328
}
324
- if (indicesToUpdate.size < updatedGroups.size) {
325
- schedulePlacesUpdate(updatedGroups)
326
- }
329
+ schedulePlacesUpdate(updatedGroups, force = true )
327
330
// channel for lists of indices of places, each list to be fetched in a single request
328
331
val fetchPlacesChannel = Channel <List <Int >>(Channel .UNLIMITED )
329
332
var totalBatches = 0
0 commit comments