mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 14:23:55 +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
|
|
@ -35,6 +35,7 @@ import timber.log.Timber;
|
|||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIDATA_ENTITY_ID_PREF;
|
||||
|
||||
public class NearbyListFragment extends DaggerFragment {
|
||||
private Bundle bundleForUpdates; // Carry information from activity about changed nearby places and current location
|
||||
|
|
@ -146,7 +147,7 @@ public class NearbyListFragment extends DaggerFragment {
|
|||
if (resultCode == RESULT_OK) {
|
||||
Timber.d("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
|
||||
requestCode, resultCode, data);
|
||||
controller.handleImagePicked(requestCode, data, true, directPrefs.getString("WikiDataEntityId", null));
|
||||
controller.handleImagePicked(requestCode, data, true, directPrefs.getString(WIKIDATA_ENTITY_ID_PREF, null));
|
||||
} else {
|
||||
Timber.e("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
|
||||
requestCode, resultCode, data);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
|
|||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIDATA_ENTITY_ID_PREF;
|
||||
|
||||
public class NearbyMapFragment extends DaggerFragment {
|
||||
|
||||
|
|
@ -711,7 +712,7 @@ public class NearbyMapFragment extends DaggerFragment {
|
|||
|
||||
fabCamera.setOnClickListener(view -> {
|
||||
if (fabCamera.isShown()) {
|
||||
Timber.d("Camera button tapped. Image title: " + place.getName() + "Image desc: " + place.getLongDescription());
|
||||
Timber.d("Camera button tapped. Place: %s", place.toString());
|
||||
storeSharedPrefs();
|
||||
directUpload.initiateCameraUpload();
|
||||
}
|
||||
|
|
@ -719,7 +720,7 @@ public class NearbyMapFragment extends DaggerFragment {
|
|||
|
||||
fabGallery.setOnClickListener(view -> {
|
||||
if (fabGallery.isShown()) {
|
||||
Timber.d("Gallery button tapped. Image title: " + place.getName() + "Image desc: " + place.getLongDescription());
|
||||
Timber.d("Gallery button tapped. Place: %s", place.toString());
|
||||
storeSharedPrefs();
|
||||
directUpload.initiateGalleryUpload();
|
||||
}
|
||||
|
|
@ -731,7 +732,7 @@ public class NearbyMapFragment extends DaggerFragment {
|
|||
editor.putString("Title", place.getName());
|
||||
editor.putString("Desc", place.getLongDescription());
|
||||
editor.putString("Category", place.getCategory());
|
||||
editor.putString("WikiDataEntityId", place.getWikiDataEntityId());
|
||||
editor.putString(WIKIDATA_ENTITY_ID_PREF, place.getWikiDataEntityId());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
|
@ -767,7 +768,7 @@ public class NearbyMapFragment extends DaggerFragment {
|
|||
if (resultCode == RESULT_OK) {
|
||||
Timber.d("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
|
||||
requestCode, resultCode, data);
|
||||
controller.handleImagePicked(requestCode, data, true, directPrefs.getString("WikiDataEntityId", null));
|
||||
controller.handleImagePicked(requestCode, data, true, directPrefs.getString(WIKIDATA_ENTITY_ID_PREF, null));
|
||||
} else {
|
||||
Timber.e("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
|
||||
requestCode, resultCode, data);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.util.Map;
|
|||
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.location.LatLng;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class Place {
|
||||
|
||||
|
|
@ -58,10 +59,12 @@ public class Place {
|
|||
@Nullable
|
||||
public String getWikiDataEntityId() {
|
||||
if (!hasWikidataLink()) {
|
||||
Timber.d("Wikidata entity ID is null for place with sitelink %s", siteLinks.toString());
|
||||
return null;
|
||||
}
|
||||
|
||||
String wikiDataLink = siteLinks.getWikidataLink().toString();
|
||||
Timber.d("Wikidata entity is %s", wikiDataLink);
|
||||
return wikiDataLink.replace("http://www.wikidata.org/entity/", "");
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +97,18 @@ public class Place {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Place(%s@%s)", name, location);
|
||||
return "Place{" +
|
||||
"name='" + name + '\'' +
|
||||
", label='" + label + '\'' +
|
||||
", longDescription='" + longDescription + '\'' +
|
||||
", secondaryImageUrl='" + secondaryImageUrl + '\'' +
|
||||
", location='" + location + '\'' +
|
||||
", category='" + category + '\'' +
|
||||
", image='" + image + '\'' +
|
||||
", secondaryImage=" + secondaryImage +
|
||||
", distance='" + distance + '\'' +
|
||||
", siteLinks='" + siteLinks.toString() + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,6 +58,15 @@ public class Sitelinks implements Parcelable {
|
|||
return Uri.parse(sanitisedStringUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Sitelinks{" +
|
||||
"wikipediaLink='" + wikipediaLink + '\'' +
|
||||
", commonsLink='" + commonsLink + '\'' +
|
||||
", wikidataLink='" + wikidataLink + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
private Sitelinks(Sitelinks.Builder builder) {
|
||||
this.wikidataLink = builder.wikidataLink;
|
||||
this.wikipediaLink = builder.wikipediaLink;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue