Set name of the place to avoid race condition with NearbyParentFragment. Update Success Notification to show only after the pin has been updated.

This commit is contained in:
Christo Joby Antony 2024-10-19 01:26:07 +11:00
parent 1038cb2d19
commit 8783138e9e

View file

@ -477,9 +477,9 @@ class UploadWorker(
contribution.media.captions, contribution.media.captions,
) )
if (null != revisionID) { if (null != revisionID) {
showSuccessNotification(contribution)
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val place = placesRepository.fetchPlace(wikiDataPlace.id); val place = placesRepository.fetchPlace(wikiDataPlace.id);
place.name = wikiDataPlace.name;
place.pic = HOME_URL + uploadResult.createCanonicalFileName() place.pic = HOME_URL + uploadResult.createCanonicalFileName()
placesRepository placesRepository
.save(place) .save(place)
@ -487,6 +487,7 @@ class UploadWorker(
.blockingAwait() .blockingAwait()
Timber.d("Updated WikiItem place ${place.name} with image ${place.pic}") Timber.d("Updated WikiItem place ${place.name} with image ${place.pic}")
} }
showSuccessNotification(contribution)
} }
} catch (exception: Exception) { } catch (exception: Exception) {
Timber.e(exception) Timber.e(exception)