* Trigger API call to addDepictionsAndCaptions after succesfull upload from stash
This commit is contained in:
Ashish 2021-04-18 12:49:26 +05:30 committed by GitHub
parent bebc4afae2
commit 8c7954a158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View file

@ -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")
);
}