mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* Trigger API call to addDepictionsAndCaptions after succesfull upload from stash
This commit is contained in:
parent
bebc4afae2
commit
8c7954a158
2 changed files with 3 additions and 6 deletions
|
|
@ -280,6 +280,8 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
"Stash Upload success..proceeding to make wikidata edit"
|
||||
)
|
||||
|
||||
wikidataEditService.addDepictionsAndCaptions(uploadResult, contribution)
|
||||
.blockingSubscribe();
|
||||
if(contribution.wikidataPlace==null){
|
||||
Timber.d(
|
||||
"WikiDataEdit not required, upload success"
|
||||
|
|
@ -339,7 +341,6 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
* Make the WikiData Edit, if applicable
|
||||
*/
|
||||
private suspend fun makeWikiDataEdit(uploadResult: UploadResult, contribution: Contribution) {
|
||||
wikidataEditService.addDepictionsAndCaptions(uploadResult, contribution)
|
||||
val wikiDataPlace = contribution.wikidataPlace
|
||||
if (wikiDataPlace != null && wikiDataPlace.imageValue == null) {
|
||||
if (!contribution.hasInvalidLocation()) {
|
||||
|
|
|
|||
|
|
@ -179,13 +179,12 @@ public class WikidataEditService {
|
|||
}
|
||||
}
|
||||
|
||||
public Disposable addDepictionsAndCaptions(UploadResult uploadResult, Contribution contribution) {
|
||||
public Observable addDepictionsAndCaptions(final UploadResult uploadResult, final Contribution contribution) {
|
||||
return wikiBaseClient.getFileEntityId(uploadResult)
|
||||
.doOnError(throwable -> {
|
||||
Timber.e(throwable, "Error occurred while getting EntityID to set DEPICTS property");
|
||||
ViewUtil.showLongToast(context, context.getString(R.string.wikidata_edit_failure));
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.switchMap(fileEntityId -> {
|
||||
if (fileEntityId != null) {
|
||||
Timber.d("EntityId for image was received successfully: %s", fileEntityId);
|
||||
|
|
@ -198,9 +197,6 @@ public class WikidataEditService {
|
|||
return Observable.empty();
|
||||
}
|
||||
}
|
||||
).subscribe(
|
||||
success -> Timber.d("edit response: %s", success),
|
||||
throwable -> Timber.e(throwable, "posting edits failed")
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue