mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-03 16:23:54 +01:00
Fix issue where Wikidata edits were not happening (#1682)
* Added logs to debug wikidata edits * Minor changes in logs
This commit is contained in:
parent
306f23d1e2
commit
b2a150a3ae
10 changed files with 55 additions and 9 deletions
|
|
@ -68,6 +68,7 @@ import android.support.design.widget.FloatingActionButton;
|
|||
import static fr.free.nrw.commons.upload.ExistingFileAsync.Result.DUPLICATE_PROCEED;
|
||||
import static fr.free.nrw.commons.upload.ExistingFileAsync.Result.NO_DUPLICATE;
|
||||
import static fr.free.nrw.commons.upload.FileUtils.getSHA1;
|
||||
import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIDATA_ENTITY_ID_PREF;
|
||||
|
||||
/**
|
||||
* Activity for the title/desc screen after image is selected. Also starts processing image
|
||||
|
|
@ -325,6 +326,8 @@ public class ShareActivity
|
|||
if (intent.hasExtra("isDirectUpload")) {
|
||||
Timber.d("This was initiated by a direct upload from Nearby");
|
||||
isNearbyUpload = true;
|
||||
wikiDataEntityId = intent.getStringExtra(WIKIDATA_ENTITY_ID_PREF);
|
||||
Timber.d("Received wikiDataEntityId from contribution controller %s", wikiDataEntityId);
|
||||
}
|
||||
mimeType = intent.getType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.upload;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.accounts.Account;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
|
|
@ -98,6 +99,7 @@ public class UploadController {
|
|||
public void startUpload(String title, Uri mediaUri, String description, String mimeType, String source, String decimalCoords, String wikiDataEntityId, ContributionUploadProgress onComplete) {
|
||||
Contribution contribution;
|
||||
|
||||
Timber.d("Wikidata entity ID received from Share activity is %s", wikiDataEntityId);
|
||||
//TODO: Modify this to include coords
|
||||
Account currentAccount = sessionManager.getCurrentAccount();
|
||||
if(currentAccount == null) {
|
||||
|
|
@ -124,6 +126,7 @@ public class UploadController {
|
|||
* @param contribution the contribution object
|
||||
* @param onComplete the progress tracker
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public void startUpload(final Contribution contribution, final ContributionUploadProgress onComplete) {
|
||||
//Set creator, desc, and license
|
||||
if (TextUtils.isEmpty(contribution.getCreator())) {
|
||||
|
|
|
|||
|
|
@ -259,8 +259,10 @@ public class UploadService extends HandlerService<Contribution> {
|
|||
|
||||
String resultStatus = uploadResult.getResultStatus();
|
||||
if (!resultStatus.equals("Success")) {
|
||||
Timber.d("Contribution upload failed. Wikidata entity won't be edited");
|
||||
showFailedNotification(contribution);
|
||||
} else {
|
||||
Timber.d("Contribution upload success. Initiating Wikidata edit for entity id %s", contribution.getWikiDataEntityId());
|
||||
wikidataEditService.createClaimWithLogging(contribution.getWikiDataEntityId(), filename);
|
||||
contribution.setFilename(uploadResult.getCanonicalFilename());
|
||||
contribution.setImageUrl(uploadResult.getImageUrl());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue