mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fix/handle-shared-files-and-error-handling
This commit is contained in:
parent
b69a4260e3
commit
c0a93b6fc2
1 changed files with 15 additions and 8 deletions
|
|
@ -469,18 +469,23 @@ class UploadWorker(
|
|||
contribution: Contribution,
|
||||
) {
|
||||
val wikiDataPlace = contribution.wikidataPlace
|
||||
if (wikiDataPlace != null && wikiDataPlace.imageValue == null) {
|
||||
|
||||
if (wikiDataPlace != null) {
|
||||
if (!contribution.hasInvalidLocation()) {
|
||||
var revisionID: Long? = null
|
||||
try {
|
||||
revisionID =
|
||||
wikidataEditService.createClaim(
|
||||
wikiDataPlace,
|
||||
uploadResult.filename,
|
||||
contribution.media.captions,
|
||||
)
|
||||
if (null != revisionID) {
|
||||
// Always attempt to update the image claim with the latest photo
|
||||
revisionID = wikidataEditService.createClaim(
|
||||
wikiDataPlace,
|
||||
uploadResult.filename,
|
||||
contribution.media.captions,
|
||||
)
|
||||
Timber.d(revisionID.toString())
|
||||
if (revisionID != null) {
|
||||
Timber.d("Updating WikiItem place with image")
|
||||
withContext(Dispatchers.IO) {
|
||||
Timber.d("Updating WikiItem place with image")
|
||||
// Fetch and update place details
|
||||
val place = placesRepository.fetchPlace(wikiDataPlace.id)
|
||||
place.name = wikiDataPlace.name
|
||||
place.pic = HOME_URL + uploadResult.createCanonicalFileName()
|
||||
|
|
@ -511,9 +516,11 @@ class UploadWorker(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveCompletedContribution(contribution, uploadResult)
|
||||
}
|
||||
|
||||
|
||||
private fun saveCompletedContribution(
|
||||
contribution: Contribution,
|
||||
uploadResult: UploadResult,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue